Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pauseAnimation() and resize event #141

Open
gmzbri opened this issue Dec 14, 2022 · 1 comment
Open

pauseAnimation() and resize event #141

gmzbri opened this issue Dec 14, 2022 · 1 comment

Comments

@gmzbri
Copy link

gmzbri commented Dec 14, 2022

I am trying to serve a static version of the globe as I don't need an interactive version of it.
I am using pauseAnimation() which works fine for this; but on resize the globe won't become responsive as I can't call the width() and height() attributes on a resize event unless I resume the animation again.

Is there a trivial way to allow the globe to contain on resize despite we freeze the globe and cancel interaction?

Thanks in advance.

@vasturiano
Copy link
Owner

@gmzbri thanks for reaching out.

pauseAnimationcauses all rendering of the globe canvas to halt. So if after you modify the container dimensions (via width or height), the container DOM element will resize, but the content of the canvas will not update, leading to loss of proportion ratio and a squashed globe.

So, if you want to have a canvas that is mainly static but can respond to dimension changes, the best is to resume animation momentarily when updating the container dimensions, and pause it immediately after.

On the other hand, if you just want to cancel user interaction, you could disable it via .enablePointerInteraction(false), instead of pausing the animation frame cycle.
And if you want disable the navigation controls, you can do it via:

.controls().enabled = false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants