Mercurial > hg > webaudioevaluationtool
comparison interfaces/discrete.js @ 3040:5b652438802c
#78 Implemented for discrete
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Tue, 26 Sep 2017 11:52:43 +0100 |
parents | 1620cbee9111 |
children | f888168418ad |
comparison
equal
deleted
inserted
replaced
3039:91d923c51e90 | 3040:5b652438802c |
---|---|
446 } | 446 } |
447 | 447 |
448 function drawScale() { | 448 function drawScale() { |
449 var interfaceObj = testState.currentStateMap.interfaces[0]; | 449 var interfaceObj = testState.currentStateMap.interfaces[0]; |
450 var scales = testState.currentStateMap.interfaces[0].scales; | 450 var scales = testState.currentStateMap.interfaces[0].scales; |
451 var ticks = specification.interfaces.options.concat(interfaceObj.options).find(function (a) { | |
452 return (a.type == "show" && a.name == "ticks"); | |
453 }); | |
454 if (ticks !== undefined) { | |
455 ticks = true; | |
456 } else { | |
457 ticks = false; | |
458 } | |
451 scales = scales.sort(function (a, b) { | 459 scales = scales.sort(function (a, b) { |
452 return a.position - b.position; | 460 return a.position - b.position; |
453 }); | 461 }); |
454 var canvas = document.getElementById('scale-canvas'); | 462 var canvas = document.getElementById('scale-canvas'); |
455 var ctx = canvas.getContext("2d"); | 463 var ctx = canvas.getContext("2d"); |
466 posPix = 1; | 474 posPix = 1; |
467 } | 475 } |
468 if (posPix >= width) { | 476 if (posPix >= width) { |
469 posPix = width - 1; | 477 posPix = width - 1; |
470 } | 478 } |
471 ctx.moveTo(posPix, 0); | 479 if (ticks) { |
472 ctx.lineTo(posPix, height); | 480 ctx.moveTo(posPix, 0); |
473 ctx.stroke(); | 481 ctx.lineTo(posPix, height); |
482 ctx.stroke(); | |
483 } | |
474 | 484 |
475 var text = document.createElement('div'); | 485 var text = document.createElement('div'); |
476 text.align = "center"; | 486 text.align = "center"; |
477 var textC = document.createElement('span'); | 487 var textC = document.createElement('span'); |
478 textC.textContent = scale.text; | 488 textC.textContent = scale.text; |