mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
Avoid dividing with zero while splitting curves
This commit is contained in:
parent
9c552b1739
commit
066d47dbf7
1 changed files with 4 additions and 2 deletions
|
@ -212,7 +212,9 @@ PathItem.inject(new function() {
|
||||||
var loc = intersections[i],
|
var loc = intersections[i],
|
||||||
t = loc._parameter;
|
t = loc._parameter;
|
||||||
// Check if we are splitting same curve multiple times
|
// Check if we are splitting same curve multiple times
|
||||||
if (prevLoc && prevLoc._curve === loc._curve) {
|
if (prevLoc && prevLoc._curve === loc._curve
|
||||||
|
// Avoid dividing with zero
|
||||||
|
&& prevLoc._parameter > 0) {
|
||||||
// Scale parameter after previous split.
|
// Scale parameter after previous split.
|
||||||
t /= prevLoc._parameter;
|
t /= prevLoc._parameter;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue