Jump to content

Child control triggers onPointerOutObservable [GUI]


Spankied
 Share

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

 

 

Link to comment
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*

 

 

 

 

Link to comment
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 :)

Link to comment
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

Link to comment
Share on other sites

To hide it, just call ADT.rootContainer.isEnabled = false

 

I unfortunately do not have time for the other question. So please fill an issue on the repo if you consider it is a bug

Link to comment
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?

Link to comment
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 ?
 

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...