natashawylie / iviewer

image viewer plugin for jquery
233 stars 97 forks source link

Get x and y positions and then setting these values #22

Closed mits149 closed 12 years ago

mits149 commented 12 years ago

Hi,

I am currently using iviewer and all works great. However I am using this plugin on a ajax updatepanel and this gets refreshed every few seconds. Because of postbacks when a user has zoomed in i get the zoom value using the info method and then store the value in hiddenfield and when a postback occurs i and page loaded i then set the zoom value. But now i want to get the info method to get me the x and y positions and then set them ..

Please can you give me some guidance on how to do this? Or can you include this in the next version release?

can3p commented 12 years ago

Have you tried moveTo method?

mits149 commented 12 years ago

but if I have dragged the image i want to know the x and y positions how do i get the x and y values.

Thank in advance.

can3p commented 12 years ago

To get information you can still use info method.

davetchen commented 12 years ago

I have a similar requirement and added a new case to the 'info' function to return the container coordinates (around line 638):

case 'coords':
  return {
    x: this.img_object.x(),
    y: this.img_object.y(),
  };

Then in my application code (within my onFinishLoad callback) I use the "setCoords" function after calling "set_zoom". This sets both pan and zoom and allows for easy browsing through an image sequence in the 'thumbs'. Thanks for a great plug-in!

can3p commented 12 years ago

Thanks for the comment, the changes are in master now