resizing and rescaling an object: Is this math/logic ok?
bobsneidar at iotecdigital.com
Fri Jan 19 11:26:15 EST 2018
To demonstrate, the following formula:
5 * 3 * .5 * .66 = 4.95 (not 5)
hence the need to store a base size and always work your math from that.
> On Jan 19, 2018, at 07:53 , Brian Milby via use-livecode <use-livecode at lists.runrev.com> wrote:
> 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