royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yishay Weiss <yishayj...@hotmail.com>
Subject RE: [royale-asjs] branch develop updated: Fixes #258. But is that a proper fix?
Date Thu, 07 Jun 2018 09:07:03 GMT
For what it’s worth, I removed x="{filterGrip.width}" and it  works the same. So it’s probably
just legacy code.
From: Harbs<mailto:harbs.lists@gmail.com>
Sent: Wednesday, June 6, 2018 9:25 PM
To: dev@royale.apache.org<mailto:dev@royale.apache.org>
Subject: Re: [royale-asjs] branch develop updated: Fixes #258. But is that a proper fix?

I don’t think you realize the full extent of the effect. It’s not just “in case” someone
wants x and y values. It’s also to *prevent the need* to specify x and y values which shouldn’t
need to be specified.

Let’s take a piece of ProductsView in RoyaleStore:

    <js:Container
        className="colorPanel"
        height="100%" width="100%"
        >
        <js:beads>
            <js:OneFlexibleChildHorizontalLayout flexibleChild="spacer" />
        </js:beads>
        <productsView:Grip id="filterGrip" gripIcon="assets/icon_magnifier.png"
            gripTip="Show filter panel" click="currentState = 'showFilter'"/>

        <productsView:ProductFilterPanel x="{filterGrip.width}" y="0" id="filterPanel"
width="265" height="100%"
            filter="catalogPanel.filter(event.filter, event.live)"
            compare="catalogPanel.compare(filterPanel.productList.getProducts())"
            initComplete="if (catalog) filterPanel.filter.count = catalog.length"/>

        <js:Spacer id="spacer" />

        <productsView:ProductCart id="cartPanel" width="265" height="100%" />

        <productsView:Grip id="cartGrip" gripIcon="assets/icon_cart_empty.png"
            gripTip="Show cart" click="currentState = 'showCart'" />

    </js:Container>

It’s using a flex layout. The flex layout should position the child elements. Unfortunately
it doesn’t which is why we have the following code there:

 x="{filterGrip.width}”

Without that, the filterGrip space is not accounted for. This is because the default is static
rather than relative. Changing the default to relative removes the necessity to specify an
x position dependent on the sibling size.

I was forced to add similar code in my app.

We are also forced to add code to calculate offsetParent which is not PAYG both in terms of
code and performance.

Simply put: static is a bad default. Default relative positioning gives more expected results
in 99% of use cases and usually results in *less* code.

My $0.02,
Harbs

> On Jun 6, 2018, at 7:37 PM, Alex Harui <aharui@adobe.com.INVALID> wrote:
>
> Setting position:relative "just-in-case" someone needs to use x,y is not PAYG, IMO.


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