mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-23 05:52:42 -05:00
fix lines getting curved when joining paths
This commit is contained in:
parent
70ff3b656f
commit
021930eadc
1 changed files with 5 additions and 3 deletions
|
@ -81,9 +81,10 @@ class LineMode extends React.Component {
|
||||||
if (this.hitResult.isFirst) {
|
if (this.hitResult.isFirst) {
|
||||||
this.path.reverse();
|
this.path.reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.path.lastSegment.handleOut = null; // Make sure added line isn't made curvy
|
||||||
|
this.path.lastSegment.handleIn = null; // Bug in paper.js? You need to remove the other handle too
|
||||||
this.path.add(this.hitResult.segment); // Add second point, which is what will move when dragged
|
this.path.add(this.hitResult.segment); // Add second point, which is what will move when dragged
|
||||||
this.path.lastSegment.handleOut = null; // Make sure line isn't curvy
|
|
||||||
this.path.lastSegment.handleIn = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not near other path, start a new path
|
// If not near other path, start a new path
|
||||||
|
@ -164,11 +165,11 @@ class LineMode extends React.Component {
|
||||||
this.path = null;
|
this.path = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If I intersect other line end points, join or close
|
// If I intersect other line end points, join or close
|
||||||
if (this.hitResult) {
|
if (this.hitResult) {
|
||||||
this.path.removeSegment(this.path.segments.length - 1);
|
this.path.removeSegment(this.path.segments.length - 1);
|
||||||
if (this.path.firstSegment.point.equals(this.hitResult.segment.point)) {
|
if (this.path.firstSegment.point.equals(this.hitResult.segment.point)) {
|
||||||
|
this.path.firstSegment.handleIn = null; // Make sure added line isn't made curvy
|
||||||
// close path
|
// close path
|
||||||
this.path.closed = true;
|
this.path.closed = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -176,6 +177,7 @@ class LineMode extends React.Component {
|
||||||
if (!this.hitResult.isFirst) {
|
if (!this.hitResult.isFirst) {
|
||||||
this.hitResult.path.reverse();
|
this.hitResult.path.reverse();
|
||||||
}
|
}
|
||||||
|
this.hitResult.path.firstSegment.handleIn = null; // Make sure added line isn't made curvy
|
||||||
this.path.join(this.hitResult.path);
|
this.path.join(this.hitResult.path);
|
||||||
}
|
}
|
||||||
removeHitPoint();
|
removeHitPoint();
|
||||||
|
|
Loading…
Reference in a new issue