royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Piotr Zarzycki <piotrzarzyck...@gmail.com>
Subject Re: UIBase.width problems with layouts
Date Thu, 12 Dec 2019 05:25:47 GMT
Hi Carlos,

I just wanted to add that even if component is being added to the parent in
HTML doesn't mean that you will have on it their real sizes immediately.
Good example is TabBar where I would like to add navigation buttons. [1] In
theory it's simple in order to determine whether we don't have enough space
and have to show navigation buttons we need to use couple of properties
scrollLeft, scrollWidth, offsetWidth. However even after "initComplete" -
those properties are indicating 0px and until you change just a bit size of
the window they will stay like that - even if you do something on the UI
(random clicking etc).

I was able to successfully resolve that, but I did hack, so I decided to do
not commit that View to Royale - it stays in our application code. I do
simple thing - when component is created I'm setting up for
parent.element.style.visibility = "hidden". - When I get "initComplete" or
whatever event indicating that everything has been added to parent - I'm
doing  parent.element.style.visibility = "visible" and do check of
scrollLeft, scrollWidth, offsetWidth
after requestAnimationFrame(refreshNavigationButtonVisibility).

In the other words you may end up with something similar Carlos, which I'm
not sure is the code which we would like to have in Royale.

[1] https://ibb.co/HhjHPJ6

Thanks,
Piotr


śr., 11 gru 2019 o 23:09 Alex Harui <aharui@adobe.com.invalid> napisał(a):

> Like Flex, parents size their children.
>
> Unlike Flex, because some changes to HTMLElements and CSS are "immediate"
> and not "deferred to a rendering phase", there is no central pump like the
> Flex LayoutManager that lays everything out.
>
> Depending on the component set, the components "should" determine if they
> need sizing from their parent or are sizedToContent or are explicitly sized
> and don't have to wait for a parent.
>
> If a component needs sizing from its parent (percent sizing,
> left/right/top/bottom, a more complex layout algorithm, etc), the component
> can't possibly know its size until parented.
>
> The lifecycle in Royale "should be":
> -construction
> -set properties which might bring in beads
> -user defined beads
> -add to parent (and bring in default beads)
>
> Many components dispatch an "initComplete" which means that it has been
> added to a parent and has its initial set of properties and beads.  In
> Basic components, the container layouts may run the first time on
> initComplete, although any size changes by parents or properties also
> currently trigger layout as does adding children to containers.
>
> Hopefully, the answer to your question is somewhere in all of that.
>
> HTH,
> -Alex
>
>
> On 12/11/19, 12:48 PM, "Carlos Rovira" <carlosrovira@apache.org> wrote:
>
>     Hi,
>
>     I'm having a hard time with sizes of components.
>     When I create a component in the "strand" setter the width of that
>     component reports 0 when debug.
>     So doing a layout it does with width = 0.
>     Then component has width = 100% via CSS what means that in real time
> has
>     400px
>
>     So my question is... Where is the first time when I get the width =
> 400px
>
>     I need that 400px instead of the initial 0 (that is not real) in order
> to
>     perform calculations.
>
>     Thanks
>
>     --
>     Carlos Rovira
>
> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&amp;data=02%7C01%7Caharui%40adobe.com%7Cc45149962f7b4ebf6a6808d77e7b7bd0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637116941135308667&amp;sdata=Owogr%2BIIFa5B41rs%2BSwTAMIhx82bAZfaYq90Y6y%2BJiU%3D&amp;reserved=0
>
>
>

-- 

Piotr Zarzycki

Patreon: *https://www.patreon.com/piotrzarzycki
<https://www.patreon.com/piotrzarzycki>*

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