changeset 3064:a504a17dcf9f

Fix some lingering APE.js issues with movement trackers
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Tue, 31 Oct 2017 16:44:53 +0000
parents 6b95437ae672
children b3230c0da598
files interfaces/ape.js js/core.js
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/interfaces/ape.js	Tue Oct 31 16:21:58 2017 +0000
+++ b/interfaces/ape.js	Tue Oct 31 16:44:53 2017 +0000
@@ -360,6 +360,8 @@
                     axisInterface.mousedown(this);
                 } else if (e.type == "mouseup") {
                     axisInterface.mouseup(this);
+                    metric.moved(audioEngineContext.timer.getTestTime(), this.value);
+                    console.log("Slider " + label + " on axis " + axisInterface.name + " moved to " + this.value);
                 }
             }
             this.clicked = function (e) {
@@ -574,14 +576,12 @@
                 move = Math.max(50, move);
                 move = Math.min(w, move);
                 UI.selected.value = (move / w);
-                UI.selected.metric.moved(time, UI.selected.value);
             } else if (event.type == "touchmove") {
                 var move = event.originalEvent.targetTouches[0].clientX - 6;
                 var w = $(event.currentTarget).width();
                 move = Math.max(50, move);
                 move = Math.min(w, move);
                 UI.selected.value = (move / w);
-                UI.selected.metric.moved(time, UI.selected.value);
             }
         }
         this.checkAllMoved = function () {
--- a/js/core.js	Tue Oct 31 16:21:58 2017 +0000
+++ b/js/core.js	Tue Oct 31 16:44:53 2017 +0000
@@ -2220,10 +2220,19 @@
     };
 
     this.moved = function (time, position) {
+        var last;
         if (time > 0) {
             this.wasMoved = true;
         }
-        this.movementTracker[this.movementTracker.length] = [time, position];
+        // Get the last entry
+        if (this.movementTracker.length > 0) {
+            last = this.movementTracker[this.movementTracker.length - 1];
+        } else {
+            last = -1;
+        }
+        if (position != last[1]) {
+            this.movementTracker[this.movementTracker.length] = [time, position];
+        }
     };
 
     this.startListening = function (time) {