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

Build base classes and visitors for custom shapes in p5.js 2.0 #7373

Draft
wants to merge 43 commits into
base: dev-2.0
Choose a base branch
from

Conversation

GregStanton
Copy link
Collaborator

Addresses #6560

Changes:

  • Build base classes (for shapes, contours, shape primitives, and vertices)
  • Build visitor classes (for converting shape primitives to Path2D objects or vertices)

Notes:

  1. This PR may also include an implementation of a point-at-length getter for path-segment primitives.
  2. This PR includes boilerplate for the new user-facing functions; that's a roadmap for a later PR, so it's commented out.

PR Checklist

Note: Since this is a draft PR, I'll update the checklist before submitting it for review. Inline documentation will be included, but I'll hold off on including unit tests covering the new behaviors, since those won't be testable until the next phase of work is completed.

GregStanton and others added 27 commits November 8, 2024 20:11
…v-2.0

Updating my local repo before pushing to origin.
@@ -49,6 +51,8 @@ class Renderer {
this._clipping = false;
this._clipInvert = false;
this._curveTightness = 0;

this.currentShape = new Shape();
Copy link
Contributor

Choose a reason for hiding this comment

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

@GregStanton it's not being used yet to actually draw shapes, but I've added a current shape to renderers. I've added a skeleton for a .reset() method that can be called on it when beginShape() is called to clear existing data, and I'm calling updateShapeVertexProperties() in a few places where the shape's data would need to be updated based on the renderer's state.

@@ -696,6 +696,12 @@ export const BOTTOM = 'bottom';
* @final
*/
export const BASELINE = 'alphabetic';
/**
Copy link
Collaborator Author

@GregStanton GregStanton Nov 23, 2024

Choose a reason for hiding this comment

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

@davepagurek Does this look okay? I remembered from the 2.0 RFC that the plan is to use Symbol when the underlying value of a constant isn't needed. I'm guessing we just haven't gotten around to changing all the constants that fit that description?

Update: I added both PATH and EMPTY_PATH as Symbol values.

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 so!

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