mirror of
https://github.com/blender/blender
synced 2026-09-26 16:15:47 +03:00
Fix: Slider not respecting bounds when snapping to increments
The issue was that the clamping to the bounds happened before the rounding to the increment step. In the reported case this led to a divide by 0 error. The fix is to do the increment first, then the clamp to bounds. This was reported by Raymond Luc on #117287 Pull Request: https://projects.blender.org/blender/blender/pulls/119367
This commit is contained in:
parent
ac8835f18b
commit
1e70c29320
1 changed files with 4 additions and 4 deletions
|
|
@ -377,6 +377,10 @@ static void slider_update_factor(tSlider *slider, const wmEvent *event)
|
|||
slider->factor = slider->raw_factor;
|
||||
copy_v2fl_v2i(slider->last_cursor, event->xy);
|
||||
|
||||
if (slider->increments) {
|
||||
slider->factor = round(slider->factor * 10) / 10;
|
||||
}
|
||||
|
||||
if (!slider->overshoot) {
|
||||
slider->factor = clamp_f(slider->factor, slider->factor_bounds[0], slider->factor_bounds[1]);
|
||||
}
|
||||
|
|
@ -388,10 +392,6 @@ static void slider_update_factor(tSlider *slider, const wmEvent *event)
|
|||
slider->factor = min_ff(slider->factor, slider->factor_bounds[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if (slider->increments) {
|
||||
slider->factor = round(slider->factor * 10) / 10;
|
||||
}
|
||||
}
|
||||
|
||||
tSlider *ED_slider_create(bContext *C)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue