Skip to content

Commit a6e20c6

Browse files
ibdafnajtpio
authored andcommitted
Add dragging behaviour - selection slider
1 parent 305cdb1 commit a6e20c6

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

ipywidgets/widgets/widget_selection.py

+4
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,8 @@ class SelectionSlider(_SelectionNonempty):
573573
help="Display the current selected label next to the slider").tag(sync=True)
574574
continuous_update = Bool(True,
575575
help="Update the value of the widget as the user is holding the slider.").tag(sync=True)
576+
behaviour = CaselessStrEnum(values=['drag-tap', 'drag-snap', 'tap', 'drag', 'snap'],
577+
default_value='drag-tap', help="Slider dragging behaviour.").tag(sync=True)
576578

577579
style = InstanceDict(SliderStyle).tag(sync=True, **widget_serialization)
578580

@@ -627,3 +629,5 @@ def _validate_index(self, proposal):
627629
help="Update the value of the widget as the user is holding the slider.").tag(sync=True)
628630

629631
style = InstanceDict(SliderStyle).tag(sync=True, **widget_serialization)
632+
behaviour = CaselessStrEnum(values=['drag-tap', 'drag-snap', 'tap', 'drag', 'snap'],
633+
default_value='drag-tap', help="Slider dragging behaviour.").tag(sync=True)

packages/controls/src/widget_selection.ts

+2
Original file line numberDiff line numberDiff line change
@@ -746,10 +746,12 @@ export class SelectionSliderView extends DescriptionView {
746746
const min = 0;
747747
const max = labels.length - 1;
748748
const orientation = this.model.get('orientation');
749+
const behaviour = this.model.get('behaviour');
749750

750751
noUiSlider.create(this.$slider, {
751752
start: this.model.get('index'),
752753
connect: true,
754+
behaviour: behaviour,
753755
range: {
754756
min: min,
755757
max: max,

0 commit comments

Comments
 (0)