Skip to content

Commit 5caf26e

Browse files
committed
Merge pull request #2 from lmccart/master
pull from lmccart:master
2 parents 9e95299 + 7891816 commit 5caf26e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
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';

src/input/touch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ define(function (require) {
6262
*/
6363
p5.prototype.ontouchstart = function(e) {
6464
var context = this._isGlobal ? window : this;
65-
context.setTouchPoints(e);
65+
this.setTouchPoints(e);
6666
if(typeof context.touchStarted === 'function') {
6767
e.preventDefault();
6868
context.touchStarted(e);

0 commit comments

Comments
 (0)