# HG changeset patch # User Nicholas Jillings # Date 1506435192 -3600 # Node ID 9d4f0934cf34d2af1e382fec6e98bf1a40b451c9 # Parent fb29981a2fada82d249e1c30feabd1f6d674e596 Fix #95 diff -r fb29981a2fad -r 9d4f0934cf34 js/core.js --- a/js/core.js Tue Sep 26 14:45:09 2017 +0100 +++ b/js/core.js Tue Sep 26 15:13:12 2017 +0100 @@ -3062,16 +3062,21 @@ volume.slider.max = 12; volume.slider.value = 0; volume.slider.step = 1; + volume.captured = false; volume.handleEvent = function (event) { - if (event.type == "mousemove") { + if (event.type == "mousedown") { + volume.captured = true; + } else if (event.type == "mousemove" && volume.captured) { this.valueDB = Number(this.slider.value); this.valueLin = decibelToLinear(this.valueDB); this.valueText.textContent = this.valueDB + 'dB'; audioEngineContext.outputGain.gain.value = this.valueLin; + console.log(this.valueDB); } else if (event.type == "mouseup") { + volume.captured = false; this.onmouseup(); } - this.slider.value = this.valueDB; + //this.slider.value = this.valueDB; if (event.stopPropagation) { event.stopPropagation(); @@ -3094,6 +3099,7 @@ }; volume.slider.addEventListener("mousemove", volume); volume.root.addEventListener("mouseup", volume); + volume.root.addEventListener("mousedown", volume); var title = document.createElement('div'); title.innerHTML = 'Master Volume Control';