resizing and rescaling an object: Is this math/logic ok?

Ralph DiMola rdimola at evergreeninfo.net
Fri Jan 19 09:50:32 EST 2018


This was my first attempt also. I found that precision errors crept in. The
first resize on the mobile device worked OK but change from portrait to
landscape a few times and the precision errors become very apparent. I
rolled my own my LC resize handler that positions controls based on the
current screen rect and their relationship to other controls. LC now offers
solutions that I have not used that others have had good success with.

Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net

-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf
Of Nicolas Cueto via use-livecode
Sent: Friday, January 19, 2018 1:34 AM
To: How to use LiveCode
Cc: Nicolas Cueto
Subject: resizing and rescaling an object: Is this math/logic ok?

Given these values...

original STACK-width is tOSW
original stack-height is tOSH

resized stack-width is tRSW
resized stack-height of stack is tRSH

original  OBJECT rect is tOOR  (i.e., left,top,right,bottom)

... and assuming I'm right that ...

ratio of stack's width change is tRSWC and equals round(tRSW / tOSW,2)

ratio of stack's height change is tRSHC and equals round(tRSH / tOSH,2)




... then how (further?) wrong am I in assuming that, if I want the original
object resized and repositioned to scale on the new stack size, the NEW RECT
of that object therefore equals ...

round(item 1 of tOOR * tRSWC,0) , round(item 2 of tOOR * tRSHC,0) ,
round(item 3 of tOOR * tRSWC,0), round(item 4 of tOOR * tRSHC,0)


Sorry if that was painful. For what it's worth, I'm embarassed posting it,
but...

--
Nicolas Cueto
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list