Proportional scaling
Simon Lord
slord at marelina.com
Tue Sep 21 15:12:16 EDT 2004
Uber Danka. :)
On Sep 21, 2004, at 1:52 PM, Wilhelm Sanke wrote:
> On Mon, 20 Sep 2004, Simon Lord wrote:
>
>> I have an object on my card which can be scaled at runtime, the next
>> step is to get this object to scale proportionally using it's current
>> H x W as the aspect ratio when the shiftKey is down.
>>
>> So if the object is currently shaped like a rectangle, when I hold
>> the shiftKey down and continue dragging the object will maintain the
>> same aspect ratio at the time I held the shiftKey down.
>>
>> Unfortunately I'm at a lose at to where to even start the math on
>> this.
>>
>>
>> Sincerely,
>> Simon
>
>
>
> Hello Simon,
>
> The following may not match exactly your expectations, but is maybe a
> starting point.
>
> I have a "zoom" script on card "slideshow" of my stack "Slideshow
> Light", 82 KB (formerly to be found in Rev's User Contributions, now
> on my website <http://www.sanke.org>, English version, page "Sample
> Stacks").
>
> From the short description:
> "Slideshow allowing JPG-, GIF-, PNG- and BMP-images. Preview and
> re-ordering possible. Different display sizes can be set. Zoom
> function; adjusting of display duration during show."
>
> This zoom function does not change the images continuously, but sets
> the new size - with the correct aspect ratio - after the dragging of
> the scrollbar thumb has finished. I also had a continuously changing
> version of such a zoom, but for some reason did not implement it in
> this slideshow stack.
>
> Examples from the scripts
>
> to put the aspect ratio into Var "Proportion":
>
> "set the numberformat to 0.00
> put the formattedheight of image 1 into FHoehe
> put the formattedwidth of image 1 into FBreite
> put FBreite / FHoehe into Proportion"
>
> script of the zoom scrollbar (assumes there are two extra scrollbars -
> that become visible when needed - to navigate inside the enlarged
> image):
>
> "global Proportion, Stelle
> local Neuhoehe, Neubreite
> on scrollbardrag x
> put x into Neuhoehe
> put Neuhoehe * Proportion into NeuBreite
> put trunc(Neubreite) into Neubreite
> put NeuBreite&&"X"&&Neuhoehe into fld "Rechteck"
> end scrollbardrag
>
> on mouseup
> set the cursor to watch
> lock screen
> set the height of image 1 to Neuhoehe
> set the width of image 1 to NeuBreite
> set the loc of image 1 to 512,384
> if NeuBreite > 1024 then
> put (Neubreite - 1024) div 2 into BreitDiff
> set the Startvalue of scrollbar "horizontal" to -Breitdiff
> set the Endvalue of scrollbar "horizontal" to Breitdiff
> show scrollbar "Horizontal"
> else
> hide scrollbar "horizontal"
> end if
> if Neuhoehe > 768 then
> put (Neuhoehe - 768) div 2 into HoehDiff
> set the Startvalue of scrollbar "vertical" to -Hoehdiff
> set the Endvalue of scrollbar "vertical" to Hoehdiff
> show scrollbar "vertical"
> else
> hide scrollbar "vertical"
> end if
> set the thumbpos of scrollbar "vertical" to 0
> set the thumbpos of scrollbar "horizontal" to 0
> put the 512,384 into Stelle
> set the cursor to hand
> end mouseup"
>
> Maybe this helps, if not - discard it.
>
> Regards,
>
> Wilhelm Sanke
> http://www.sanke.org
>
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
>
>
Sincerely,
Simon
More information about the metacard
mailing list