diff --git a/src/easeljs/display/Container.js b/src/easeljs/display/Container.js index 614a672df..80bf7d8b6 100644 --- a/src/easeljs/display/Container.js +++ b/src/easeljs/display/Container.js @@ -588,7 +588,8 @@ this.createjs = this.createjs||{}; **/ p._getObjectsUnderPoint = function(x, y, arr, mouse, activeListener, currentDepth) { currentDepth = currentDepth || 0; - if (!currentDepth && !this._testMask(this, x, y)) { return null; } + var hitMask = this._testMask(this, x, y); + if (!currentDepth && !hitMask) { return null; } var mtx, ctx = createjs.DisplayObject._hitTestContext; activeListener = activeListener || (mouse&&this._hasMouseEventListener()); @@ -626,6 +627,11 @@ this.createjs = this.createjs||{}; else { return (mouse && !this.mouseChildren) ? this : child; } } } + + if (hitMask && this.mouseEnabled) { + if (arr) { arr.push(this); } + return this; + } return null; }; @@ -638,11 +644,11 @@ this.createjs = this.createjs||{}; * @protected **/ p._testMask = function(target, x, y) { - var mask = target.mask; + var mask = target.mask || target; if (!mask || !mask.graphics || mask.graphics.isEmpty()) { return true; } - var mtx = this._props.matrix, parent = target.parent; - mtx = parent ? parent.getConcatenatedMatrix(mtx) : mtx.identity(); + var parent = target.parent; + var mtx = parent ? parent.getConcatenatedMatrix(this._props.matrix.clone()) : mtx.identity(); mtx = mask.getMatrix(mask._props.matrix).prependMatrix(mtx); var ctx = createjs.DisplayObject._hitTestContext;