mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
parent
7c37a4a4d2
commit
0cb792de93
1 changed files with 3 additions and 5 deletions
|
@ -184,11 +184,9 @@ var Line = Base.extend(/** @lends Line# */{
|
||||||
}
|
}
|
||||||
// Based on the error analysis by @iconexperience outlined in
|
// Based on the error analysis by @iconexperience outlined in
|
||||||
// https://github.com/paperjs/paper.js/issues/799
|
// https://github.com/paperjs/paper.js/issues/799
|
||||||
return vx === 0
|
return vx === 0 ? vy > 0 ? x - px : px - x
|
||||||
? vy >= 0 ? px - x : x - px
|
: vy === 0 ? vx < 0 ? y - py : py - y
|
||||||
: vy === 0
|
: ((x-px) * vy - (y-py) * vx) / Math.sqrt(vx * vx + vy * vy);
|
||||||
? vx >= 0 ? y - py : py - y
|
|
||||||
: (vx * (y - py) - vy * (x - px)) / Math.sqrt(vx * vx + vy * vy);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue