diff options
Diffstat (limited to 'editor/editor_spin_slider.cpp')
-rw-r--r-- | editor/editor_spin_slider.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index 35fe366526..fbc4a5ee5c 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -109,15 +109,10 @@ void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) { } if (grabbing_spinner) { - if (mm->get_control() || updown_offset != -1) { - set_value(Math::round(get_value())); - if (ABS(grabbing_spinner_dist_cache) > 6) { - set_value(get_value() + SGN(grabbing_spinner_dist_cache)); - grabbing_spinner_dist_cache = 0; - pre_grab_value = get_value(); - } + if (mm->get_control()) { + set_value(Math::round(pre_grab_value + get_step() * grabbing_spinner_dist_cache * 10)); } else { - set_value(pre_grab_value + get_step() * grabbing_spinner_dist_cache * 10); + set_value(pre_grab_value + get_step() * grabbing_spinner_dist_cache); } } } else if (updown_offset != -1) { @@ -233,9 +228,9 @@ void EditorSpinSlider::_notification(int p_what) { draw_style_box(focus, Rect2(Vector2(), get_size())); } - draw_string(font, Vector2(sb->get_offset().x, vofs), label, lc * Color(1, 1, 1, 0.5)); + draw_string(font, Vector2(Math::round(sb->get_offset().x), vofs), label, lc * Color(1, 1, 1, 0.5)); - draw_string(font, Vector2(sb->get_offset().x + string_width + sep, vofs), numstr, fc, number_width); + draw_string(font, Vector2(Math::round(sb->get_offset().x + string_width + sep), vofs), numstr, fc, number_width); if (get_step() == 1) { Ref<Texture> updown2 = get_icon("updown", "SpinBox"); |