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

Brian Milby brian at milby7.com
Fri Jan 19 10:53:39 EST 2018


The calculations that you are making are sound, but as Ralph said, after
repeated changes it may end up "off".

The type of positioning that you are doing is one of the things that the
current Geometry Manager (GM) Property Inspector (PI) will not allow (when
you resize a control, the left/top can only be fixed to the card edge and
not proportional).  But, the method that the GM uses is helpful to know.

The GM avoids the cumulative error problem by storing positioning as fixed
numbers in the GM custom properties.  It will either store absolute pixel
positions or relative % of card dimension positions.  Positions are based
on either a card edge or another control edge.  So for your situation, you
would want to calculate the offset % for each side and then just use the
new card dimensions to calculate the new control rect.



More information about the use-livecode mailing list