changeset 3039:91d923c51e90

#78 Implemented for horizontal
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Tue, 26 Sep 2017 11:51:42 +0100
parents 4927dc84e86d
children 5b652438802c
files interfaces/horizontal-sliders.js tests/examples/horizontal_example.xml
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/interfaces/horizontal-sliders.js	Tue Sep 26 11:49:49 2017 +0100
+++ b/interfaces/horizontal-sliders.js	Tue Sep 26 11:51:42 2017 +0100
@@ -398,6 +398,14 @@
 function drawScale() {
     var interfaceObj = testState.currentStateMap.interfaces[0];
     var scales = testState.currentStateMap.interfaces[0].scales;
+    var ticks = specification.interfaces.options.concat(interfaceObj.options).find(function (a) {
+        return (a.type == "show" && a.name == "ticks");
+    });
+    if (ticks !== undefined) {
+        ticks = true;
+    } else {
+        ticks = false;
+    }
     scales = scales.sort(function (a, b) {
         return a.position - b.position;
     });
@@ -418,9 +426,11 @@
         if (posPix >= width) {
             posPix = width - 1;
         }
-        ctx.moveTo(posPix, 0);
-        ctx.lineTo(posPix, height);
-        ctx.stroke();
+        if (ticks) {
+            ctx.moveTo(posPix, 0);
+            ctx.lineTo(posPix, height);
+            ctx.stroke();
+        }
 
         var text = document.createElement('div');
         text.align = "center";
--- a/tests/examples/horizontal_example.xml	Tue Sep 26 11:49:49 2017 +0100
+++ b/tests/examples/horizontal_example.xml	Tue Sep 26 11:51:42 2017 +0100
@@ -17,6 +17,7 @@
                 <interfaceoption type="show" name="page-count" />
                 <interfaceoption type="show" name="volume" />
                 <interfaceoption type="show" name="comments" />
+                <interfaceoption type="show" name="ticks" />
             </interface>
         </setup>
         <page id='test-0' hostURL="media/example/" randomiseOrder='true' repeatCount='0' loop='true' loudness="-12">