Page 1 of 1

scaleFactor < 1 and handling minWidth and similar properties

Posted: Sun Apr 12, 2015 1:17 am
by Patrick Wilson
There seems to be a bug related to the scaleFactor set below 1 and handling the minWidth, maxWidth, and similar properties.

For example, if the scaleFactor is 1 or greater, the handler can set the width of the stack between minWidth and maxWidth. If the scaleFactor is less than 1, the handler can only incorrectly set the width of stack to between minWidth and maxWidth multiplied by the scaleFactor. The user can change the width of the stack between minWidth and maxWidth, regardless of the scale factor.

To reproduce, place the code in the stack script, click on the stack to change the scaleFactor below 1, and you will see the window aspect ratio set to a non square rectangle with the incorrect width. If the user attempts to change the width of the stack, the stack will change to a square with correct width. Click the stack again to change the scale factor above 1, and you will see the aspect rato set to a square with correct width. The following code was tested in LiveCode Community 6.7.4.

Code: Select all

on mouseUp
   if the scaleFactor of this stack = 0.5 then set the scaleFactor of this stack to 1.5
   else set the scaleFactor of this stack to 0.5  -- casues problem handling the minWidth and maxWidth of this stack

   set the minWidth of this stack to 400 * the scaleFactor of this stack 
   set the maxWidth of this stack to 400 * the scaleFactor of this stack 
   
   --   If scaleFactor is less than 1, the width will be incorrectly set to 400 * scaleFactor (or 100 effective screen pixels.)
   --   The user can then still change the width to 400 (or 200 effective screenpixels.)
   set the width of this stack to 400
   
   set the left of this stack to 50 / the scaleFactor of this stack 
   set the top of this stack to 50 / the scaleFactor of this stack 
end mouseUp