-
Notifications
You must be signed in to change notification settings - Fork 32
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
Expose setPos
and setZoom
to ref
#70
Comments
Hello Florian. Sorry for the delay. Yeah, there were some changes, but you can still affect positions and zoom levels through a ref object. Here are the available methods: getZoom, zoomIn, reset, move, zoomOut, zoomToZone. |
Yeah but that methods don't work if you try to sync the exact zoom position and level on multiple PrismaZoom objects. I need the raw position and zoom level set and get methods exposed. |
The small demo app is using both |
No as again I don't need the values (they are easy to get) but I have 3 identical sized images in three tabs and when I do any type of operation in one (zoom or move) I need the exact same zoom and move applied to the other two images so that if the user switches the tab he always sees the same part of the image. |
Ok, you can try with the latest version
Keep in mind that |
@sylvaindubus Sorry for the super delayed response. Unfortunately the current implementation of |
@fkrauthan I've investigated a bit on that, and it doesn't seem very easy to add a boolean to disable these events because these functions are also used internally (by In the meantime, maybe you could use a boolean on your side (setting it to true before a manual action, and back to false afterwards), to control whether these functions should have any effect? |
I don't understand where the complications are?
is all you need to change and then if fireEvent is true and |
If you check other methods, you will see that So, in the meantime, using an external boolean to do whether something or not with your event is still the "least bad" solution to me. But we should definitely expose different setters than these internal methods for the next major release. |
Not really as |
Hmm, I still don't like it that much, feel a bit hacky to add it. I'll think about another solution and see if something better pops into my mind! |
alternative you can expose as external API setter that don't call the callback and keep internal the once that does (duplicate some logic) |
I have a use-case where I need to sync a couple of
PrismaZoom
objects. For that I need to be able to set position and zoom with fixed values (base on the event listeners). In older versions I was able to just usesetState
directly. But the new version doesn't have that capability anymore.The text was updated successfully, but these errors were encountered: