From 63d1506efa958d7237b0f4fa28957e603f2f1e23 Mon Sep 17 00:00:00 2001 From: tamat Date: Fri, 2 Jul 2021 17:10:49 +0200 Subject: [PATCH] fixed touch --- build/litegraph.js | 17 +++++++++-------- build/litegraph_mini.js | 17 +++++++++-------- src/litegraph.js | 17 +++++++++-------- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/build/litegraph.js b/build/litegraph.js index 341c55451..9232be63a 100644 --- a/build/litegraph.js +++ b/build/litegraph.js @@ -5011,6 +5011,7 @@ LGraphNode.prototype.executeAction = function(action) this._mousedown_callback = this.processMouseDown.bind(this); this._mousewheel_callback = this.processMouseWheel.bind(this); + this._touch_callback = this.touchHandler.bind(this); canvas.addEventListener("mousedown", this._mousedown_callback, true); //down do not need to store the binded canvas.addEventListener("mousemove", this._mousemove_callback); @@ -5026,10 +5027,10 @@ LGraphNode.prototype.executeAction = function(action) //touch events //if( 'touchstart' in document.documentElement ) { - canvas.addEventListener("touchstart", this.touchHandler, true); - canvas.addEventListener("touchmove", this.touchHandler, true); - canvas.addEventListener("touchend", this.touchHandler, true); - canvas.addEventListener("touchcancel", this.touchHandler, true); + canvas.addEventListener("touchstart", this._touch_callback, true); + canvas.addEventListener("touchmove", this._touch_callback, true); + canvas.addEventListener("touchend", this._touch_callback, true); + canvas.addEventListener("touchcancel", this._touch_callback, true); } //Keyboard ****************** @@ -5077,10 +5078,10 @@ LGraphNode.prototype.executeAction = function(action) this.canvas.removeEventListener("drop", this._ondrop_callback); this.canvas.removeEventListener("dragenter", this._doReturnTrue); - this.canvas.removeEventListener("touchstart", this.touchHandler); - this.canvas.removeEventListener("touchmove", this.touchHandler); - this.canvas.removeEventListener("touchend", this.touchHandler); - this.canvas.removeEventListener("touchcancel", this.touchHandler); + this.canvas.removeEventListener("touchstart", this._touch_callback ); + this.canvas.removeEventListener("touchmove", this._touch_callback ); + this.canvas.removeEventListener("touchend", this._touch_callback ); + this.canvas.removeEventListener("touchcancel", this._touch_callback ); this._mousedown_callback = null; this._mousewheel_callback = null; diff --git a/build/litegraph_mini.js b/build/litegraph_mini.js index b92e97978..4b45c6651 100644 --- a/build/litegraph_mini.js +++ b/build/litegraph_mini.js @@ -5011,6 +5011,7 @@ LGraphNode.prototype.executeAction = function(action) this._mousedown_callback = this.processMouseDown.bind(this); this._mousewheel_callback = this.processMouseWheel.bind(this); + this._touch_callback = this.touchHandler.bind(this); canvas.addEventListener("mousedown", this._mousedown_callback, true); //down do not need to store the binded canvas.addEventListener("mousemove", this._mousemove_callback); @@ -5026,10 +5027,10 @@ LGraphNode.prototype.executeAction = function(action) //touch events //if( 'touchstart' in document.documentElement ) { - canvas.addEventListener("touchstart", this.touchHandler, true); - canvas.addEventListener("touchmove", this.touchHandler, true); - canvas.addEventListener("touchend", this.touchHandler, true); - canvas.addEventListener("touchcancel", this.touchHandler, true); + canvas.addEventListener("touchstart", this._touch_callback, true); + canvas.addEventListener("touchmove", this._touch_callback, true); + canvas.addEventListener("touchend", this._touch_callback, true); + canvas.addEventListener("touchcancel", this._touch_callback, true); } //Keyboard ****************** @@ -5077,10 +5078,10 @@ LGraphNode.prototype.executeAction = function(action) this.canvas.removeEventListener("drop", this._ondrop_callback); this.canvas.removeEventListener("dragenter", this._doReturnTrue); - this.canvas.removeEventListener("touchstart", this.touchHandler); - this.canvas.removeEventListener("touchmove", this.touchHandler); - this.canvas.removeEventListener("touchend", this.touchHandler); - this.canvas.removeEventListener("touchcancel", this.touchHandler); + this.canvas.removeEventListener("touchstart", this._touch_callback ); + this.canvas.removeEventListener("touchmove", this._touch_callback ); + this.canvas.removeEventListener("touchend", this._touch_callback ); + this.canvas.removeEventListener("touchcancel", this._touch_callback ); this._mousedown_callback = null; this._mousewheel_callback = null; diff --git a/src/litegraph.js b/src/litegraph.js index f1d0390e4..7237079a1 100755 --- a/src/litegraph.js +++ b/src/litegraph.js @@ -5009,6 +5009,7 @@ LGraphNode.prototype.executeAction = function(action) this._mousedown_callback = this.processMouseDown.bind(this); this._mousewheel_callback = this.processMouseWheel.bind(this); + this._touch_callback = this.touchHandler.bind(this); canvas.addEventListener("mousedown", this._mousedown_callback, true); //down do not need to store the binded canvas.addEventListener("mousemove", this._mousemove_callback); @@ -5024,10 +5025,10 @@ LGraphNode.prototype.executeAction = function(action) //touch events //if( 'touchstart' in document.documentElement ) { - canvas.addEventListener("touchstart", this.touchHandler, true); - canvas.addEventListener("touchmove", this.touchHandler, true); - canvas.addEventListener("touchend", this.touchHandler, true); - canvas.addEventListener("touchcancel", this.touchHandler, true); + canvas.addEventListener("touchstart", this._touch_callback, true); + canvas.addEventListener("touchmove", this._touch_callback, true); + canvas.addEventListener("touchend", this._touch_callback, true); + canvas.addEventListener("touchcancel", this._touch_callback, true); } //Keyboard ****************** @@ -5075,10 +5076,10 @@ LGraphNode.prototype.executeAction = function(action) this.canvas.removeEventListener("drop", this._ondrop_callback); this.canvas.removeEventListener("dragenter", this._doReturnTrue); - this.canvas.removeEventListener("touchstart", this.touchHandler); - this.canvas.removeEventListener("touchmove", this.touchHandler); - this.canvas.removeEventListener("touchend", this.touchHandler); - this.canvas.removeEventListener("touchcancel", this.touchHandler); + this.canvas.removeEventListener("touchstart", this._touch_callback ); + this.canvas.removeEventListener("touchmove", this._touch_callback ); + this.canvas.removeEventListener("touchend", this._touch_callback ); + this.canvas.removeEventListener("touchcancel", this._touch_callback ); this._mousedown_callback = null; this._mousewheel_callback = null;