Merge pull request #39 from adroitwhiz/hit-unstroked-paths

Add hitUnstrokedPaths option to hit tests
This commit is contained in:
adroitwhiz 2020-07-09 18:07:00 -04:00 committed by GitHub
commit 897bc1e087
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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.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).

View file

@ -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