Isn't this what localToGlobal etc.. did for Flex? Personally I would like testButton.x to return 0 in all instances. Unless I want it's actual screen position where I use the helper functions like localToGlobal etc..
On Tue, Feb 28, 2017 at 8:50 PM, Peter Ent <p...@adobe.com> wrote: > Hi, > > 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:Container> > <js:style> > <js:SimpleCSSStyles padding="10" /> > </js:style> > <js:TextButton id="testButton" x="0" y="0" /> > </js:Container> > > When you ask for testButton's x or y values it would return 10 due to the > padding on its Container parent. > > 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 > > Regards, > Peter Ent > Adobe Systems/Apache Flex Project >