trafficonese / widgetframe

Embed htmlwidgets in Responsive iframe.
https://bhaskarvk.github.io/widgetframe/
Other
68 stars 13 forks source link

Full window #23

Open mtennekes opened 4 years ago

mtennekes commented 4 years ago

Hi Bhaskar, great little handy package!

One question: how can I create a full window widget (in my case a leaflet map)? When I save the map with saveWidget, I get a full window map:

lf <- leaflet() %>% addTiles() %>% setView(0,0,4)
saveWidget(lf, "hw.html", selfcontained = FALSE)

Screenshot from 2020-05-20 09-31-48

However, with saveWidgetframe it is 400px:

saveWidgetframe(lf, "wf.html", selfcontained = FALSE)

Screenshot from 2020-05-20 09-32-03

The widgetframe package is very useful, the html files can get really large for leaflet widgets, especially with polygons and popups. This way, it is easier to embed it in other websites. Side question: do you know whether it's possible to save the json data separately from R? (The same question and a workaround has been posted https://stackoverflow.com/questions/34439928/embedding-an-r-htmlwidget-into-existing-webpage)

What I want to achieve in one of my current projects, is to have radio buttons to toggle between different full-window (leaflet) maps. Although this would be quiet easy, I still bump into several issues, like the ones mentioned.

Moreover, I'm looking to find ways to make it easier for other users to save interactive maps. I've added an argument in.iframe to tmap_save in the development version of tmap (https://github.com/mtennekes/tmap/commit/39554dcc717df2da7fc3d48efe0831fc62e3184e), but still thinking about the best approach/defaults to save interactive maps.