Improve handling of strokes in Path#hitTest().

Have it match stroke locations when option.stroke is set even when the path has no stroke.
This commit is contained in:
Jürg Lehni 2013-10-18 20:27:47 +02:00
parent b91c8f93f8
commit f7c21144a1

View file

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