mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -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],
|
||||
t = loc._parameter;
|
||||
// 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.
|
||||
t /= prevLoc._parameter;
|
||||
} else {
|
||||
|
@ -663,4 +665,4 @@ CompoundPath.inject(/** @lends CompoundPath# */{
|
|||
monoCurves.push.apply(monoCurves, children[i]._getMonoCurves());
|
||||
return monoCurves;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue