更改鼠标单击滚动的滑块跳转大小

Changing the size of slider jumps for mouse click scrolls

当用户点击滑块的空space(滑动space)时,滑块跳转。虽然我已经设置了 31 步(通过设置滑块步长),但当鼠标点击滑块的空 spaces 时仍然只有 3 次跳跃,这会产生很大的变化 [每次点击时 21 11 1 个值]。

我想在单击滑块的空白 space 时缩小 shifts/jumps。图片说明空 space as 跳转。我找不到在滑块设置中设置此功能的任何选项。

我有以下设置

ihist=[0:0.0005:0.015];
colors=1:0.01:1.25;
handles.output = hObject;
% % Update slider1 value
guidata(hObject, handles);
maxSliderValue = length(ihist);
minSliderValue = 1;
theRange = maxSliderValue - minSliderValue;
steps = [1/theRange, 10/theRange];
set(handles.slider1, 'SliderStep', steps,'value',1);

由于本例中的总步数为 31,因此滑块不应完全移动 3 steps/clicks。

您可能误解了 SliderStep 设置的工作原理。引用文档:

Slider step size, specified as the array, [minorstep majorstep]. This property controls the magnitude of the slider value change when the user clicks the arrow buttons or the slider trough (slider channel):

  • minorstep is the fraction of the slider range by which the Value property increases or decreases when the user clicks one of the arrow buttons.

  • majorstep is the fraction of the slider range by which the Value property increases or decreases when the user clicks the slider trough.

在您的示例中,[minorstep majorstep][1/theRange, 10/theRange](或 [1/30 1/3] 数字),这意味着您需要正好 (1/3)^-1 == 3 次点击才能遍历整个范围。如果您希望需要 30 次点击(请注意,您的间隔比滑块位置 |--|--| 少 1 次),也将 majorstep 更改为 1/theRange