Skip to content

Commit 032a008

Browse files
committed
Merge branch 'master' of https://github.com/hrishit/p5.js
2 parents e5405bc + 5caf26e commit 032a008

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/addons/p5.dom.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,9 +585,18 @@ var p5DOM = (function(){
585585
}
586586
// set diff for cnv vs normal div
587587
if (this.elt instanceof HTMLCanvasElement) {
588+
var j = {};
589+
var k = this.elt.getContext('2d');
590+
for (var prop in k) {
591+
j[prop] = k[prop];
592+
}
588593
this.elt.setAttribute('width', aW * this._pInst._pixelDensity);
589594
this.elt.setAttribute('height', aH * this._pInst._pixelDensity);
590595
this.elt.setAttribute('style', 'width:' + aW + 'px !important; height:' + aH + 'px !important;');
596+
this._pInst.scale(this._pInst._pixelDensity, this._pInst._pixelDensity);
597+
for (var prop in j) {
598+
this.elt.getContext('2d')[prop] = j[prop];
599+
}
591600
} else {
592601
this.elt.style.width = aW+'px';
593602
this.elt.style.height = aH+'px';

0 commit comments

Comments
 (0)