Skip to content

Commit

Permalink
Merge pull request #6588 from diyaayay/bugfix/6581
Browse files Browse the repository at this point in the history
Stores the width and height values before any adjustments are made, Solves #6581
  • Loading branch information
davepagurek committed Nov 30, 2023
2 parents aa75140 + affe0be commit 07d5b98
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/dom/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -3282,15 +3282,13 @@ p5.Element.prototype.size = function (w, h) {
this.elt.width = aW;
this.elt.height = aH;
}

this.width = this.elt.offsetWidth;
this.height = this.elt.offsetHeight;

this.width = aW;
this.height = aH;
if (this._pInst && this._pInst._curElement) {
// main canvas associated with p5 instance
if (this._pInst._curElement.elt === this.elt) {
this._pInst._setProperty('width', this.elt.offsetWidth);
this._pInst._setProperty('height', this.elt.offsetHeight);
this._pInst._setProperty('width', aW);
this._pInst._setProperty('height', aH);
}
}
}
Expand Down

0 comments on commit 07d5b98

Please sign in to comment.