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
Manual zoom from sliders/range input #1108
Comments
Sure, just put in a slider and whenever it changes, call viewer.viewport.zoomTo() with the appropriate value. You'll probably want to convert the slider range to a logarithmic scale. Also, you should watch for zoom events and update the slider. |
Hi, sorry to reopen this old thread but i must admit i can't find out how to achieve the last part of your answer with tiled images, what a noob... a little help would be very welcome :) have a nice day |
Sure! Something like this should do it:
I haven't tested that, but it's the basic idea. There's a possibility you might get into some sort of infinite loop where you are watching the zoom to change the slider and watching the slider to change the zoom... You can fix that by keeping track of the most recent slider update and not updating it from your zoom handler if you're within a certain time threshold since then. |
Hi Ian actually, that's exactly what i've done, it works very well with a single image (i've used animation-finished to avoid too many requests and it works fine, too, my range slider updates the viewer and the viewer updates the range slider after some simple math with the viewer zoom value) when it comes to tiled Image (i've read what you say about being less accurate and tried, but unsuccessfully, to use TiledImage) it starts working at big zoom values (probably because it has less tiles to manage) but at lower ones i get funny results (with zoom eventhandler this time as nothing usable with animation or animation finished, just requests responses about the tiles that are in the viewer) have a nice day |
Hmm, I'm curious what you mean about the accuracy. You're saying the zoom values are weird when you're zoomed too far out? Or too far in? |
@virtualgadjo Okay, thank you for the further information! |
Hi is it possible to do a zoom on the canvas from sliders or range input ?
I guess i need to grab the zoom data and add something like the plus and minus button
thx for the support
The text was updated successfully, but these errors were encountered: