Skip to content

Commit 07d5b98

Browse files
authored
Merge pull request #6588 from diyaayay/bugfix/6581
Stores the width and height values before any adjustments are made, Solves #6581
2 parents aa75140 + affe0be commit 07d5b98

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/dom/dom.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3282,15 +3282,13 @@ p5.Element.prototype.size = function (w, h) {
32823282
this.elt.width = aW;
32833283
this.elt.height = aH;
32843284
}
3285-
3286-
this.width = this.elt.offsetWidth;
3287-
this.height = this.elt.offsetHeight;
3288-
3285+
this.width = aW;
3286+
this.height = aH;
32893287
if (this._pInst && this._pInst._curElement) {
32903288
// main canvas associated with p5 instance
32913289
if (this._pInst._curElement.elt === this.elt) {
3292-
this._pInst._setProperty('width', this.elt.offsetWidth);
3293-
this._pInst._setProperty('height', this.elt.offsetHeight);
3290+
this._pInst._setProperty('width', aW);
3291+
this._pInst._setProperty('height', aH);
32943292
}
32953293
}
32963294
}

0 commit comments

Comments
 (0)