Re: Zooming to Center
> I have an image that is much larger than the stack. I have two > buttons, ZoomIn and ZoomOut. They do their jobs as far as zooming in > and out by resizing the image, but I would like the part of the image > that is in the center of the screen to stay there during the zoom > (when possible). Right now it moves around and I can't figure out > the math to make it seem to zoom to (or from) the part of the picture > that is in the center of the card. Here's what I did - measure the distance from the clickH to the left of the object, divide by the current zoom factor, then multiply by the new zoom factor. Then after scaling the image, set the left of the image to the center of the card, minus the new distance. Do the same for the top. Something like this: -- First, note the click location relative to the image put pClickH - (the left of pImgObj) into tDistFromLeft put pClickV - (the top of pImgObj) into tDistFromTop put the uScale of pImgObj into tCurrZoom put round((tDistFromLeft / tCurrZoom) * pNewZoom) into tNewDistFromLeft put round((tDistFromTop / tCurrZoom) * pNewZoom) into tNewDistFromTop where "pImgObj" is the image being scaled, "the uScale" is the custom property scoring the current scale factor before zooming, and "pNewZoom" is the new scale factor. Then apply it like this: put the loc of this card into tCardLoc if pNewZoom <> 1 then set the left of pImgObj to ((item 1 of tCardLoc) - tNewDistFromLeft) set the top of pImgObj to ((item 2 of tCardLoc) - tNewDistFromTop) else set the loc of pImgObj to tCardLoc end if If you want the whole script that handles everything (I had to do this to figure out what worked), let me know and I'll post it. Ken Ray Sons of Thunder Software, Inc. Email: [EMAIL PROTECTED] Web Site: http://www.sonsothunder.com/ ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Zooming to Center
Hi Mark: I should have written instead: 1. Place the original loc of the image into a local variable called OriginalLoc. 2. Then include "set the loc of image "The Image" to OriginalLoc" inside every iteration of the loop that is zooming your image. I'm assuming that you were having no trouble with the zooming repeat loop. Paul Gabel - Just include "set the loc of image "The Image" to the screenLoc" inside every iteration of the loop that is zooming your image. On May 17, 2008, at 7:30 PM, Mark Greenberg wrote: I have an image that is much larger than the stack. I have two buttons, ZoomIn and ZoomOut. They do their jobs as far as zooming in and out by resizing the image, but I would like the part of the image that is in the center of the screen to stay there during the zoom (when possible). Right now it moves around and I can't figure out the math to make it seem to zoom to (or from) the part of the picture that is in the center of the card. Thanks in Advance, Mark Greenberg ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Zooming to Center
I can't say whether this is a particularly elegant solution, but this works in a scrollbar for my application. on scrollbardrag newPosition put the loc of image "Artwork" into vArtLoc set the numberformat to "00.00" put (newposition) into vHowBig if vHowBig < 10 then put "0" before vHowBig put "."before char -2 of vHowBig put trunc(vHowBig * (the formattedheight of image "artwork")) into vNewHeight put trunc(vHowBig * (the formattedwidth of image "artwork")) into vNewWidth set the height of image "artWork" to vNewHeight set the width of image "artWork" to vNewWidth set the loc of image "ArtWork" to vArtLoc set the cSizeThumbPos of this cd to newPosition -- cSizeThumbPos is a custom property so on reopening card the previous size is maintained end scrollbardrag Mark On May 17, 2008, at 7:30 PM, Mark Greenberg wrote: I have an image that is much larger than the stack. I have two buttons, ZoomIn and ZoomOut. They do their jobs as far as zooming in and out by resizing the image, but I would like the part of the image that is in the center of the screen to stay there during the zoom (when possible). Right now it moves around and I can't figure out the math to make it seem to zoom to (or from) the part of the picture that is in the center of the card. Thanks in Advance, Mark Greenberg ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Zooming to Center
Hi Mark: Just include "set the loc of image "The Image" to the screenLoc" inside every iteration of the loop that is zooming your image. Paul Gabel --- On May 17, 2008, at 7:30 PM, Mark Greenberg wrote: I have an image that is much larger than the stack. I have two buttons, ZoomIn and ZoomOut. They do their jobs as far as zooming in and out by resizing the image, but I would like the part of the image that is in the center of the screen to stay there during the zoom (when possible). Right now it moves around and I can't figure out the math to make it seem to zoom to (or from) the part of the picture that is in the center of the card. Thanks in Advance, Mark Greenberg ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Zooming to Center
I have an image that is much larger than the stack. I have two buttons, ZoomIn and ZoomOut. They do their jobs as far as zooming in and out by resizing the image, but I would like the part of the image that is in the center of the screen to stay there during the zoom (when possible). Right now it moves around and I can't figure out the math to make it seem to zoom to (or from) the part of the picture that is in the center of the card. Thanks in Advance, Mark Greenberg ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution