sliders: [restore] prevent duplicates osc sends on drag

This commit is contained in:
jean-emmanuel 2016-09-21 17:35:49 +02:00
parent cba57fc6c4
commit 4dd837b565
2 changed files with 5 additions and 3 deletions

View file

@ -147,7 +147,11 @@ _sliders_base.prototype.valueToPercent = function(value) {
_sliders_base.prototype.setValue = function(v,send,sync, dragged) {
if (typeof v != 'number') return
this.value = roundTo(clip(Math.round(v*this.roundFactor)/this.roundFactor,[this.rangeValsMin,this.rangeValsMax]),this.widgetData.precision)
var value = roundTo(clip(Math.round(v*this.roundFactor)/this.roundFactor,[this.rangeValsMin,this.rangeValsMax]),this.widgetData.precision)
if (dragged && this.value == value) send = false
this.value = value
if (!dragged) this.percent = this.valueToPercent(this.value)

View file

@ -133,8 +133,6 @@ Fader.prototype.dragHandle = function(e, data) {
this.percent + ( data.speedX/(this.width - this.margin * PXSCALE * 2)) * 100:
this.percent + (-data.speedY/(this.height - this.margin * PXSCALE * 2)) * 100
this.percent = this.percent,[0,100]
this.setValue(this.percentToValue(this.percent), true, true, true)
}