diff js/core.js @ 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 39ffb48949de
line wrap: on
line diff
--- 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) {