mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Fix hit-test for compound paths again.
This commit is contained in:
parent
ddeacb1763
commit
e6ef5e7e17
1 changed files with 11 additions and 6 deletions
|
@ -221,18 +221,23 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
||||||
/*#*/ } // !options.nativeContains
|
/*#*/ } // !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.
|
// Do not test children for fill, since a compound path forms one shape.
|
||||||
// options.compoundChildren allows to specifically do so, see below.
|
// options.compoundChildren allows to specifically do so, see below.
|
||||||
var res = _hitTest.base.call(this, point,
|
var res = _hitTest.base.call(this, point,
|
||||||
Base.merge(options, { fill: false }));
|
Base.merge(options, { fill: false }));
|
||||||
// If asked to query all children seperately, perform the same loop as
|
// If asked to query all children seperately, perform the same loop as
|
||||||
// Item#hitTest() now on the compound children.
|
// Item#hitTest() now on the compound children.
|
||||||
if (!res && options.compoundChildren) {
|
if (!res) {
|
||||||
var children = this._children;
|
if (options.compoundChildren) {
|
||||||
for (var i = children.length - 1; i >= 0 && !res; i--)
|
var children = this._children;
|
||||||
res = children[i]._hitTest(point, options);
|
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;
|
return res;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue