# HG changeset patch # User Nicholas Jillings # Date 1490702669 -3600 # Node ID 2395223deef2277b2216d134dd8bf1d57c8e7050 # Parent 4125da39666e2e405d1661625bb6773403d4cfcc# Parent a513533565cf5283dce2cfa229fdee1a8c2328c1 Merge branch 'master' into vnext # Conflicts: # js/core.js diff -r 4125da39666e -r 2395223deef2 css/core.css --- a/css/core.css Mon Mar 20 16:22:11 2017 +0000 +++ b/css/core.css Tue Mar 28 13:04:29 2017 +0100 @@ -211,17 +211,16 @@ height: 40px; } input#master-volume-control { - width: 200px; + width: 190px; height: 25px; float: left; margin: 0px; padding: 0px; } span#master-volume-feedback { - width: 45px; height: 25px; - margin-left: 5px; - float: left; + margin: 0px 5px; + float: right; } div.error-colour { background-color: #FF8F8F; diff -r 4125da39666e -r 2395223deef2 js/core.js --- a/js/core.js Mon Mar 20 16:22:11 2017 +0000 +++ b/js/core.js Tue Mar 28 13:04:29 2017 +0100 @@ -3012,13 +3012,22 @@ this.slider.max = 12; this.slider.value = 0; this.slider.step = 1; - this.slider.onmousemove = function (event) { - interfaceContext.volume.valueDB = event.currentTarget.value; - interfaceContext.volume.valueLin = decibelToLinear(interfaceContext.volume.valueDB); - interfaceContext.volume.valueText.textContent = interfaceContext.volume.valueDB + 'dB'; - audioEngineContext.outputGain.gain.value = interfaceContext.volume.valueLin; - }; - this.slider.onmouseup = function (event) { + this.handleEvent = function (event) { + if (event.type == "mousemove") { + this.valueDB = Number(this.slider.value); + this.valueLin = decibelToLinear(this.valueDB); + this.valueText.textContent = this.valueDB + 'dB'; + audioEngineContext.outputGain.gain.value = this.valueLin; + } else if (event.type == "mouseup") { + this.onmouseup(); + } + this.slider.value = this.valueDB; + + if (event.stopPropagation) { + event.stopPropagation(); + } + } + this.onmouseup = function () { var storePoint = testState.currentStore.XMLDOM.getElementsByTagName('metric')[0].getAllElementsByName('volumeTracker'); if (storePoint.length === 0) { storePoint = storage.document.createElement('metricresult'); @@ -3029,10 +3038,12 @@ } var node = storage.document.createElement('movement'); node.setAttribute('test-time', audioEngineContext.timer.getTestTime()); - node.setAttribute('volume', interfaceContext.volume.valueDB); + node.setAttribute('volume', this.valueDB); node.setAttribute('format', 'dBFS'); storePoint.appendChild(node); - }; + } + this.slider.addEventListener("mousemove", this); + this.root.addEventListener("mouseup", this); var title = document.createElement('div'); title.innerHTML = 'Master Volume Control';