Zooming to Center
Mark Swindell
mdswindell at cruzio.com
Sun May 18 00:00:56 EDT 2008
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
More information about the use-livecode
mailing list