Constraining window dimensions proportionally while resizing

BNig bernd.niggemann at uni-wh.de
Tue Sep 23 12:50:38 EDT 2014


Hi Devin,

I am with Roger on this.

here is a little code snippet that does constrain the aspect after resizing

-----------------------------------------------------------
on resizeStack pNewWidth, pNewHeight, pOldWidth, pOldHeight
   
   -- block repeat loop if you want to have all the changes occur after last
resize, kind of animation
   repeat for each line aMessage in the pendingMessages
      if aMessage contains "adjustRatio" then cancel item 1 of aMessage
   end repeat
   
   send "adJustRatio pNewWidth, pNewHeight, pOldWidth, pOldHeight" to me in
0 milliseconds
end resizeStack

on adJustRatio pNewWidth, pNewHeight, pOldWidth, pOldHeight
   put round (pNewWidth / 2) into tNewHeight
   put the rect of me into tRect
   put item 2 of tRect + tNewHeight into item 4 of tRect
   set the rect of me to tRect
end adJustRatio
-----------------------------------------------------------


Devin Asay wrote
> In a LiveCode project I want the end user to be able to resize a window,
> but I want the window proportions -- the ratio of the width to the height
> -- to remain the same during the resize operation. I have tried various
> approaches, but none was satisfactory, often giving erratic performance.
> What is the best way to resize a stack window and constrain it
> proportionally?
> 
> Devin





--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Constraining-window-dimensions-proportionally-while-resizing-tp4683639p4683642.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list