Add hitUnstrokedPaths option to hit tests

This commit is contained in:
adroitwhiz 2020-06-05 15:38:06 -04:00
parent 498097172d
commit 07d7f75bb4
2 changed files with 4 additions and 3 deletions

View file

@ -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.selected {Boolean} only hit selected items
* @option options.hitUnfilledPaths {Boolean} Allow hitting null or alpha 0 * @option options.hitUnfilledPaths {Boolean} Allow hitting null or alpha 0
* fills for paths * 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 * @param {Point} point the point where the hit-test should be performed
* (in global coordinates system). * (in global coordinates system).

View file

@ -1665,9 +1665,8 @@ var Path = PathItem.extend(/** @lends Path# */{
strokePadding = tolerancePadding, strokePadding = tolerancePadding,
join, cap, miterLimit, join, cap, miterLimit,
area, loc, res, area, loc, res,
hitStroke = options.stroke && style.hasStroke(), hitStroke = options.stroke && (style.hasStroke() || options.hitUnstrokedPaths),
hitFill = options.hitUnfilledPaths hitFill = options.fill && (style.hasFill() || options.hitUnfilledPaths),
? options.fill : options.fill && style.hasFill(),
hitCurves = options.curves, hitCurves = options.curves,
strokeRadius = hitStroke strokeRadius = hitStroke
? style.getStrokeWidth() / 2 ? style.getStrokeWidth() / 2