From e29749a2667ca5e9b50c33a8b811b2e846bb14c1 Mon Sep 17 00:00:00 2001 From: DD Date: Tue, 3 Apr 2018 18:09:24 -0400 Subject: [PATCH] Allow hitting unfilled text and compound paths when hitUnfilledPaths option is on --- src/path/CompoundPath.js | 2 +- src/text/PointText.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index e69a7f88..97ab5c48 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -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); }, diff --git a/src/text/PointText.js b/src/text/PointText.js index 0886862e..b82361b5 100644 --- a/src/text/PointText.js +++ b/src/text/PointText.js @@ -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); } });