Skip to content

[p5.js 2.0] Refactor out reference to fn in p5.Image class #7720

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

Merged
merged 1 commit into from
Apr 11, 2025

Conversation

limzykenneth
Copy link
Member

Resolves #7659

Changes:

This refactors out references to fn (ie. p5.prototype) in the p5.Image class so that it can be imported as a standalone class (not yet fully tested but that is the intention).

@davepagurek I know this is a different approach than the solution in #7713, do you want to have a look at this and see if this is fine? The current main issue I have with this implementation is there are duplicated code between p5.Image and base p5 functions, but I think p5.Image can use a more thorough refactor somewhere down the line to help better organize its internal implementation.

@davepagurek
Copy link
Contributor

I think this looks good for now! #7713 was a quick fix to unblock testing and probably not a pattern we actually want to repeat. I guess longer term we can refactor out these common bits into helpers that can be imported from both places we use them and called?

@limzykenneth
Copy link
Member Author

I guess longer term we can refactor out these common bits into helpers that can be imported from both places we use them and called?

Yeah, I've tried to do it with a couple functions in this PR but I'm not sure I'm happy with the pattern yet, we can figure it out at a later point.

@limzykenneth limzykenneth merged commit f2777ed into processing:dev-2.0 Apr 11, 2025
2 checks passed
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