-
Notifications
You must be signed in to change notification settings - Fork 97
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
Set x y onload #56
Comments
No, iviewer does not have this functionality right now. I thinks it's time to implement the method like setVisibleRect, that will take the x,y, width and height and adjust zoom and image position accordingly. |
I created a function in the .js to set the position of x and y. Works well. I also have it setting zoom afterload. So I can save the current view to database and then go back and edot it at a later date. Although a function to do it all at once would be even better instead of multiple ones. Richard -------- Original message -------- No, iviewer does not have this functionality right now. I thinks it's time to implement the method like setVisibleRect, that will take the x,y, width and height and adjust zoom and image position accordingly. — |
Can you post the code of this function here? |
The function i used to set xy iv.iviewer('set_xy', '',''); set_xy: function(x, y) Its the same as moveTo. but moveTo is actually correcting the co-ords to the container from memory. So after seeing that moveTo was calculating to container it was easier to have a function not doing it. Defiantely a worthwhile feature if someone wants to reload a page and still show same crop, etc |
Please, look at the branch 56-set-display-rect It now has setDisplayRect function that recieves x,y, width and height of image part to show. The method will adjust image zoom and position in a way to fit into the container. |
width and height being the iviewer div width? or the width and height of the image itself? |
It's a width and height of the part of the image that you want to see in the container. So, to store the position you just need to get image coordinates in the top left and bottom right corner. From them you can get width and height. |
But on a reload the container should be the same. So no need for w and h. Maybe im bot grasping the concept sorry :) I use set zoom to get the image scale correct first...then set_xy and its correct position Sent from Samsung Mobile on O2 -------- Original message -------- It's a width and height of the part of the image that you want to see in the container. So, to store the position you just need to get image coordinates in the top left and bottom right corner. From them you can get width and height. — |
If there is no difference between set_xy and setCoords, why do you need new method? If your container can change it's width depending on window size, than the zoom can be different. We can make another method - which will take x,y (the physical pixel on image), zoom and deal in such a way that image will be properly scaled and rotated and point x,y will be in the center of the container. Will that work for you? |
Hello, your script is very usefull. |
This is a useful feature to me (and BTW thanks for making "iviewer" available, Dmitry). I wonder why this feature isn't in the main stream? As I found no other easy way (may be I overlooked something trivial?) I integrated zooming to a display rectangle with the startup options (see my changes below). With these changes in addition to some zoom factor or
in the startup options to set an initial display rectangle. Unspecified x/y will start the rectangle left/top, unspecified w/h extend the rectangle right/bottom border. Furthermore specified positive values for x/y and w/h extend from left/top (border) to right/down, negative values extend right/bottom (border) left/up. E.g. you can set the display rectangle also relative to the lower right corner of the picture by using something like
or you may use
to set the right top of the display rectangle 300 pixels from right and 100 pixels from top, extending it to the bottom right corner. (Note that coordinates Here is what I added:
|
@mirceaagr Please, add a new issue for that |
@tbfe-de Hi, thanks for the comment. I've made a different implementation a while ago. It's based not on the width and height of the display area but on the current offset, zoom and angle areas. So, you can just save them (see the test demo) and restore if needed. I thinks that this solution is rather bad in cases when I just want to display some part of the image, but it works well in cases when I need to serialize widget state and restore it later. Will that version work for you? |
Is there a function to set the x and y position of the image on load. Basically we have an app that submits info to server, it regenerates the view but we want user to have image in same position as it was before refresh
set_zoom works great for setting the old zoom level, but is there an abilitity to set x and y?
The text was updated successfully, but these errors were encountered: