Quantcast
Channel: Bugs Latest Topics
Viewing all articles
Browse latest Browse all 760

PointerEnter and PointerLeave are not coming

$
0
0
PrimitivePointerInfo.PointerEnter and PrimitivePointerInfo.PointerLeave are not send to Sprite2D when Sprite2D is added to ScreenSpaceCanvas2D as child. 
Only ScreenSpaceCanvas2D receive these events. ScreenSpaceCanvas2D has 'enableInteractions : true' and my Sprite2D has 'isPickable : true'.
                background.pointerEventObservable.add( ( d, s )=>{
                    console.log("background enter")
                    background.opacity = 0.5;
                }, BABYLON.PrimitivePointerInfo.PointerEnter );

                background.pointerEventObservable.add( ( d, s )=>{
                    console.log("background exit")
                    background.opacity = 1.0;
                }, BABYLON.PrimitivePointerInfo.PointerLeave );

                background.pointerEventObservable.add(function (d, s) {
                    console.log("background CLICK")
                }, BABYLON.PrimitivePointerInfo.PointerUp);

Only PointerUp event is handled.

When i was figuring it out i found following comment in babylon.canvas2d.js:

Quote

// NOTE TO MYSELF, this is commented right now because it doesn't seemed needed but I can't figure out why I put this code in the first place


//// Trigger a PointerEnter corresponding to the PointerOver
//if (mask === PrimitivePointerInfo.PointerOver) {
//    this._debugExecObserver(cur, PrimitivePointerInfo.PointerEnter);
//    cur._pointerEventObservable.notifyObservers(ppi, PrimitivePointerInfo.PointerEnter);
//}
//// Trigger a PointerLeave corresponding to the PointerOut
//else if (mask === PrimitivePointerInfo.PointerOut) {
//    this._debugExecObserver(cur, PrimitivePointerInfo.PointerLeave);
//    cur._pointerEventObservable.notifyObservers(ppi, PrimitivePointerInfo.PointerLeave);
//}
// Loop to the parent

If i restore commended code, events are coming, but i am not sure it is properly way ;-)

I'm using babylon 2.6.0


Viewing all articles
Browse latest Browse all 760

Trending Articles