We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7d77c13 + 622d227 commit e9cae1fCopy full SHA for e9cae1f
src/webgl/p5.RendererGL.js
@@ -138,6 +138,20 @@ class RendererGL extends Renderer {
138
this.elt.id = "defaultCanvas0";
139
this.elt.classList.add("p5Canvas");
140
141
+ // Set and return p5.Element
142
+ this.wrappedElt = new Element(this.elt, this._pInst);
143
+
144
+ // Extend renderer with methods of p5.Element with getters
145
+ for (const p of Object.getOwnPropertyNames(Element.prototype)) {
146
+ if (p !== 'constructor' && p[0] !== '_') {
147
+ Object.defineProperty(this, p, {
148
+ get() {
149
+ return this.wrappedElt[p];
150
+ }
151
+ })
152
153
154
155
const dimensions = this._adjustDimensions(w, h);
156
w = dimensions.adjustedWidth;
157
h = dimensions.adjustedHeight;
0 commit comments