mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Merge pull request #39 from adroitwhiz/hit-unstroked-paths
Add hitUnstrokedPaths option to hit tests
This commit is contained in:
commit
897bc1e087
2 changed files with 4 additions and 3 deletions
|
@ -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).
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue