TheGecko Posted June 22, 2017 Share Posted June 22, 2017 Question - I've encountered some unexpected behavior when using both a StackPanel and Button in the Babylon.GUI package. I've created a playground (https://www.babylonjs-playground.com/#V3R633) which duplicates the issues. I create a StackPanel, and add a button to it, which works fine: I click it, and I can see it is responding to that. I then add a TextBlock. but then the button appears not to be responding to the event. In my actual code, I have a Observable (via onPointerDownObservable.add), which fails to occur: in the playground code, you can see the button fail to trigger the default action instead. Any ideas what I've down wrong? Quote Link to comment Share on other sites More sharing options...
adam Posted June 22, 2017 Share Posted June 22, 2017 You need to set isHitTestVisible to false for the text or add the text before you add the stack panel. https://www.babylonjs-playground.com/#V3R633#4 Maybe text controls should have isHitTestVisible set to false by default. TheGecko 1 Quote Link to comment Share on other sites More sharing options...
TheGecko Posted June 22, 2017 Author Share Posted June 22, 2017 4 minutes ago, adam said: You need to set isHitTestVisible to false for the text or add the text before you add the stack panel. https://www.babylonjs-playground.com/#V3R633#4 Ah. gotcha - so (out of interest), the event code believes the text panel covers the whole of the screen? Quote Link to comment Share on other sites More sharing options...
adam Posted June 22, 2017 Share Posted June 22, 2017 10 minutes ago, TheGecko said: Ah. gotcha - so (out of interest), the event code believes the text panel covers the whole of the screen? Yes, since the width and height of the text is 100%. You could also do this: https://www.babylonjs-playground.com/#V3R633#5 GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
TheGecko Posted June 22, 2017 Author Share Posted June 22, 2017 1 minute ago, adam said: Yes, since the width and height of the text is 100%. You could also do this: https://www.babylonjs-playground.com/#V3R633#5 Understood - many thanks! 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.