mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Allow hitting unfilled text and compound paths when hitUnfilledPaths option is on
This commit is contained in:
parent
feb044048f
commit
e29749a266
2 changed files with 6 additions and 1 deletions
|
@ -293,7 +293,7 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
||||||
// options.class == Path, do not test children for fill, since a
|
// options.class == Path, do not test children for fill, since a
|
||||||
// compound path forms one shape.
|
// compound path forms one shape.
|
||||||
// Also support legacy format `type: 'path'`.
|
// Also support legacy format `type: 'path'`.
|
||||||
options.class === Path || options.type === 'path' ? options
|
options.class === Path || options.type === 'path' || options.hitUnfilledPaths ? options
|
||||||
: Base.set({}, options, { fill: false }),
|
: Base.set({}, options, { fill: false }),
|
||||||
viewMatrix);
|
viewMatrix);
|
||||||
},
|
},
|
||||||
|
|
|
@ -119,5 +119,10 @@ var PointText = TextItem.extend(/** @lends PointText# */{
|
||||||
numLines ? - 0.75 * leading : 0,
|
numLines ? - 0.75 * leading : 0,
|
||||||
width, numLines * leading);
|
width, numLines * leading);
|
||||||
return matrix ? matrix._transformBounds(rect, rect) : rect;
|
return matrix ? matrix._transformBounds(rect, rect) : rect;
|
||||||
|
},
|
||||||
|
|
||||||
|
_hitTestSelf: function(point, options) {
|
||||||
|
if (options.fill && (this.hasFill() || options.hitUnfilledPaths) && this._contains(point))
|
||||||
|
return new HitResult('fill', this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue