GUI Editor Bug :: Cannot Enter Percentage Value with Toolbox button

Dears,

I believe that by now after about over 60 hours of use of the Editor, I must be entitled to make this comment:

I mentionned before that I was having an issue with this restriction of using percentage mode where it would simply generate a warning when done with code. I mentionned before that this restriction was also working eratically. I can now confirm that not only does it work eratically but it also lets you enter and accounts the value and mode when typed, yet not if you click on the pixel/percentage button.

I would like to urge you again to consider removing this restriction to simplify and also reflect what can be achieved through code.
Thanks for considering the above and have a great day :sunglasses:

cc @carolhmj

Hey there! Just to refresh my memory, is this the restriction when using a StackPanel? Or something else?

Thanks for your reply and constant monitoring. Much appreciated :smiling_face_with_three_hearts:
It actually applies to all elements (containers and controls) when inside a parent of I believe stackpanel.
Not sure if other containers also have this restriction. If I find out Iā€™ll let you know. I didnā€™t create a use case for this. Iā€™m delivering on the fly while working on the project.
Iā€™d say for now, letā€™s just focus on the stackpanel and all its children.

As Iā€™m continuing my journey with the editor, I found more reasons to may be remove this restriction/resolve. Let me share about my findings:

  1. It appeared to me that when entering in numbers (== overiding) a value in percentage (i.e. for a textBlock inside a grid container), the save from the Editor takes a lot more time and loading the GUI in the PG/scene also takes a lot more time. Is it so that there would be some sort of resolve going on in the background?

  2. Another reason why this thing is may be not the best in terms of UX is that you cannot always instantly understand why a value could eventually not be entered as percentage. Although knowing the code and components, it took me a while to understand why two textBlocks that looked the same would let me have one enter the value in percentage and the other notā€¦ until I realized one of my copied textBlock had a ā€˜resizeToFitā€™ set to true. So, between the restrictions we either know or donā€™t know about for a single component, adding on top this resolve for what should be a simple warning, again I believe, does not help.

Thanks again for considering and have a great day :smiley:

Hey there! I had some time to think about this, and I think thereā€™s an extra additional improvement that can be done along with removing the restriction on the Editor.

The reason for the code warning/editor restriction on the StackPanel children units is because the StackPanelā€™s height can be adapted to be just the childrenā€™s total height. So the StackPanel needs its children to determine its height, but a child with percentage units needs its parent to determine its own heightā€¦ which creates a circular dependency. But if adaptHeightToChildren is not true, and we set a height for the StackPanel (like 100px or even 70%), we donā€™t need to try to determine this height, it was already given to us. So we could remove the warning in this case, and keep it only in the case that the StackPanel has adaptHeightToChildren true AND it has a descendant with height in percentage. @RaananW do you think this is reasonable?

Of course, even in the case where we keep the code warning, we should improve the GUI Editor to not try to auto-convert it to pixels, and just display some kind of indication that the value has a different behavior. I think we could add a yellow border to the input with a tooltip or text warning. @PatrickRyan what do you think?

2 Likes

Yes. However, there is still this issue where itā€™s currently not possible to set NO HEIGHT (or width) to the Stackpanel. This prevents from automagically :magic_wand: rescaling the stackpanel from the total height (or width) of its children and is currently a big downside vs the code version.

Canā€™t agree more. The doc already explains this behavior and the console throws a warning. This shouldnā€™t result in a restriction, if you ask me.

That would be fine by me (again, my opinion only).

Meanwhile, have a great day and thanks for continuously looking at how to improve our user xp. :sunglasses:

Yes! I do :slight_smile:
This needs to be well documented, and the warning needs to be adjusted, but I donā€™t see why we couldnā€™t do it if the height is fixed and not %-based

We could research if this can be enabled. If all children have a fixed height, then there is no reason to explicitly set the height and it can be automatically assigned. We donā€™t have the concept of height: auto , so this might take a little while till we actually support that.

1 Like

May be I didnā€™t express this correctly. It totally works with code. May be I should have said ā€œNo specified heightā€. Hereā€™s a PG demonstrating this. When I do not specify any height for the panel, at first the panel is not visible (has a height of zero or no height). By adding chidren to this panel with no specified height, the panel automagically extends to the height and the total height of the children.
When I tried doing this with the editor, I couldnā€™t. Because the editor sets by default a specified height of 0px that must be passed on, I believe. Once this is done, thereā€™s no way back. I tried with code correcting this by specifying ā€˜height = nullā€™ but that indeed didnā€™t work. Adapt height to children also doesnā€™t do the job. Initially the stackpanel still keeps with this value of ā€˜somethingā€™.

Here the PG with code. You can try reproduce this from the editor. I wasnā€™t able to.

Hmm yeah Iā€™m taking a look at the behavior of Stack Panel with children and I feel itā€™s a bit weird, not setting the height works how I expect: Test stack panel with children | Babylon.js Playground (babylonjs.com), but if we donā€™t set height AND set adaptHeightToChildren to true, then it only adapts to the height of the first child: Test stack panel with children | Babylon.js Playground (babylonjs.com)

3 Likes

yes, something like that. It has never been a worry with code (once you know the trick). Problem is that you just canā€™t use this trick from the editor.

@RaananW what do you think should be the behavior in this case?

That sounds like a bug, doesnā€™t it?

The editor should have the flag for the stack panel (ā€œadjustā€¦ā€). The flag should be removed if a new height was set. Not sure we will make it to editor 1.0, but that would be a nice addition

It sounded weird but I wasnā€™t sure if it was intended behavior or not :s And then there is the case where it is adapting to the height of the children in the case the height is not set, should we preserve this behavior or not? In the case of other containers, it seems that not setting height is equivalent to ā€œ100%ā€ height, but in the StackPanel case it adapts to the childrenā€™s height: Babylon.js Playground (babylonjs.com)

2 Likes

Yes, thatā€™s precisely the one Iā€™d really like to keep. It allows for creating dynamic panels. Very helpful for things like i.e. a dropdown menu, an enhanced chatbox or any container inside a scrollviewer with dynamic content.

Edit: Just want to add to this that it works (with code) for both height or width. And (in my opinion) should stay this way. Thanks,

1 Like

@mawa just opened a PR to make the StackPanel adapt the height correctly also if adaptHeightToChildren was set, no matter if it also has a height: Take into account adaptWidth/HeightToChildren in the StackPanel by carolhmj Ā· Pull Request #13144 Ā· BabylonJS/Babylon.js (github.com) I think this will make working on the editor easier as you wonā€™t need to worry about the height value :slight_smile:

3 Likes

You are the best !!!

Thanks a million. :pray: Be sure I will be testing this very shortly. Iā€™ll let you know if anything.
Have an amazing day :sunglasses:

2 Likes