From c6824ec09d3c03f3970c14bcef449195049ee52c Mon Sep 17 00:00:00 2001 From: Volka <77184943+volkathemartian@users.noreply.github.com> Date: Fri, 15 Jan 2021 00:42:15 -0500 Subject: [PATCH] Fix unintended SpinBox mouse capture (cherry picked from commit ae2cf8eb382db2b6c8d597f0015db976eb433500) --- scene/gui/spin_box.cpp | 1 - scene/gui/spin_box.h | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 7b48c6d5a6c..63fcca527ff 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -300,7 +300,6 @@ SpinBox::SpinBox() { line_edit->connect("text_entered", this, "_text_entered", Vector(), CONNECT_DEFERRED); line_edit->connect("focus_exited", this, "_line_edit_focus_exit", Vector(), CONNECT_DEFERRED); line_edit->connect("gui_input", this, "_line_edit_input"); - drag.enabled = false; range_click_timer = memnew(Timer); range_click_timer->connect("timeout", this, "_range_click_timeout"); diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h index 8529da638b4..e9be0badf39 100644 --- a/scene/gui/spin_box.h +++ b/scene/gui/spin_box.h @@ -53,11 +53,11 @@ class SpinBox : public Range { void _line_edit_input(const Ref &p_event); struct Drag { - float base_val; - bool allowed; - bool enabled; + float base_val = 0; + bool allowed = false; + bool enabled = false; Vector2 capture_pos; - float diff_y; + float diff_y = 0; } drag; void _line_edit_focus_exit();