lihis Posted July 31, 2018 Share Posted July 31, 2018 Hey, just thought i'd drop this here! If you move GUI control with moveToVector3 and later try to place another GUI in the same spot using top and left values from the first one; it's not gonna go as hoped due to now different alignments. Example to be seen here: https://www.babylonjs-playground.com/#GGB8I0 Not a bug technically i suppose, but certainly sent me hunting for one. ? I did not expect the alignment to change. No mention of this happening in the docs either (that my eyes could see). linkWithMesh appears to set alignments as well. Anyhoo, that's all. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 1, 2018 Share Posted August 1, 2018 Hi Lihis! Yep, if you have different alignments for each... you're in trouble. Good reminder, thx! But... what if you copy all 4 properties? button2.horizontalAlignment = button.horizontalAlignment; button2.verticalAlignment = button.verticalAlignment; button2.top = button.top; button2.left = button.left; https://www.babylonjs-playground.com/#KX33X8#44 (see lines 303-306) Drag the "drag me" button upward and rightward some distance. As soon as you do pointerUp, button2 is created directly atop the dragged button. That seems to work, but there could be more issues. Gotta be sure your controls aren't inside a stackpanel, which will try to do aligning FOR you. So will grids. Quote Link to comment Share on other sites More sharing options...
lihis Posted August 1, 2018 Author Share Posted August 1, 2018 Hey @Wingnut Yeah, copying alignment works. But since i myself had not touched the alignment properties at all, alignment being the issue was completely out of my mind. It did not occur to me that using moveToVector3 might have changed alignment because i had not changed or used alignments at all. They were just their defaults. And moveToVector3 changed these defaults. I would have figured it calculates the proper left and top values using whatever alignment you happen to be using - not change the alignment and then do the calculation... Once you know what's up it's not a big thing, but in this case i think what's up is a bit hidden. Wingnut 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.