Skip to content

Commit 3130090

Browse files
committed
Just expose pixels on the main instance, actually
1 parent c0ec064 commit 3130090

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/core/p5.Graphics.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ class Graphics {
4545
// Attach renderer properties
4646
for (const p in this._renderer) {
4747
if(p[0] === '_' || typeof this._renderer[p] === 'function') continue;
48-
if (Object.hasOwn(this, p)) continue;
4948
Object.defineProperty(this, p, {
5049
get(){
5150
return this._renderer?.[p];

src/core/rendering.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,13 @@ function rendering(p5, fn){
144144
this._elements.push(this._renderer);
145145
this._renderer._applyDefaults();
146146

147-
// Attach renderer properties
148-
for (const p in this._renderer) {
149-
if (p[0] === '_' || typeof this._renderer[p] === 'function') continue;
150-
if (Object.hasOwn(this, p)) continue;
151-
Object.defineProperty(this, p, {
147+
// Make the renderer own `pixels`
148+
if (!Object.hasOwn(this, 'pixels')) {
149+
Object.defineProperty(this, 'pixels', {
152150
get(){
153-
return this._renderer?.[p];
151+
return this._renderer?.pixels;
154152
}
155-
})
153+
});
156154
}
157155

158156
return this._renderer;

0 commit comments

Comments
 (0)