Sign in to follow this  
Spankied

Child control triggers onPointerOutObservable [GUI]

Recommended Posts

I have a rectangle interface with an onPointerOutObserver handler that hides the interface.

https://www.babylonjs-playground.com/#65I7QC

In the first playground, I can move the mouse anywhere in the interface and it will remain visible.

https://www.babylonjs-playground.com/#65I7QC#1

In the second,  if I hover over the button in the interface, the interface is hidden. This is not intended behavior.

If I set button.isHitTestVisible = false, the rectangle observer isnt triggered. But the button observables wont be triggered.

I think the functions in question are   _processObservables  and  _processPicking  here

fixed : https://github.com/BabylonJS/Babylon.js/commit/a562a1e65d6d3e14302917cb431300fea58e8e10#diff-9559663657d125fa39095d417d2d99a6

 

 

Share this post


Link to post
Share on other sites

This one gets ugly. Rectangle controls on Rectangles controls doesnt work, so I layer a StackPanel in between. This messes up the root rectangles onPointerOut observable.

https://www.babylonjs-playground.com/#XQLXSI         (with StackPanel) 

https://www.babylonjs-playground.com/#XQLXSI#1    (without) 

Check console logs, notice onPointerOut for PG with StackPanel is only triggered sometimes. Not sure under what conditions the rectangle control's onPointerOut is triggered. The second playground, rectangles on rectangles, is missing the 'Choose Option' header. 

Also, AdvancedDynamicTexture.clear() appears to do nothing. I expect it to behave similar to dispose? Trigger an onPointerOut to reproduce.

https://www.babylonjs-playground.com/#URLPY2        (clear)

https://www.babylonjs-playground.com/#URLPY2#1   (dispose)

*cough* @Deltakosh *cough*

 

 

 

 

Share this post


Link to post
Share on other sites

So:

- There is clear is inherited from DynamicTexture and will just clear the content but then the ADT is flagged as dirty and then render everything :)

-  This freaking PointerOut proved to be more complex than I initially though. I've send an update. Hopefully this will get better now :)

Share this post


Link to post
Share on other sites
9 hours ago, Deltakosh said:

- There is clear is inherited from DynamicTexture and will just clear the content but then the ADT is flagged as dirty and then render everything :)

So should I dispose the ADT instead, and reinstantiate it everytime? I want to hide the Menu and get rid of the buttons onPointerOut.

Also, can you look into why these button stay in hover state, even after pointer out.

https://www.babylonjs-playground.com/#PUC95T

@Deltakosh

Share this post


Link to post
Share on other sites

Ok! i found time to check this one between two meetings!

The problem is that the hover animation of a button will update the alpha of the button (from 1 to 0.9 and back to 0.9). And alpha in GUI is active only when you change it (so it is ignore if you don't touch it)

I agree, it should be inherited but it is not the case for now :) So by default the rendering is done with 0.4 as the alpha is set by the container and the button does not overwrite it. But as soon as you hover it, the alpha is set and then the 0.4 is ignore and replace  by 0.9 and 1

 

Does it make sense?

Share this post


Link to post
Share on other sites
45 minutes ago, Deltakosh said:

Well you will now have the option to let alpha be an inherited value with 

 
BABYLON.GUI.Control.AllowAlphaInheritance = true;

Took me a minute to understand.

You are saying that it does switch from hover state back to its original alpha, which is .9 because it doesnt inherit the containers .4 ?
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.