natashawylie / iviewer

image viewer plugin for jquery
233 stars 97 forks source link

Setting multiple properties at the same time #39

Closed ydkn closed 11 years ago

ydkn commented 11 years ago

Hi,

when I try to set multiple properties (e.g. angle, zoom, coordinates) at the same time the image is not properly placed within the canvas.

Example: If you try something like

 $('#iviewer').iviewer('angle', 90).iviewer('set_zoom', 200).iviewer('setCoords', -500, -500);

the angle and zoom is set correctly but the image is not placed with the given coordinates. If you now start to drag the image it jumps to the correct coordinates.

Thanks in advance for your help.

can3p commented 11 years ago

Ok, I've fixed it, but the price is that animation will stop if image coordinates will be modified during it.

ydkn commented 11 years ago

Thanks for fixing it so quickly!!!

I thought as much that this will come at the price of no animation.

Maybe a nice feature for the future would be to have a function to change multiple properties at the same time and have an animation which does both zooming and panning at the same time.

e.g.

$('#iviewer').iviewer('change': {'angle': 90, 'zoom': 200, 'setCoords': [-500, -500]})
can3p commented 11 years ago

The problem is that the order matters when we apply transformations. E.g. you will get different results when you zoom in and then move, and when you move and zoom afterwards. The good thing may be to provide a method setView, where you could specify the recangle that should be visible