Arte Posted July 19, 2017 Share Posted July 19, 2017 Hi, Any doubt how to align GUI.Button horizontally inside GUI.StackPanel. I was playing around but no luck. Playground: https://www.babylonjs-playground.com/#4P8PJY#1 Quote Link to comment Share on other sites More sharing options...
JohnK Posted July 19, 2017 Share Posted July 19, 2017 Hi and a warm welcome to the forum. Hope this PG helps https://www.babylonjs-playground.com/#4P8PJY#2 It is worth checking out what happens when you change LEFT in line panel.horizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT; to CENTER and RIGHT. Also add the line panel.verticalAlignment = BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER; just afterwards and then change CENTER to TOP and then BOTTOM. Note also that the use of padding to get spaces between the buttons decreases the usable area of the button so I have increased the size of the button to match ie usable width 80, padding left 5, padding right 5 and so button width = usable width + padding left + padding right = 80 + 5 + 5 = 90. OK I made it 100 to give more space around Right-Top. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Arte Posted July 19, 2017 Author Share Posted July 19, 2017 You saved my day JohnK , panel.isVertical = false; // This line sorted everything stormwarestudios 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.