Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor vertex functions for composite paths #6606

Closed

Conversation

capGoblin
Copy link
Contributor

@capGoblin capGoblin commented Dec 3, 2023

Addresses #6560
This PR introduces the suggested way (as discussed in #6560 by @davepagurek and @GregStanton ) to refactor endShape to enable it for composite paths for 2D.
Changes:

  • Vertex functions now uses vertex class objects (Vertex, BezierVertex, QuadraticVertex, CurveVertex)
  • Rendering them sequentially in endShape by looping through the vertex objects.
  • Classes Shape, Contour, ContourSegment to organize the construction and manipulation of the vertex objects.

Screenshots of the change:
All the vertex objects works as expected!

Screenshot 2023-12-04 020731

PR Checklist

@capGoblin
Copy link
Contributor Author

capGoblin commented Dec 3, 2023

This is the progress so far, it has some flaws here and there, I will have to do some fixing/refactoring/renaming. (feel free to suggest some)

Comment on lines +10 to +12
get contourss() {
return this.contours;
}
Copy link
Contributor

@lindapaiste lindapaiste Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A common naming convention is to use _ for the private/internal variables. So you would have this._contours and get contours() { return this._contours; }

If all that you are doing is returning the property as-is then you don't really need a getter. You can just use shape.contours directly. You can use JSDoc @readonly etc. to annotate the class.

allVertObj.push(v);
});
});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is just a flatMap?

@capGoblin
Copy link
Contributor Author

Thank you for the suggestions! I've taken note of all of them. Closing this PR as we're shifting towards a new approach!

@capGoblin capGoblin closed this Dec 18, 2023
@capGoblin capGoblin deleted the refactor/vertex-functions branch December 19, 2023 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants