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:
If i restore commended code, events are coming, but i am not sure it is properly way ;-)
I'm using babylon 2.6.0