flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Ent <p...@adobe.com>
Subject [FlexJS] Coordinate Space
Date Tue, 28 Feb 2017 19:50:51 GMT

In an effort to clean up Container and layouts, we need to look at the coordinate system of
FlexJS. Since the goal is to have the SWF side mimic the JS side, perhaps we should visit
the "coordinate system" of HTML. You'll find an Apache Paste at [1] below. If you could run
that and make any changes you'd like and see what you think.

Basically: in Flex 4 and Flash, when you position something at (0,0) and you read its x coordinates
back, it is at (0,0). In HTML land, that isn't exactly how it works. There are several things
that influence the position of an element: the position style of its parent, the padding of
its parent, the margin style of the element and the position style of the element.

If you set a div to have a padding of 10 and an element to have position:relative with left:0
it will appear 10 pixels from the left edge of the div. That's what would expect. However,
if you try to read that element's position, you need to use its read-only property, offsetLeft.
That value will be 10, not 0.

How would you feel if FlexJS worked the same way?

        <js:SimpleCSSStyles padding="10" />
    <js:TextButton id="testButton" x="0" y="0" />

When you ask for testButton's x or y values it would return 10 due to the padding on its Container

Right now Container has this inner contentArea that tries to make sure testButton is (0,0)
but it is a headache to maintain, I think.

[1] https://paste.apache.org/IM1W

Peter Ent
Adobe Systems/Apache Flex Project

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message