mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Merge pull request #9 from fsih/hitUnfilledText
Allow hitting unfilled text and compound paths when hitUnfilledPaths option is on
This commit is contained in:
commit
a9de479c8c
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
|
||||
// compound path forms one shape.
|
||||
// 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 }),
|
||||
viewMatrix);
|
||||
},
|
||||
|
|
|
@ -119,5 +119,10 @@ var PointText = TextItem.extend(/** @lends PointText# */{
|
|||
numLines ? - 0.75 * leading : 0,
|
||||
width, numLines * leading);
|
||||
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