diff --git a/CHANGELOG.md b/CHANGELOG.md index 96c37158..aff99d78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - widgets - dropdown: allow resubmitting the same value + - switch: allow resubmitting the same value - plot: missing `logScaleX` and `logScaleY` properties - xy/multixy: add `axisLock` property; allow locking one the axis by holding `Shift` while dragging if `axisLock` is not set, bypasses it otherwise. - knob/fader/range: add `colorKnob` property diff --git a/src/client/widgets/basics/switch.js b/src/client/widgets/basics/switch.js index 8cafedd4..2b8a8bbf 100644 --- a/src/client/widgets/basics/switch.js +++ b/src/client/widgets/basics/switch.js @@ -57,7 +57,7 @@ class Switch extends MenuBase { this.parseValues() - var dragCallback = (e, touchFix)=>{ + var dragCallback = (e, slide)=>{ var index = 0, node = e.target @@ -66,7 +66,7 @@ class Switch extends MenuBase { node = e.firstTarget } - if (touchFix && e.isTouch) { + if (slide && e.isTouch) { // special traversing touch fix node = document.elementFromPoint(e.clientX, e.clientY) } @@ -81,7 +81,9 @@ class Switch extends MenuBase { var value = this.values[index] - if (value !== this.value || this.value === undefined) this.setValue(value, {sync: true, send: true}) + if (slide && value === this.value) return + + this.setValue(value, {sync: true, send: true}) }