Hi Harbs please take a look when you have time. I didn't find any other way to deal with this issue. For now, if not doing that, you can layout right when using % measures. Maybe I'm missing something there If you get a better way, that will be a great improvement so far, since I think Royale has still things to solve regarding layouts easeness for user consume. For now, just let you know I just check for width/height, and if not get sizing just call requestAnimationFrame until the check is right.
thanks El jue., 4 jun. 2020 a las 17:10, Harbs (<harbs.li...@gmail.com>) escribió: > I wonder how this effects performance. > > I’d need to look at exactly the flow (which I don’t have time for now), > but one thing to keep in mind is that if reads and writes are not carefully > plan, it could cause forced layouts which is a performance killer. > > Not sure if this effects what you did or not, but definitely something to > keep in mind. > > HTH, > Harbs > > > On Jun 4, 2020, at 5:49 PM, Carlos Rovira <carlosrov...@apache.org> > wrote: > > > > Hi, > > > > as part of the Jewel Tile Layout improvement, I want to let you know > about > > an important addition. > > > > until now I had very hard time dealing with width/height of a component > in > > layout classes when the width or height are a percentage > > or not set. > > > > Since that depends on other containers, I found while working on Jewel > > DataGrid that I need to make "requestAnimationFrame" calls > > until I get the proper measurements. > > > > So I set up a "waitForSize" public property that is available in all > Jewel > > layouts, since all comes from StyledLayoutBase. > > This is false by default, so you need to put to true to use this > feature. I > > didn't other way to get this measures, I think maybe this could have > > some performance hit, for that reason, I let users choose. If you know > > something better, let me know :) > > > > If you check that code you'll find that performanceLayout is now using > > "checkHostSize()" (if waitForSize is true).The code is this: > > > > /** > > * We call requestAnimationFrame until we get width and height > > */ > > COMPILE::JS > > protected function checkHostSize():void { > > if(sizeInitialized) return; > > if((host.width == 0 && !isNaN(host.percentWidth)) || > > (host.height == 0 && !isNaN(host.percentHeight))) > > { > > requestAnimationFrame(checkHostSize); > > } else > > { > > sizeInitialized = true; > > executeLayout(); > > } > > } > > > > when we get the size, we continue as usual. > > As I said before if you left "waitForSize" to false (default), it will > work > > as always. > > > > For example, new tile horizontal layout is using it in TDJ: > > > > <j:Group className="wrapper" width="100%"> > > <j:beads> > > <j:TileHorizontalLayout localId="tl" waitForSize="true"/> > > </j:beads> > > > > Any comment are welcome > > > > Thanks > > > > -- > > Carlos Rovira > > http://about.me/carlosrovira > > -- Carlos Rovira http://about.me/carlosrovira