From 165fb7126b7752fb31eba5d5f592d204581128b0 Mon Sep 17 00:00:00 2001 From: BorQube Date: Fri, 12 Feb 2016 13:10:30 +0100 Subject: [PATCH 1/2] Fix bug where Container instances without children would not receive mouse events. --- src/easeljs/display/Container.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/easeljs/display/Container.js b/src/easeljs/display/Container.js index 614a672df..daf510b88 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,7 +644,7 @@ 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; From 549f82eebe94e1a106fdb744417f042245072d8d Mon Sep 17 00:00:00 2001 From: BorQube Date: Mon, 15 Feb 2016 10:27:37 +0100 Subject: [PATCH 2/2] Prevent the mask testing on containers from modifying the target's transform matrix by creating a copy first. --- src/easeljs/display/Container.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/easeljs/display/Container.js b/src/easeljs/display/Container.js index daf510b88..80bf7d8b6 100644 --- a/src/easeljs/display/Container.js +++ b/src/easeljs/display/Container.js @@ -647,8 +647,8 @@ this.createjs = this.createjs||{}; 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;