From 4abc41500215c17b23c66466a0b0dc6197cba743 Mon Sep 17 00:00:00 2001 From: DD Date: Wed, 6 Dec 2017 18:15:48 -0500 Subject: [PATCH] Add an option to hit closed paths with transparent or alpha 0 fill --- src/item/Item.js | 2 ++ src/path/Path.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/item/Item.js b/src/item/Item.js index 9d94181b..895ef7d0 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -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, diff --git a/src/path/Path.js b/src/path/Path.js index 52d555c1..d052a58c 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -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