[TIDBIT] A resizeStack button [2]
FlexibleLearning at aol.com
FlexibleLearning at aol.com
Sat Jul 23 06:54:15 EDT 2005
This improves stack resizing by accommodating both the minWidth and maxWidth
properties of the stack. I have yet to figure out how to handle the initial
'judder' by incorporating the initial mouseLoc xOffset and yOffset within the
button... Offers?
Put this in your stack script...
on resizeStack
set the bottomRight of btn "resizeMe" to the bottomRight of this card
end resizeStack
Put this in the script of a button called "resizeMe", placed at the
bottomRight of your stack...
on mouseMove
# Constraining algorithm: max (lowerLimit, min(upperLimit, var))
if the mouse is up then pass mouseMove
put the topLeft of this stack into tTL
put globalLoc(the mouseLoc) into tML
put the minWidth of this stack + item 1 of tTL into lowerLimit
put the maxWidth of this stack + item 1 of tTL into upperLimit
put max(lowerLimit,min(upperLimit, item 1 of tML)) \
into item 1 of tML
put the minHeight of this stack + item 2 of tTL into lowerLimit
put the maxHeight of this stack + item 2 of tTL into upperLimit
put max(lowerLimit,min(upperLimit, item 2 of tML)) \
into item 2 of tML
set the rect of this stack to tTL,tML
end mouseMove
# CONDENSED VERSION
# on mouseMove
if the mouse is up then pass mouseMove
put the topLeft of this stack into tTL
put globalLoc(the mouseLoc) into tML
set the rect of this stack to tTL,max(the minWidth of this stack + item 1 of
tTL,min(the maxWidth of this stack + item 1 of tTL, item 1 of tML)), max(the
minHeight of this stack + item 2 of tTL,min(the maxHeight of this stack +
item 2 of tTL, item 2 of tML))
end mouseMove
/H
The Scripter's Scrapbook
www.FlexibleLearning.com/ssbk.htm
More information about the use-livecode
mailing list