From 148dc74dde0301c75dd33b5275cfb183a059edd8 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 9 May 2016 16:29:10 +0200 Subject: [PATCH] Update SwipeManager --- UI/Input/Touch/SwipeManager | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/UI/Input/Touch/SwipeManager b/UI/Input/Touch/SwipeManager index b6c4c9c..01075e7 100644 --- a/UI/Input/Touch/SwipeManager +++ b/UI/Input/Touch/SwipeManager @@ -22,9 +22,25 @@ { this.app = app; this.surface = {}; + + this.activeSwipe = {'startX': null, 'startY': null, 'time': null}; }; - jsOMS.UI.Input.Touch.SwipeManager.prototype.add = function (surface, id, gesture, callback) + jsOMS.UI.Input.Touch.SwipeManager.prototype.add = function (surface, id, cUp, cRight, cDown, cLeft) { + let e = document.getElementById(surface) + self = this; + e.addEventListener('touchstart', function(event) { + let touch = e.changedTouches[0]; + + self.activeSwipe.startX = touch.pageX; + self.activeSwipe.startY = touch.pageY; + self.activeSwipe.time = new Date().getTime(); + + jsOMS.preventAll(event); + }); + }; + + }(window.jsOMS = window.jsOMS || {}));