mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -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,
|
||||
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) {
|
||||
|
|
Loading…
Reference in a new issue