Rotate Image

Hey guys, I have an issue that I know can’t be as difficult as I am making it. Any feedback of help would be much appreciated!

Scenario:
I have an image displayed in an ImageWell that has the dimensions of 1011x758. I want to allow users to rotate the image 90 degrees, but when I use the WebAnimator.RotateZ to do so it creates a gap on the left and it goes off screen on the top.

So in a nutshell is there a way to rotate the image, and then have the image return to a set left and top position(0,0) so that the left edge and top edge lineup with the edge of the browser window accordingly. Doing Animator.Move(imgView, 0, 0, 0.5) does not produce those results. I assume that is because the anchor point of the image is not the top,left corner of the newly rotated image.

Thanks in advance!

Well…I guess writing this post helped me to figure out the solution. I did in fact need to think about the positioning based on the new anchor point of the image. Instead of expecting it to be the top, left of the newly rotated image, I needed to set the left and top based on the new anchor point of top,right.

This seemed to work:
Dim lftPos As Integer = (imgPhotoView.Height - imgPhotoView.Width) / 2
Dim topPos As Integer = (imgPhotoView.Width - imgPhotoView.Height) / 2

Anyhow, it seems to be working as intended.

[quote=127006:@Michael Wakeland]Well…I guess writing this post helped me to figure out the solution. I did in fact need to think about the positioning based on the new anchor point of the image. Instead of expecting it to be the top, left of the newly rotated image, I needed to set the left and top based on the new anchor point of top,right.

This seemed to work:
Dim lftPos As Integer = (imgPhotoView.Height - imgPhotoView.Width) / 2
Dim topPos As Integer = (imgPhotoView.Width - imgPhotoView.Height) / 2

Anyhow, it seems to be working as intended.[/quote]

My math teacher a long time ago used to say that laying out the problem was half part of the solution :wink: