dreamRs / capture

Take screenshots in Shiny apps
https://dreamrs.github.io/capture
GNU General Public License v3.0
30 stars 4 forks source link

similar functionality to snapper #1

Closed yonicd closed 3 years ago

yonicd commented 3 years ago

Very nice, seems to duplicate what snapper does.

pvictor commented 3 years ago

Thanks, I missed that one. I updated README to add a link. I've made this for a specific need in my work, and put it here for convenience.

Victor

PS: I had trouble to capture leaflet maps with polygons with html2canvas, will look at your examples

yonicd commented 3 years ago

you had a problem in snapper w leaflets?

pvictor commented 3 years ago

Yeah, tried with html2canvas directly, but same issue with {snapper}, try this:

world <- rnaturalearth::ne_countries()
library(shiny)
library(leaflet)
shiny::runGadget(
  fluidPage(
    leafletOutput('myMap'),
    snapper::load_snapper(),
    snapper::preview_button(
      ui = '#myMap',
      opts = snapper::config(
        allowTaint = TRUE,
        useCORS = TRUE)
    ),
    snapper::snapper_div()
  ),
  server = function(input, output) {
    map = leaflet(world) %>% 
      addTiles() %>% 
      addPolygons()
    output$myMap = renderLeaflet(map)
  },
  viewer = shiny::browserViewer()
)

PS: seems to be a thing of the moment: https://github.com/daattali/shinyscreenshot

yonicd commented 3 years ago

Can you open it as an issue in snapper so i can track it in the repo. Thanks

yonicd commented 3 years ago

https://javascript.developreference.com/article/14294276/Leaflet+map+polygon+not+shown+on+canvas+when+using+html2canvas

Solution here: https://github.com/yonicd/snapper/issues/5#issuecomment-701265068

pvictor commented 3 years ago

Thanks, solved. Closing this.