From e6ef5e7e17b1efaf6aee3ff6e819fa5f67caa839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 20 Oct 2013 01:54:20 +0200 Subject: [PATCH] Fix hit-test for compound paths again. --- src/path/CompoundPath.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index 5c9bd59e..059535e3 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -221,18 +221,23 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{ /*#*/ } // !options.nativeContains }, - _hitTest: function _hitTest(point, options) { + _hitTest : function _hitTest(point, options) { // Do not test children for fill, since a compound path forms one shape. // options.compoundChildren allows to specifically do so, see below. var res = _hitTest.base.call(this, point, Base.merge(options, { fill: false })); // If asked to query all children seperately, perform the same loop as // Item#hitTest() now on the compound children. - if (!res && options.compoundChildren) { - var children = this._children; - for (var i = children.length - 1; i >= 0 && !res; i--) - res = children[i]._hitTest(point, options); - } + if (!res) { + if (options.compoundChildren) { + var children = this._children; + for (var i = children.length - 1; i >= 0 && !res; i--) + res = children[i]._hitTest(point, options); + } else if (options.fill && this.hasFill() + && this._contains(point)) { + res = new HitResult('fill', this); + } + } return res; },