From 673393cf5b07c0cb0bb742de4c28b7b3c5e6fac1 Mon Sep 17 00:00:00 2001 From: joni <johnfshaughnessy@gmail.com> Date: Wed, 6 Jun 2018 13:04:16 -0700 Subject: [PATCH] debug vive scroll behavior --- src/behaviours/trackpad-scrolling.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/behaviours/trackpad-scrolling.js b/src/behaviours/trackpad-scrolling.js index da7652bb0..6ebbde7dd 100644 --- a/src/behaviours/trackpad-scrolling.js +++ b/src/behaviours/trackpad-scrolling.js @@ -4,8 +4,8 @@ function trackpad_scrolling(el) { this.move = "axismove"; this.end = "trackpadtouchend"; this.isScrolling = false; - this.x = 0; - this.y = 0; + this.x = -10; + this.y = -10; this.axis = [0, 0]; this.emittedEventDetail = { detail: { axis: this.axis } }; @@ -26,8 +26,7 @@ trackpad_scrolling.prototype = { this.el.removeEventListener(this.end, this.onEnd); }, onStart: function(e) { - this.x = e.detail.axis[0]; - this.y = e.detail.axis[1]; + console.log(e); this.isScrolling = true; }, @@ -35,6 +34,11 @@ trackpad_scrolling.prototype = { if (!this.isScrolling) return; const x = e.detail.axis[0]; const y = e.detail.axis[1]; + if (this.x === -10) { + this.x = x; + this.y = y; + return; + } this.axis[0] = x - this.x; this.axis[1] = y - this.y; @@ -46,6 +50,8 @@ trackpad_scrolling.prototype = { onEnd: function(e) { this.isScrolling = false; + this.x = -10; + this.y = -10; } }; -- GitLab