Commit 333e3825 authored by chriseth's avatar chriseth

Trigger slider events while moving.

parent 8b8cacdf
...@@ -11,6 +11,8 @@ function Slider (_traceManager) { ...@@ -11,6 +11,8 @@ function Slider (_traceManager) {
this.max this.max
this.disabled = true this.disabled = true
this.view this.view
this.previousValue = null
} }
Slider.prototype.render = function () { Slider.prototype.render = function () {
...@@ -23,8 +25,8 @@ Slider.prototype.render = function () { ...@@ -23,8 +25,8 @@ Slider.prototype.render = function () {
min=0 min=0
max=${this.max} max=${this.max}
value=0 value=0
onkeyup=${function () { self.onChange() }} onchange=${function () { self.onChange() }}
onmouseup=${function () { self.onChange() }} oninput=${function () { self.onChange() }}
disabled=${this.disabled} /> disabled=${this.disabled} />
</div>` </div>`
if (!this.view) { if (!this.view) {
...@@ -43,8 +45,10 @@ Slider.prototype.init = function (length) { ...@@ -43,8 +45,10 @@ Slider.prototype.init = function (length) {
} }
Slider.prototype.onChange = function (event) { Slider.prototype.onChange = function (event) {
var value = document.getElementById('slider').value var value = parseInt(document.getElementById('slider').value)
this.trigger('moved', [parseInt(value)]) if (value === this.previousValue) return
this.previousValue = value
this.trigger('moved', [value])
} }
Slider.prototype.setValue = function (value) { Slider.prototype.setValue = function (value) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment