rgl::rglwidget() function creates an htmlwidget that displays nicely in the RStudio viewer pane or an RMarkdown document. The package also includes some other functions to create controls to work with an rgl widget, and in many cases pipes can be used to combine these into one object, e.g.
library(rgl) example(plot3d) rglwidget() %>% rglMouse()
displays a scene and a select control to control how the mouse works within the scene. Internally, these are returned as a browsable tagList using something like
The problem is with the sizing. Once an rgl widget is put in a tagList, its size doesn't adapt to its container, so it's typically too big in the RStudio viewer. I can fix the size to a number of pixels, but I can't seem to find a way to say something like
width="100%", height="80%" in the rgl widget to leave room for the selection control.
What's the best way to specify sizing for an rgl widget that would survive being put in a tagList?