diff --git a/src/interaction/InteractionManager.js b/src/interaction/InteractionManager.js index f915104..8baf13a 100644 --- a/src/interaction/InteractionManager.js +++ b/src/interaction/InteractionManager.js @@ -804,6 +804,8 @@ } } + let keepHitTestingAfterChildren = hitTest; + // ** FREE TIP **! If an object is not interactive or has no buttons in it // (such as a game scene!) set interactiveChildren to false for that displayObject. // This will allow pixi to completely ignore and bypass checking the displayObjects children. @@ -836,15 +838,20 @@ // This means we no longer need to hit test anything else. We still need to run // through all objects, but we don't need to perform any hit tests. - // { - hitTest = false; - // } + keepHitTestingAfterChildren = false; + + if (child.interactive) + { + hitTest = false; + } // we can break now as we have hit an object. } } } + hitTest = keepHitTestingAfterChildren; + // no point running this if the item is not interactive or does not have an interactive parent. if (interactive) { diff --git a/src/interaction/InteractionManager.js b/src/interaction/InteractionManager.js index f915104..8baf13a 100644 --- a/src/interaction/InteractionManager.js +++ b/src/interaction/InteractionManager.js @@ -804,6 +804,8 @@ } } + let keepHitTestingAfterChildren = hitTest; + // ** FREE TIP **! If an object is not interactive or has no buttons in it // (such as a game scene!) set interactiveChildren to false for that displayObject. // This will allow pixi to completely ignore and bypass checking the displayObjects children. @@ -836,15 +838,20 @@ // This means we no longer need to hit test anything else. We still need to run // through all objects, but we don't need to perform any hit tests. - // { - hitTest = false; - // } + keepHitTestingAfterChildren = false; + + if (child.interactive) + { + hitTest = false; + } // we can break now as we have hit an object. } } } + hitTest = keepHitTestingAfterChildren; + // no point running this if the item is not interactive or does not have an interactive parent. if (interactive) { diff --git a/test/interaction/InteractionManager.js b/test/interaction/InteractionManager.js index a02e418..0e7e707 100644 --- a/test/interaction/InteractionManager.js +++ b/test/interaction/InteractionManager.js @@ -639,7 +639,6 @@ expect(scene.parentCallback).to.have.been.calledOnce; }); - /* TODO: Fix #3596 it('should callback parent and behind child when clicking overlap', function () { const stage = new PIXI.Container(); @@ -657,7 +656,6 @@ expect(scene.frontChildCallback).to.not.have.been.called; expect(scene.parentCallback).to.have.been.calledOnce; }); - */ it('should callback parent and behind child when clicking behind child', function () {