Mercurial > hg > webaudioevaluationtool
changeset 3043:9d4f0934cf34
Fix #95
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Tue, 26 Sep 2017 15:13:12 +0100 |
parents | fb29981a2fad |
children | 2020be3c592c |
files | js/core.js |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 = '<span>Master Volume Control</span>';