From f7c21144a16c392b3e3adf4b6225c177f12cc2ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Fri, 18 Oct 2013 20:27:47 +0200 Subject: [PATCH] Improve handling of strokes in Path#hitTest(). Have it match stroke locations when option.stroke is set even when the path has no stroke. --- src/path/Path.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/path/Path.js b/src/path/Path.js index 4c4f1052..907b5658 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -1750,11 +1750,18 @@ var Path = PathItem.extend(/** @lends Path# */{ that = this, area, loc, res; - if (options.stroke && style.getStrokeColor()) { - join = style.getStrokeJoin(); - cap = style.getStrokeCap(); - radius = style.getStrokeWidth() / 2 + tolerance; - miterLimit = radius * style.getMiterLimit(); + if (options.stroke) { + radius = style.getStrokeWidth() / 2; + if (radius > 0) { + join = style.getStrokeJoin(); + cap = style.getStrokeCap(); + miterLimit = radius * style.getMiterLimit(); + } else { + join = cap = 'round'; + } + // Add some tolerance, so even when no stroke is set, will match for + // stroke locations. + radius += tolerance; } function checkPoint(seg, pt, name) {