Skip to content

Commit

Permalink
Merge pull request #7495 from processing/fix/closed-curves
Browse files Browse the repository at this point in the history
Fix closed curves having extra loops
  • Loading branch information
davepagurek authored Jan 24, 2025
2 parents c7ee241 + c4fc913 commit b574be6
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/shape/custom_shapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ class SplineSegment extends Segment {
points.unshift(prevVertex);
points.push(this.vertices.at(-1));
} else if (this._splineProperties.ends === constants.JOIN) {
points.unshift(this.vertices.at(-1), prevVertex);
points.unshift(this.vertices.at(-1));
points.push(prevVertex, this.vertices.at(0));
}

Expand Down
10 changes: 10 additions & 0 deletions test/unit/visual/cases/shapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ visualSuite('Shape drawing', function() {
screenshot();
});

visualTest('Drawing simple closed curves', function(p5, screenshot) {
setup(p5);
p5.beginShape();
p5.splineVertex(10, 10);
p5.splineVertex(15, 40);
p5.splineVertex(40, 35);
p5.endShape(p5.CLOSE);
screenshot();
});

visualTest('Drawing with curves with tightness', function(p5, screenshot) {
setup(p5);
p5.splineProperty('tightness', -1);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"numScreenshots": 1
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"numScreenshots": 1
}

0 comments on commit b574be6

Please sign in to comment.