Mercurial > hg > webaudioevaluationtool
comparison interfaces/ape.js @ 3069:a03408cd1fde
WIP #122. Try re-organising touch events
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Tue, 31 Oct 2017 21:55:34 +0000 |
parents | edeeff75ed19 |
children | 1f92be08fadd |
comparison
equal
deleted
inserted
replaced
3068:edeeff75ed19 | 3069:a03408cd1fde |
---|---|
348 trackObj.classList.add("error-colour"); | 348 trackObj.classList.add("error-colour"); |
349 trackObj.removeEventListener("mousedown"); | 349 trackObj.removeEventListener("mousedown"); |
350 trackObj.removeEventListener("mouseup"); | 350 trackObj.removeEventListener("mouseup"); |
351 trackObj.removeEventListener("touchstart"); | 351 trackObj.removeEventListener("touchstart"); |
352 trackObj.removeEventListener("touchend"); | 352 trackObj.removeEventListener("touchend"); |
353 trackObj.removeEventListener("touchcancel"); | |
353 } | 354 } |
354 var timing = undefined; | 355 var timing = undefined; |
355 this.handleEvent = function (e) { | 356 this.handleEvent = function (e) { |
356 // This is only for the mousedown / touchdown | 357 // This is only for the mousedown / touchdown |
357 if (e.preventDefault) { | 358 if (e.preventDefault) { |
358 e.preventDefault(); | 359 e.preventDefault(); |
359 } | 360 } |
360 if (e.type == "mousedown" || e.type == "touchstart") { | 361 if (e.type == "mousedown" || e.type == "touchstart") { |
361 axisInterface.mousedown(this); | 362 axisInterface.mousedown(this); |
362 } else if (e.type == "mouseup" || e.type == "touchend") { | 363 } else if (e.type == "mouseup" || e.type == "touchend" || e.type == "touchcancel") { |
363 axisInterface.mouseup(this); | 364 axisInterface.mouseup(this); |
364 metric.moved(audioEngineContext.timer.getTestTime(), this.value); | 365 metric.moved(audioEngineContext.timer.getTestTime(), this.value); |
365 console.log("Slider " + label + " on axis " + axisInterface.name + " moved to " + this.value); | 366 console.log("Slider " + label + " on axis " + axisInterface.name + " moved to " + this.value); |
366 } | 367 } |
367 } | 368 } |