comparison interfaces/ape.js @ 3071:afb1de9be046

#122 Better catch-all for touchmove/end/cancel
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Tue, 31 Oct 2017 22:07:53 +0000
parents 1f92be08fadd
children 2dcf6aaa7c4c
comparison
equal deleted inserted replaced
3070:1f92be08fadd 3071:afb1de9be046
330 } 330 }
331 this.enable = function () { 331 this.enable = function () {
332 trackObj.addEventListener("mousedown", this); 332 trackObj.addEventListener("mousedown", this);
333 trackObj.addEventListener("mouseup", this); 333 trackObj.addEventListener("mouseup", this);
334 trackObj.addEventListener("touchstart", this); 334 trackObj.addEventListener("touchstart", this);
335 trackObj.addEventListener("touchend", this);
336 trackObj.addEventListener("touchcancel", this);
335 trackObj.classList.remove("track-slider-disabled"); 337 trackObj.classList.remove("track-slider-disabled");
336 labelHolder.textContent = label; 338 labelHolder.textContent = label;
337 } 339 }
338 this.updateLoading = function (progress) { 340 this.updateLoading = function (progress) {
339 labelHolder.textContent = progress + "%"; 341 labelHolder.textContent = progress + "%";
364 } else if (e.type == "mouseup" || e.type == "touchend" || e.type == "touchcancel") { 366 } else if (e.type == "mouseup" || e.type == "touchend" || e.type == "touchcancel") {
365 axisInterface.mouseup(this); 367 axisInterface.mouseup(this);
366 metric.moved(audioEngineContext.timer.getTestTime(), this.value); 368 metric.moved(audioEngineContext.timer.getTestTime(), this.value);
367 console.log("Slider " + label + " on axis " + axisInterface.name + " moved to " + this.value); 369 console.log("Slider " + label + " on axis " + axisInterface.name + " moved to " + this.value);
368 } else if (e.type == "touchmove") { 370 } else if (e.type == "touchmove") {
369 axisInterface.handleEvent(e); 371 //axisInterface.handleEvent(e);
370 } 372 }
371 } 373 }
372 this.clicked = function (e) { 374 this.clicked = function (e) {
373 AOI.clicked(); 375 AOI.clicked();
374 } 376 }
638 return "On axis \"" + interfaceObject.title + "\", you have not used the required width of the scales"; 640 return "On axis \"" + interfaceObject.title + "\", you have not used the required width of the scales";
639 } 641 }
640 return ""; 642 return "";
641 } 643 }
642 sliderRail.addEventListener("mousemove", this); 644 sliderRail.addEventListener("mousemove", this);
645 sliderRail.addEventListener("touchmove", this);
643 Object.defineProperties(this, { 646 Object.defineProperties(this, {
644 "sliderRail": { 647 "sliderRail": {
645 "value": sliderRail 648 "value": sliderRail
646 } 649 }
647 }); 650 });