diff options
author | mawenzy <mawenzy@users.noreply.github.com> | 2019-04-09 21:58:19 +0200 |
---|---|---|
committer | mawenzy <mawenzy@users.noreply.github.com> | 2019-04-09 21:58:19 +0200 |
commit | e2e8457ca61dee58dc5edc47593fd628bacd1e57 (patch) | |
tree | c5c57de7aa95a4ee1dd34f25a8fe4347a7b0c978 | |
parent | 9c3ddf05cb9c59817d885e9daca6e8f61c89dc97 (diff) |
Fix #24124, Slider control size
-rw-r--r-- | scene/gui/slider.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp index eb04b85931..028ca41cbf 100644 --- a/scene/gui/slider.cpp +++ b/scene/gui/slider.cpp @@ -34,8 +34,15 @@ Size2 Slider::get_minimum_size() const { Ref<StyleBox> style = get_stylebox("slider"); - Size2i ms = style->get_minimum_size() + style->get_center_size(); - return ms; + Size2i ss = style->get_minimum_size() + style->get_center_size(); + + Ref<Texture> grabber = get_icon("grabber"); + Size2i rs = grabber->get_size(); + + if (orientation == HORIZONTAL) + return Size2i(ss.width, MAX(ss.height, rs.height)); + else + return Size2i(MAX(ss.width, rs.width), ss.height); } void Slider::_gui_input(Ref<InputEvent> p_event) { @@ -134,7 +141,11 @@ void Slider::_gui_input(Ref<InputEvent> p_event) { void Slider::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_THEME_CHANGED: { + minimum_size_changed(); + update(); + } break; case NOTIFICATION_MOUSE_ENTER: { mouse_inside = true; |