I realize this is two separate feature requests, but I didn’t want to get all spammy, so I combined them into one.
First, it would be nice to be able to subscribe for notifications when a control has been added/removed from an AdvancedDynamicTexture instance. Happy to expound more, but I think it’s pretty straight forward at a high-level at least.
Second, I’d like for setting the
fontFamily property (or other style properties) to be inherited by child controls. To help keep it simple, I think it’s fine if the behavior would apply only to children added after the style has been set on the parent container. This could apply to any control with a
children property(ies) but could also just be limited to containers if that simplifies (probably doesn’t).
[Ed: it’s possible that the style inheritance is something that’s already in there, but I’m just a knucklehead and didn’t use/notice it correctly]
Adding @PatrickRyan @RaananW and @carolhmj so you have the full GUI team in cc
About the 1st one I have totally no objection, would you want to do a PR ?
The accessibility PR is going to add a onControlAddedObservable if you wouldn’t mind waiting for it to be merged Build Accessibility Tree from scene by mysunnytime · Pull Request #12074 · BabylonJS/Babylon.js (github.com)
@jelster, the GUI system for Babylon already does inherit type style from any parent that has it set, but you did expose a problem in the GUI editor. @carolhmj and @RaananW, it appears that the GUI editor is using the default properties in any control with type parameters as if the control had been assigned those default parameters.
As you can see in the link above, if you roll down the GUI in the scene explorer, the textBlock will have default values for font family and font size, but are using the values from the rectangle parent. But if you do the same thing in the GUI editor, changing the settings in a rectangle parent to a textBlock that was left with default values will not propagate the values from the parent to the child.
It seems like we need to add some logic to say that if nothing has been assigned to a parameter that can be inherited that we do not write the default values into the json and instead let the inheritance work instead.
I can create an issue for that
Ahh that is indeed what I had been experiencing! I was definitely confused about what I was seeing, this clears it up considerably - thanks!