Allow hitting unfilled text and compound paths when hitUnfilledPaths option is on

This commit is contained in:
DD 2018-04-03 18:09:24 -04:00
parent feb044048f
commit e29749a266
2 changed files with 6 additions and 1 deletions

View file

@ -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);
},

View file

@ -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);
}
});