File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff 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' ;
Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments