Pixi.js: Wrong mouseout event fired after click of Container

Created on 20 Apr 2016  路  5Comments  路  Source: pixijs/pixi.js

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

pixi-wrong-fire-mouseout

Stale 馃捑 v4.x (Legacy) 馃摙 Accepting PRs 馃暦 Bug

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)

All 5 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tobireif picture tobireif  路  24Comments

confile picture confile  路  25Comments

mreinstein picture mreinstein  路  39Comments

KagiJPN picture KagiJPN  路  24Comments

ivanpopelyshev picture ivanpopelyshev  路  33Comments