Jump to content

How to align GUI.Button horizontally


Arte
 Share

Recommended Posts

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.

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...