How Do I Use the ViewportEvent.TRANSFORM_END Event?
Hello,
I was hoping you could explain exactly when the ViewportEvent.TRANSFORM_END fires. I noticed when the MultiScaleImage initially loads, before any interaction occurs, the event fires three times. I thought that the event might fire for each tile in the MultiScaleImage, but I don't think there would ever be only three tiles (or any prime number of tiles).
Additionally, I'm uncertain about how the event works with user interaction. It seems the event fires multiple times in a simple pan interaction before the image is visibly done panning. Sometimes the event seems to fire after a small delay after the image is visibly done panning.
Any explanation would be greatly appreciated and thank you for the excellent work on OpenZoom.
I was hoping you could explain exactly when the ViewportEvent.TRANSFORM_END fires. I noticed when the MultiScaleImage initially loads, before any interaction occurs, the event fires three times. I thought that the event might fire for each tile in the MultiScaleImage, but I don't think there would ever be only three tiles (or any prime number of tiles).
Additionally, I'm uncertain about how the event works with user interaction. It seems the event fires multiple times in a simple pan interaction before the image is visibly done panning. Sometimes the event seems to fire after a small delay after the image is visibly done panning.
Any explanation would be greatly appreciated and thank you for the excellent work on OpenZoom.
2
people have this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
The company marked this question as answered.
-
Inappropriate?K,
Thanks for this interesting question. The idea behind the ViewportEvent.TRANSFORM_END* event is that it fires after the viewport transformer has finished the animation of the viewport. The reason why you see a slight delay between the visible end of the panning or zooming motion and the TRANSFORM_END event is because the default easing is set to exponential and therefore the last interpolation steps are not visible.
The reason why the event fires several times during initialization is because the viewport is being set up. The event also fires when the viewport is resized. You can check the implementation details in TweenerTransformer. Basically, every viewport transformation is marked by TRANSFORM_START, every interpolation step with TRANSFORM_UPDATE and the end with TRANSFORM_END.
If you can reproduce a case where this order is wrong, please report it as a bug.
I'm assuming you're asking this question because you're trying to achieve a certain use case. If you'd give me more details, I could maybe help out.
Cheers,
Daniel
* Bug: The event string constant should obviously be transformEnd. This will be fixed in the next release.
I’m excited
The company says
this answers the question
Loading Profile...




EMPLOYEE