I'm using Pixi JS and detecting the mouse position via a simple event handler:
...
var stage = new PIXI.Container();
stage.interactive = true;
var handler = function(e){
mouseX = renderer.plugins.interaction.mouse.global.x;
mouseY = renderer.plugins.interaction.mouse.global.y;
}
stage.on("pointermove", handler);
...
However mouseX and mouseY are being updated when the mouse is outside of the stage bounds (the <canvas> element on the page). Is it possible to limit the mousemove event to within the stage?
I've tried stage.hitArea but that didn't work.