Repository navigation
fix(color): stop re-wrapping p5.Color for every sketch - #9350
Akshats-git wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
f2c0810 to
33fa03a
Compare
|
Hi @limzykenneth . Waiting for a review on this one. |
limzykenneth
left a comment
There was a problem hiding this comment.
A few questions inline. Also don't worry about updating the branch to latest when there are no additional changes, we can take care of it when reviewing.
| p5.registerDecorator('p5.Color.prototype.setRed', setRangeFor(0)); | ||
| p5.registerDecorator('p5.Color.prototype.setGreen', setRangeFor(1)); | ||
| p5.registerDecorator('p5.Color.prototype.setBlue', setRangeFor(2)); | ||
| p5.registerDecorator('p5.Color.prototype.setAlpha', setRangeFor(3)); |
There was a problem hiding this comment.
Seems these only took care of the setters, does the getters not need decorations anymore?
There was a problem hiding this comment.
We are now passing the ranges directly so I dont think getters need decorations anymore. Its just like hue() did in PR #8062 .
Continuous ReleaseCDN linkPublished PackagesCommit hash: e0c54fc Previous deploymentsThis is an automated message. |
Resolves #9299
Changes:
Every new sketch wrapped the
p5.Colormethods again. Removed sketches stayed in memory, andred(),green(),blue()andalpha()could use the ranges of the wrong sketch.red(),green(),blue()andalpha()now pass their ranges, like Include use of relevant maxes inhue(),saturation(),brightness()andlightness()#8062 did forhue().registerDecoratoronce. Each color keeps a link to its sketch. Aremovehook clears that link.setAlpha()now uses the alpha range of the color's mode. This fixes the HSB case from the issue.Added
test/unit/color/instances.js.PR Checklist
npm run lintpassesI used Claude Code to help with this.