comparison core.js @ 675:7e73d1cdcff8

Refined metric collection. Rating now correct. Slider scale now fully bounded
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Mon, 13 Apr 2015 10:40:37 +0100
parents 436db2f29f73
children e604ee22185b
comparison
equal deleted inserted replaced
674:436db2f29f73 675:7e73d1cdcff8
297 */ 297 */
298 this.engine = engine; 298 this.engine = engine;
299 this.lastClicked = -1; 299 this.lastClicked = -1;
300 this.data = -1; 300 this.data = -1;
301 301
302 this.initialiseTest = function()
303 {
304 var sliders = document.getElementsByClassName('track-slider');
305 for (var i=0; i<sliders.length; i++)
306 {
307 engine.audioObjects[i].metric.initialised(convSliderPosToRate(i));
308 }
309 };
310
302 this.sliderMoveStart = function(id) 311 this.sliderMoveStart = function(id)
303 { 312 {
304 if (this.data == -1) 313 if (this.data == -1)
305 { 314 {
306 this.data = id; 315 this.data = id;
312 this.sliderMoved = function() 321 this.sliderMoved = function()
313 { 322 {
314 var time = engine.timer.getTestTime(); 323 var time = engine.timer.getTestTime();
315 var id = this.data; 324 var id = this.data;
316 this.data = -1; 325 this.data = -1;
317 var sliderObj = document.getElementsByClassName('track-slider')[id]; 326 var position = convSliderPosToRate(id);
318 var position = Number(sliderObj.style.left.substr(0,sliderObj.style.left.length-2));
319 if (engine.timer.testStarted) 327 if (engine.timer.testStarted)
320 { 328 {
321 engine.audioObjects[id].metric.moved(time,position); 329 engine.audioObjects[id].metric.moved(time,position);
322 } else {
323 engine.audioObjects[id].metric.initialised(position);
324 } 330 }
325 }; 331 };
326 332
327 this.sliderPlayed = function(id) 333 this.sliderPlayed = function(id)
328 { 334 {
345 * Used only inside the audioObjects object. 351 * Used only inside the audioObjects object.
346 */ 352 */
347 353
348 this.listenedTimer = 0; 354 this.listenedTimer = 0;
349 this.listenStart = 0; 355 this.listenStart = 0;
350 this.initialPosition = 0; 356 this.initialPosition = -1;
351 this.movementTracker = []; 357 this.movementTracker = [];
352 this.wasListenedTo = false; 358 this.wasListenedTo = false;
353 this.wasMoved = false; 359 this.wasMoved = false;
354 this.hasComments = false; 360 this.hasComments = false;
355 361
356 this.initialised = function(position) 362 this.initialised = function(position)
357 { 363 {
358 this.initialPosition = position; 364 if (this.initialPosition == -1) {
365 this.initialPosition = position;
366 }
359 }; 367 };
360 368
361 this.moved = function(time,position) 369 this.moved = function(time,position)
362 { 370 {
363 this.wasMoved = true; 371 this.wasMoved = true;