Hi !
I have an interactive Container, holding my buttons in a game. These buttons has different sprites for various states like : 'up','down','over' etc.
My problem seems to be that after a click of the Container a mouseout event is fired as well. See attached screenshot. Seems like pixi's hit-test doesn't apply properly to Containers.
Anyone seen anything similar ?
To work around it, I have my own hit-detection routine in place, but obviously I think this is a bug.
` container.mouseout = function(mouseData) {
//hittest required to circumvent pixi.js's erroneus firing of mouseout on clicks
if(!containsPoint(mouseData.data.global, container)) {
showFrame((active) ? frameId('up') : 'inactive');
}
};
function containsPoint(point,container) {
if(!point || !container) return;
var cp = container.getGlobalPosition();
if(point.x < cp.x || point.x > cp.x + container.width) return false;
if(point.y < cp.y || point.y > cp.y + container.height) return false;
USM.log("point:"+JSON.stringify(point)+", container topleft:"+JSON.stringify(cp)+
" container size:"+container.width+"x"+container.height);
return true;
}
`
Running : Pixi.js 3.0.7 - WebGL
Yes indeed, same behavior here. We switched our events to mouseupoutside, it's not the same event but at least it works on containers, and it's touch friendly (touchout doesn't exist, touchendoutside does)
Any news about this?
I'm using v4.7.1 and seems that it still occurs
Could you put together a fiddle demonstrating this please @FNevesFMQ ?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Yes indeed, same behavior here. We switched our events to mouseupoutside, it's not the same event but at least it works on containers, and it's touch friendly (touchout doesn't exist, touchendoutside does)