diff options
author | volzhs <volzhs@gmail.com> | 2016-11-25 03:15:42 +0900 |
---|---|---|
committer | volzhs <volzhs@gmail.com> | 2016-11-25 03:15:42 +0900 |
commit | 4df33cbcb391f00216851f54a7db9acb52291335 (patch) | |
tree | 4af3d80764b767197994ca6f1e97bddbec8fe449 /scene | |
parent | f18470c199ae79cc7a1e6e952780fb0899b74c8e (diff) |
Prevent Spinbox value update while not focused or disabled
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/spin_box.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 9417c25424..11a4adbf7b 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -92,6 +92,9 @@ void SpinBox::_range_click_timeout() { void SpinBox::_input_event(const InputEvent& p_event) { + if (!is_editable()) { + return; + } if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.pressed) { const InputEventMouseButton &mb=p_event.mouse_button; @@ -110,19 +113,24 @@ void SpinBox::_input_event(const InputEvent& p_event) { range_click_timer->set_one_shot(true); range_click_timer->start(); + line_edit->grab_focus(); } break; case BUTTON_RIGHT: { set_val( (up?get_max():get_min()) ); - + line_edit->grab_focus(); } break; case BUTTON_WHEEL_UP: { - - set_val( get_val() + get_step() ); + if (line_edit->has_focus()) { + set_val( get_val() + get_step() ); + accept_event(); + } } break; case BUTTON_WHEEL_DOWN: { - - set_val( get_val() - get_step() ); + if (line_edit->has_focus()) { + set_val( get_val() - get_step() ); + accept_event(); + } } break; } } |