Merge pull request #5 from fsih/hitTransparent

Add an option to hit closed paths with transparent or alpha 0 fill
This commit is contained in:
DD Liu 2017-12-14 15:37:03 -05:00 committed by GitHub
commit 241d0749c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -1894,6 +1894,8 @@ new function() { // Injection scope for hit-test functions shared with project
* @option options.guides {Boolean} hit-test items that have {@link
* Item#guide} set to `true`
* @option options.selected {Boolean} only hit selected items
* @option options.hitUnfilledPaths {Boolean} Allow hitting null or alpha 0
* fills for paths
*
* @param {Point} point the point where the hit-test should be performed
* @param {Object} [options={ fill: true, stroke: true, segments: true,

View file

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