From c064185fd4db42da9343123cab9376fb56dcd729 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Wed, 17 Jan 2018 12:56:36 +0100 Subject: [PATCH] touch meta more info --- src/game-lib-system-input.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/game-lib-system-input.js b/src/game-lib-system-input.js index c6d8cce..279f906 100644 --- a/src/game-lib-system-input.js +++ b/src/game-lib-system-input.js @@ -666,6 +666,11 @@ GameLib.System.Input.prototype.onTouchMove = function (event) { var pinch = false; var zoom = false; + var totalUp = 0; + var totalDown = 0; + var totalLeft = 0; + var totalRight = 0; + for (var t = 0; t < event.changedTouches.length; t++) { id = event.changedTouches[t].identifier; @@ -704,6 +709,11 @@ GameLib.System.Input.prototype.onTouchMove = function (event) { this.touches[id].lastTouchY = event.changedTouches[t].pageY; this.touches[id].pageX = event.changedTouches[t].pageX; this.touches[id].pageY = event.changedTouches[t].pageY; + + totalLeft += left; + totalRight += right; + totalUp += up; + totalDown += down; } } @@ -747,7 +757,11 @@ GameLib.System.Input.prototype.onTouchMove = function (event) { inward : inward, outward : outward, pinch : pinch, - zoom : zoom + zoom : zoom, + totalLeft : totalLeft, + totalRight : totalRight, + totalUp : totalUp, + totalDown : totalDown }; // if (this.sensitivityCounter >= this.touchSensitivity) { @@ -757,6 +771,7 @@ GameLib.System.Input.prototype.onTouchMove = function (event) { GameLib.Event.Emit( GameLib.Event.TOUCH_MOVE, this.touches + ); // }