rthreejs icon indicating copy to clipboard operation
rthreejs copied to clipboard

retrieve current orientation information from globe

Open btupper opened this issue 5 years ago • 2 comments

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

btupper avatar Jan 21 '20 15:01 btupper

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 .

bwlewis avatar Jan 21 '20 15:01 bwlewis

Happy to help where I can, though I am far from knowledgeable about JS.

jaredlander avatar Jan 21 '20 16:01 jaredlander