comparison 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
comparison
equal deleted inserted replaced
3063:6b95437ae672 3064:a504a17dcf9f
2218 this.moved(0, position); 2218 this.moved(0, position);
2219 } 2219 }
2220 }; 2220 };
2221 2221
2222 this.moved = function (time, position) { 2222 this.moved = function (time, position) {
2223 var last;
2223 if (time > 0) { 2224 if (time > 0) {
2224 this.wasMoved = true; 2225 this.wasMoved = true;
2225 } 2226 }
2226 this.movementTracker[this.movementTracker.length] = [time, position]; 2227 // Get the last entry
2228 if (this.movementTracker.length > 0) {
2229 last = this.movementTracker[this.movementTracker.length - 1];
2230 } else {
2231 last = -1;
2232 }
2233 if (position != last[1]) {
2234 this.movementTracker[this.movementTracker.length] = [time, position];
2235 }
2227 }; 2236 };
2228 2237
2229 this.startListening = function (time) { 2238 this.startListening = function (time) {
2230 if (this.listenHold === false) { 2239 if (this.listenHold === false) {
2231 this.wasListenedTo = true; 2240 this.wasListenedTo = true;