I am trying to add bounding borders for the zoom and pan modes that I implemented for Unveil.js ( http://github.com/michael/unveil ). With borders on, you won’t be able to move outside the boundaries of the scene, and the scale bar (= scale) should not fall below 1.0. As a result, you will not be able to fully pan if you use zoomlevel 1.0.
You can see unlimited behavior on the example of stacks: dejavis.org/stacks. Use the mouse wheel to zoom. You can erase blocks from the screen or compress them endlessly, which should be avoided.
A very difficult problem is that scaling with the mouse pointer also causes the viewport to move inappropriately. Therefore, checking borders during panning is not enough. I would have to find a smart way to increase back up to 100% when using Mouswheel (without dirty jumps). Photoshop seems to have solved this problem when scaling an image.
I do not know how I should solve this. Very upset.: /
I use Matrix to store the current View transformation, which is being processed repeatedly. The code for makeup and panning is implemented here.
http://github.com/michael/unveil/blob/master/src/scene/behaviors.js
Thanks for any ideas. :)
Greetings
Michael
source
share