mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
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:
parent
b91c8f93f8
commit
f7c21144a1
1 changed files with 12 additions and 5 deletions
|
@ -1750,11 +1750,18 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
that = this,
|
that = this,
|
||||||
area, loc, res;
|
area, loc, res;
|
||||||
|
|
||||||
if (options.stroke && style.getStrokeColor()) {
|
if (options.stroke) {
|
||||||
join = style.getStrokeJoin();
|
radius = style.getStrokeWidth() / 2;
|
||||||
cap = style.getStrokeCap();
|
if (radius > 0) {
|
||||||
radius = style.getStrokeWidth() / 2 + tolerance;
|
join = style.getStrokeJoin();
|
||||||
miterLimit = radius * style.getMiterLimit();
|
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) {
|
function checkPoint(seg, pt, name) {
|
||||||
|
|
Loading…
Reference in a new issue