royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Piotr Zarzycki <piotrzarzyck...@gmail.com>
Subject Re: [royale-asjs] branch develop updated: Fixes #258. But is that a proper fix?
Date Fri, 08 Jun 2018 12:18:49 GMT
I love solution with Bead!

On Fri, Jun 8, 2018, 2:17 PM Harbs <harbs.lists@gmail.com> wrote:

> I just added an implementation of this. I added a
> “DefaultRelativePosition” bead to the “simplify-position” feature branch.
> The bead sets the default positioning using a global selector. The bead is
> extremely light-weight. I think it’s a good solution.
>
> Below is an app which has the default set globally to relative and behaves
> as you’d expect in Flex. Both the logical and visible position of child is
> 30,30, and the left and top values retain a value of 20 instead of 30. It
> might make sense to make the defaults in Express and Emulation to use this
> bead.
>
> FWIW, The size of parent is the size of the child plus the padding and not
> the size of the child including the top and left values. (i.e. it’s
> 55.55x38 instead of 75.55x58) This is due to how relative works in HTML
> where the drawn object is “ghosted” out of the natural position. I’m pretty
> sure that the size was different in Flex.
>
> <?xml version="1.0" encoding="utf-8"?>
> <js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>                 xmlns:js="library://ns.apache.org/royale/basic"
> xmlns:ns1="*" applicationComplete="onComplete()" >
>     <fx:Script>
>         <![CDATA[
>             import org.apache.royale.utils.PointUtils;
>             import org.apache.royale.geom.Point;
>             private function onComplete():void{
>                 var point:Point = PointUtils.localToGlobal(new
> Point(0,0),child);
>                 trace(point);
>             }
>         ]]>
>     </fx:Script>
>     <js:valuesImpl>
>         <js:SimpleCSSValuesImpl />
>     </js:valuesImpl>
>     <js:beads>
>         <js:DefaultRelativePosition/>
>     </js:beads>
>     <js:initialView>
>         <js:View>
>             <js:Group id="theparent" style="padding:10px" >
>                 <js:Group id="child" x="20" y="20" >
>                     <js:Label text="Hello"/>
>                 </js:Group>
>             </js:Group>
>         </js:View>
>     </js:initialView>
> </js:Application>
>
> (Traces org.apache.royale.geom.Point {x: 30, y: 30})
>
> Harbs
>
> > On Jun 8, 2018, at 10:40 AM, Harbs <harbs.lists@gmail.com> wrote:
> >
> >>
> >> I'm still wondering if BasicLayout and/or the x,y setters should set
> parentNode.style.positon!=static.  Then I think we could drop the
> offsetParent check.
> >
> > We can drop the offsetParent check either way, but maybe non-static
> should be set. I really would not want that code to be in the x and y
> setters though unless it could be made *really* cheap. I suppose we could
> have a “position” property on UIBase which could be used to determine
> whether non-static needs to be set. The position setter could be overridden
> in component sets to allow for inline styles vs css selectors.
> >
> > The most PAYG way to handle this is probably with a bead which adds the
> global position: relative selector. That approach should work fine as long
> as the app is the body. If we ever add support to inserting a Royale app
> into a div on a page, the global selector might cause unexpected effects on
> the rest of the page which might rely on the default position: static
> setting.
>
>

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