Closed BabylonJSGuide closed 5 years ago
:+1:
When switching from setting width etc. of controls found that if you set in pixels and swap to number then this does not register, ie https://www.babylonjs-playground.com/#DKQ89M
I think this can be solved in the fromString function in valueAndUnits.ts by changing
var sourceUnit = this.unit; to var sourceUnit = ValueAndUnit.UNITMODE_PERCENTAGE;
and I will make this change in my development of a ScrollText control.
Can you check that this change will not have knock on effects with any other property
So we cannot do that as properties like Left or Top are pixel by default. But I will fix that by storing the original default unit per property. Stay tuned ;)
The current issue is getting a value for example in widthInPixels when value is set to a fraction. It appears that this._cachedParentMeasure is only ever set to Measure.Empty() and never updated to an non-zero Measure or I could just be missing something
This appears to happen with existing GUI controls.
After further investigation
In this PG to create a rectangle rect1https://www.babylonjs-playground.com/#XCPP9Y#677
in the console the output for rect1 contains the _cachedParentMeasure as non zero eg {height: 630, left: 0, top: 0, width: 263} but the output for just the property is zero? {height: 0, left: 0, top: 0, width: 0} and this is what is used to calculate widthInPixels
_cachedParentMeasure is only updated after a render (it is like the world matrix computation for regular meshes)
Just don't understand why ...... Oh I think I do, the console picks up the immediate value of the property and outputs that but then updates the object once the rendering has taken place before printing that. So the difference in apparent values is down to how the console operates.
Exactly. Let me try that: https://www.babylonjs-playground.com/#XCPP9Y#678
Only managed to create a specific scoller for text that was not future proof. Help still needed to produce scrollviewer for all controls
@BabylonJSGuide: Do not be worried by the tasks, I'll handle them :)
Done and merged., Thanks a lot @BabylonJSGuide
Feature request
http://www.html5gamedevs.com/topic/40142-can-we-customize-the-look-of-babylonjsgui/?do=findComment&comment=230694
http://www.html5gamedevs.com/topic/41012-scroll-textblock-gui/
as a starting basis. Some current fixed values would be turned to parameters.
I would be happy to give creating a PR for it over next few weeks.
Any further thought on how you see it working very welcome.
Edit with list of remaining task (for @deltakosh):