Jump to content

PointerEnter and PointerLeave are not coming


krzysztof.s
 Share

Recommended Posts

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

Link to comment
Share on other sites

Ok, I was afraid it was a new bug due to the fix I made few days ago, but apparently it was the opposite, you found out the bug I fixed few days ago. Yep, try to stick to the alpha version of 2.6 and also monitor this forum thread http://www.html5gamedevs.com/topic/22552-canvas2d-main-post/ I post each time I had new feature of major bug fix.

 

 

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