Page 1 of 1

rotating an image at the center point of the stack

Posted: Wed Mar 11, 2015 2:09 pm
by magice
Apparently my brain is to twisted by this problem to create a mathematical solution as I have now spent close to 4 hours coding and recoding. I have a referenced image in a stack that is larger than the stack. It can be dragged around as needed to view any part of the image. I want to rotate the image with the portion of the image at stack center staying at stack center. The following code seems like it should work but it doesn't

Code: Select all

on mouseUp
   put (the width of this stack/2) into tHCen
   put (the height of this stack/2) into tVCen
   
   put (the bottom of img "image"- tVCen) into tVOff
   put (the right of img "Image" - tHCen) into tHOff
   
   set the angle of img "image" to (the angle of img "image"+90)
   
   set the top of img "image" to tVCen - tHOff
   set the right of img "image" to tHCen + tVOff
end mouseUp
What am I missing?

Re: rotating an image at the center point of the stack

Posted: Wed Mar 11, 2015 3:37 pm
by Agnar Tonheim
look at screenLoc ...

Re: rotating an image at the center point of the stack

Posted: Wed Mar 11, 2015 3:45 pm
by magice
Agnar Tonheim wrote:look at screenLoc ...
screenLoc does not seem to work well when using a dual monitor setup. This app requires two monitors with a control stack on the main screen and a display stack on a remote screen in full screen mode. That is why I used ..

Code: Select all

 put (the width of this stack/2) into tHCen
   put (the height of this stack/2) into tVCen
to find the center. That is not the problem. The problem seems to be with the positioning of the stack after it is rotated so that that same point of the image is still at stack center.

Re: rotating an image at the center point of the stack

Posted: Wed Mar 11, 2015 6:07 pm
by MaxV
Probably you need to read this post: http://livecodeitalia.blogspot.it/2015/ ... -allo.html
There is the google translate button in the top right angle of the post page.

Re: rotating an image at the center point of the stack

Posted: Wed Mar 11, 2015 7:12 pm
by magice
Problem solved. It turns out that my script does work the way I expected. The problem comes in from starting with a zoomed in image. Since images with an angle of other than 0 can't change dimensions it was resizing to it's original state and so the offset numbers no longer matched