Proportional resizing of stack
Scott Rossi
scott at tactilemedia.com
Tue Apr 4 12:00:25 EDT 2006
Recently, Devin Asay wrote:
> I have a stack that I want to constrain to a 4:3 ratio when resizing,
> with a minimum stack size of 800 X 600. A search of the archives
> didn't yield any relevant results.
> ...
> Any suggestions for my humanities-addled, math-challenged brain?
One way is to set the rect of the stack, instead of a point combination.
This will keep the relative location and dimensions intact. The following
seems to work here (in a resize widget positioned at the bottomright of the
stack:
on mouseDown
set the uAllowResize of me to mouseH() - left of me,mouseV() - top of me
end mouseDown
on mouseMove X,Y
if the uAllowResize of me is false then exit mouseMove
put (X - item 1 of the uAllowResize of me) into V
set topLeft of me to V,(3*V) div 4
put rect of this stack into tRect
put globalLoc(bottomRight of me) into BR
put item 1 BR into item 3 of tRect
put item 2 of BR into item 4 of tRect
set rect of this stack to tRect
end mouseMove
on mouseUp
set the uAllowResize of me to false
end mouseUp
on mouseRelease
mouseUp
end mouseRelease
Regards,
Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com
More information about the use-livecode
mailing list