Fixed wrong mouse position after releasing grabber

This commit is contained in:
kobewi 2021-05-04 14:02:54 +02:00
parent 4e7ca279fc
commit dcf306f72d

View file

@ -70,7 +70,6 @@ void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) {
grabbing_spinner_dist_cache = 0; grabbing_spinner_dist_cache = 0;
pre_grab_value = get_value(); pre_grab_value = get_value();
grabbing_spinner = false; grabbing_spinner = false;
grabbing_spinner_mouse_pos = Input::get_singleton()->get_mouse_position();
} }
} else { } else {
if (grabbing_spinner_attempt) { if (grabbing_spinner_attempt) {
@ -283,6 +282,8 @@ void EditorSpinSlider::_notification(int p_what) {
Rect2 grabber_rect = Rect2(ofs + gofs, svofs + 1, grabber_w, 2 * EDSCALE); Rect2 grabber_rect = Rect2(ofs + gofs, svofs + 1, grabber_w, 2 * EDSCALE);
draw_rect(grabber_rect, c); draw_rect(grabber_rect, c);
grabbing_spinner_mouse_pos = get_global_position() + grabber_rect.position + grabber_rect.size * 0.5;
bool display_grabber = (mouse_over_spin || mouse_over_grabber) && !grabbing_spinner && !value_input_popup->is_visible(); bool display_grabber = (mouse_over_spin || mouse_over_grabber) && !grabbing_spinner && !value_input_popup->is_visible();
if (grabber->is_visible() != display_grabber) { if (grabber->is_visible() != display_grabber) {
if (display_grabber) { if (display_grabber) {