File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -629,12 +629,17 @@ p5.prototype._onmousedown = function(e) {
629629 this . _setProperty ( 'mouseIsPressed' , true ) ;
630630 this . _setMouseButton ( e ) ;
631631 this . _updateNextMouseCoords ( e ) ;
632+
632633 if ( typeof context . mousePressed === 'function' ) {
633634 executeDefault = context . mousePressed ( e ) ;
634635 if ( executeDefault === false ) {
635636 e . preventDefault ( ) ;
636637 }
637- } else if ( typeof context . touchStarted === 'function' ) {
638+ // only safari needs this manual fallback for consistency
639+ } else if (
640+ navigator . userAgent . toLowerCase ( ) . includes ( 'safari' ) &&
641+ typeof context . touchStarted === 'function'
642+ ) {
638643 executeDefault = context . touchStarted ( e ) ;
639644 if ( executeDefault === false ) {
640645 e . preventDefault ( ) ;
Original file line number Diff line number Diff line change @@ -133,12 +133,17 @@ p5.prototype._ontouchstart = function(e) {
133133 this . _updateTouchCoords ( e ) ;
134134 this . _updateNextMouseCoords ( e ) ;
135135 this . _updateMouseCoords ( ) ; // reset pmouseXY at the start of each touch event
136+
136137 if ( typeof context . touchStarted === 'function' ) {
137138 executeDefault = context . touchStarted ( e ) ;
138139 if ( executeDefault === false ) {
139140 e . preventDefault ( ) ;
140141 }
141- } else if ( typeof context . mousePressed === 'function' ) {
142+ // only safari needs this manual fallback for consistency
143+ } else if (
144+ navigator . userAgent . toLowerCase ( ) . includes ( 'safari' ) &&
145+ typeof context . touchStarted === 'function'
146+ ) {
142147 executeDefault = context . mousePressed ( e ) ;
143148 if ( executeDefault === false ) {
144149 e . preventDefault ( ) ;
You can’t perform that action at this time.
0 commit comments