rthreejs
rthreejs copied to clipboard
retrieve current orientation information from globe
Hi,
We have a (beautiful!) globe rendered in a shiny page with various monthly oceanographic climatology variables we overlay. When the user selects a new month (from a slider) or a new variable (from a drop down list), the globe is redrawn with the default orientation "rotationlat" = 0 and rotationlong = 0.
Is there a way to capture the current orientation so that we can use those values to set the orientation of the redrawn globe? I can't noodle out how to retrieve those.
Thanks! Ben
This should be possible on the most current version 0.3.3 just submitted to CRAN thanks to Jared's new elementId option https://github.com/bwlewis/rthreejs/pull/89. If all goes well, will be on CRAN soon (fingers crossed).
But it is still a bit tricky, I think the idea will be to use a custom widget ID (elementId) and then use tricks outlined here: https://shiny.rstudio.com/articles/communicating-with-js.html to get the rotation values back in to R via a reactive value.
I'll try to come up with an example, might need advice from @jaredlander .
Happy to help where I can, though I am far from knowledgeable about JS.