From 07d7f75bb4b403d9c32fab1ec3d1a64f92e9b686 Mon Sep 17 00:00:00 2001 From: adroitwhiz Date: Fri, 5 Jun 2020 15:38:06 -0400 Subject: [PATCH] Add hitUnstrokedPaths option to hit tests --- src/item/Item.js | 2 ++ src/path/Path.js | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/item/Item.js b/src/item/Item.js index d6cd8558..76ba13da 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -1975,6 +1975,8 @@ new function() { // Injection scope for hit-test functions shared with project * @option options.selected {Boolean} only hit selected items * @option options.hitUnfilledPaths {Boolean} Allow hitting null or alpha 0 * fills for paths + * @option options.hitUnstrokedPaths {Boolean} Allow hitting null or alpha 0 + * strokes for paths * * @param {Point} point the point where the hit-test should be performed * (in global coordinates system). diff --git a/src/path/Path.js b/src/path/Path.js index 19848a9c..4e988caf 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -1665,9 +1665,8 @@ var Path = PathItem.extend(/** @lends Path# */{ strokePadding = tolerancePadding, join, cap, miterLimit, area, loc, res, - hitStroke = options.stroke && style.hasStroke(), - hitFill = options.hitUnfilledPaths - ? options.fill : options.fill && style.hasFill(), + hitStroke = options.stroke && (style.hasStroke() || options.hitUnstrokedPaths), + hitFill = options.fill && (style.hasFill() || options.hitUnfilledPaths), hitCurves = options.curves, strokeRadius = hitStroke ? style.getStrokeWidth() / 2