Skip to content

Commit 2459009

Browse files
author
Lauren McCarthy
committed
fix for mouseIsPressed with touch closes #1946
1 parent 41dfb9a commit 2459009

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/events/mouse.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,6 @@ p5.prototype._onmousemove = function(e){
569569
p5.prototype._onmousedown = function(e) {
570570
var context = this._isGlobal ? window : this;
571571
var executeDefault;
572-
this._setProperty('isMousePressed', true);
573572
this._setProperty('mouseIsPressed', true);
574573
this._setMouseButton(e);
575574
this._updateNextMouseCoords(e);
@@ -636,7 +635,6 @@ p5.prototype._onmousedown = function(e) {
636635
p5.prototype._onmouseup = function(e) {
637636
var context = this._isGlobal ? window : this;
638637
var executeDefault;
639-
this._setProperty('isMousePressed', false);
640638
this._setProperty('mouseIsPressed', false);
641639
if (typeof context.mouseReleased === 'function') {
642640
executeDefault = context.mouseReleased(e);

src/events/touch.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ function getTouchInfo(canvas, w, h, e, i) {
9696
p5.prototype._ontouchstart = function(e) {
9797
var context = this._isGlobal ? window : this;
9898
var executeDefault;
99+
this._setProperty('mouseIsPressed', true);
99100
this._updateTouchCoords(e);
100101
this._updateNextMouseCoords(e);
101102
if(typeof context.touchStarted === 'function') {
@@ -219,11 +220,9 @@ p5.prototype._ontouchmove = function(e) {
219220
*
220221
*/
221222
p5.prototype._ontouchend = function(e) {
223+
this._setProperty('mouseIsPressed', false);
222224
this._updateTouchCoords(e);
223225
this._updateNextMouseCoords(e);
224-
if (this.touches.length === 0) {
225-
this._setProperty('touchIsDown', false);
226-
}
227226
var context = this._isGlobal ? window : this;
228227
var executeDefault;
229228
if (typeof context.touchEnded === 'function') {

0 commit comments

Comments
 (0)