krzysztof.s Posted January 26, 2017 Share Posted January 26, 2017 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 26, 2017 Share Posted January 26, 2017 Ping @Nockawa Quote Link to comment Share on other sites More sharing options...
Nockawa Posted January 26, 2017 Share Posted January 26, 2017 I'll have a check. if you can provide a Playground that demonstrates the issue it would help, thanks! Quote Link to comment Share on other sites More sharing options...
krzysztof.s Posted January 27, 2017 Author Share Posted January 27, 2017 I made a playground http://www.babylonjs-playground.com/#1FK6IP#0 Interesting, in playground it is working I got new canvas2d from: https://github.com/BabylonJS/Babylon.js/blob/master/dist/preview release/canvas2D/babylon.canvas2d.js and it seems to be fixed, i was late with reporting, thanks Quote Link to comment Share on other sites More sharing options...
Nockawa Posted January 27, 2017 Share Posted January 27, 2017 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. 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.