Mark Waddingham wrote:
On 2015-10-14 00:38, Richard Gaskin wrote:
Can we have the scalingFactor available for the contents of groups?
<http://quality.runrev.com/show_bug.cgi?id=11842>

This would indeed be nice (and, indeed, it has come up many times
before) - however there are two problems.

The first is that all co-ordinates from a script point of view in the
engine are integers, rather than floating point. This becomes important
when you are starting to talk about transformations - for example
scaling down an object of width 9 by a factor of 2 means the object's
width is 4.5. So in this scenario the rect of an object within a scaled
group would be inaccurate with how things are currently.

The second is that the current script's co-ordinate model is such that
all co-ordinates are relative to the top-left of the current card rather
than the owning group.

Now, the first can probably be ignored if the second is solved and
co-ordinates are always expressed relative to the containing groups
co-ordinate system (i.e. if you put a 10x10 button at 10,10 inside a
group which scales things down by half, then the buttons rect would be
10,10,20,20 but it would appear at 5,5,10,10 on the card). However, I'm
not sure how that squares up with script's idea of what co-ordinates
should be relative to from a script point of view - we've all got very
used to a single flat co-ordinate system which means there's no need for
transforming between 'co-ordinates relative to one object' to
'co-ordinates relative to another object'.

Maybe those could be handled as the HTML Canvas does, in which the coordinates you use remain the same and the scale factor takes case of the translation for us when rendering.

<http://www.w3schools.com/tags/canvas_scale.asp>
<http://www.w3schools.com/tags/canvas_translate.asp>

Isn't that how Skia's canvas works also?

Workable for LC?

If we need to know the on-screen physical rect of a control (as distinct from its logical scaled rect) perhaps "the effective rect"?

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 ____________________________________________________________________
 [email protected]                http://www.FourthWorld.com

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

Reply via email to