# HG changeset patch # User Nicholas Jillings # Date 1452770551 0 # Node ID aad881fa089132260a26f1d514f8b59a3895789a # Parent 63461187a425cfc15f5aae70849ae211a1c702fe discrete.js interface built with correct styling. Example discrete is DCR diff -r 63461187a425 -r aad881fa0891 example_eval/radio_example.xml --- a/example_eval/radio_example.xml Wed Jan 13 16:49:59 2016 +0000 +++ b/example_eval/radio_example.xml Thu Jan 14 11:22:31 2016 +0000 @@ -20,9 +20,11 @@ - -50 - 0 - 50 + (1) Very Annoying + (2) Annoying + (3) Slightly Annoying + (4) Audible but not Annoying + (5) Inaudible diff -r 63461187a425 -r aad881fa0891 interfaces/discrete.css --- a/interfaces/discrete.css Wed Jan 13 16:49:59 2016 +0000 +++ b/interfaces/discrete.css Thu Jan 14 11:22:31 2016 +0000 @@ -44,7 +44,6 @@ } div#scale-holder { - height: inherit; position: absolute; left: 0px; z-index: 2; @@ -78,7 +77,8 @@ div.track-slider-range { float: left; height: 100%; - margin: 0px 10px; + margin: 0px 50px; + position: relative; } div.track-slider-title { @@ -93,6 +93,10 @@ height: 30px; } +input.track-radio { + position: absolute; + margin: 9px 0px; +} button.outside-reference { width:120px; diff -r 63461187a425 -r aad881fa0891 interfaces/discrete.js --- a/interfaces/discrete.js Wed Jan 13 16:49:59 2016 +0000 +++ b/interfaces/discrete.js Thu Jan 14 11:22:31 2016 +0000 @@ -80,7 +80,7 @@ scaleHolder.appendChild(scaleText); var scaleCanvas = document.createElement('canvas'); scaleCanvas.id = "scale-canvas"; - scaleCanvas.style.marginLeft = "100px"; + scaleCanvas.style.marginLeft = "150px"; scaleHolder.appendChild(scaleCanvas); var sliderObjectHolder = document.createElement('div'); sliderObjectHolder.id = 'slider-holder'; @@ -147,7 +147,7 @@ // Find all the audioElements from the audioHolder var label = 0; - var numScales = testState.currentStateMap.interfaces[0].scales.length; + var interfaceScales = testState.currentStateMap.interfaces[0].scales; $(page.audioElements).each(function(index,element){ // Find URL of track // In this jQuery loop, variable 'this' holds the current audioElement. @@ -162,7 +162,7 @@ var node = interfaceContext.createCommentBox(audioObject); // Create a slider per track - var sliderObj = new discreteObject(audioObject,label,numScales); + var sliderObj = new discreteObject(audioObject,label,interfaceScales); sliderBox.appendChild(sliderObj.holder); audioObject.bindInterface(sliderObj); label += 1; @@ -174,12 +174,12 @@ resizeWindow(null); } -function discreteObject(audioObject,label,numOptions) +function discreteObject(audioObject,label,interfaceScales) { // An example node, you can make this however you want for each audioElement. // However, every audioObject (audioEngineContext.audioObject) MUST have an interface object with the following // You attach them by calling audioObject.bindInterface( ) - if (numOptions == null || numOptions == 0) + if (interfaceScales == null || interfaceScales.length == 0) { console.log("WARNING: The discrete radio's are built depending on the number of scale points specified! Ensure you have some specified. Defaulting to 5 for now!"); numOptions = 5; @@ -202,21 +202,29 @@ this.title.className = 'track-slider-title'; this.discreteHolder.className = "track-slider-range"; - this.discreteHolder.style.width = window.innerWidth-420 + 'px'; - for (var i=0; i