diff options
author | Daniel J. Ramirez <djrmuv@gmail.com> | 2017-07-18 01:32:25 -0500 |
---|---|---|
committer | Daniel J. Ramirez <djrmuv@gmail.com> | 2017-07-18 01:50:01 -0500 |
commit | 79d85b7ff67e6edc700336ac112dad35e07fe102 (patch) | |
tree | fa7ce7f2d4ff6680a4d56e17e858819c6e397678 /scene | |
parent | 69a4ea34c4f630c1ca353a135d768872bb54cd41 (diff) |
Fixed slider centering when using SIZE_EXPAND_FILL.
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/slider.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp index c84608ef2e..9ba17ce34f 100644 --- a/scene/gui/slider.cpp +++ b/scene/gui/slider.cpp @@ -167,7 +167,8 @@ void Slider::_notification(int p_what) { if (orientation == VERTICAL) { - style->draw(ci, Rect2i(Point2i(), Size2i(style->get_minimum_size().width + style->get_center_size().width, size.height))); + int widget_width = style->get_minimum_size().width + style->get_center_size().width; + style->draw(ci, Rect2i(Point2i(size.width / 2 - widget_width / 2, 0), Size2i(widget_width, size.height))); /* if (mouse_inside||has_focus()) focus->draw(ci,Rect2i(Point2i(),Size2i(style->get_minimum_size().width+style->get_center_size().width,size.height))); @@ -183,7 +184,9 @@ void Slider::_notification(int p_what) { } grabber->draw(ci, Point2i(size.width / 2 - grabber->get_size().width / 2, size.height - get_as_ratio() * areasize - grabber->get_size().height)); } else { - style->draw(ci, Rect2i(Point2i(), Size2i(size.width, style->get_minimum_size().height + style->get_center_size().height))); + + int widget_height = style->get_minimum_size().height + style->get_center_size().height; + style->draw(ci, Rect2i(Point2i(0, size.height / 2 - widget_height / 2), Size2i(size.width, widget_height))); /* if (mouse_inside||has_focus()) focus->draw(ci,Rect2i(Point2i(),Size2i(size.width,style->get_minimum_size().height+style->get_center_size().height))); |