|
@@ -295,15 +295,19 @@ void ScrollBar::_notification(int p_what) {
|
|
|
Rect2 grabber_rect;
|
|
Rect2 grabber_rect;
|
|
|
|
|
|
|
|
if (orientation == HORIZONTAL) {
|
|
if (orientation == HORIZONTAL) {
|
|
|
|
|
+ int padding_top = MAX(theme_cache.padding_top, 0);
|
|
|
|
|
+ int padding_bottom = MAX(theme_cache.padding_bottom, 0);
|
|
|
grabber_rect.size.width = get_grabber_size();
|
|
grabber_rect.size.width = get_grabber_size();
|
|
|
- grabber_rect.size.height = get_size().height;
|
|
|
|
|
- grabber_rect.position.y = 0;
|
|
|
|
|
|
|
+ grabber_rect.size.height = get_size().height - padding_top - padding_bottom;
|
|
|
|
|
+ grabber_rect.position.y = padding_top;
|
|
|
grabber_rect.position.x = get_grabber_offset() + decr->get_width() + theme_cache.scroll_style->get_margin(SIDE_LEFT);
|
|
grabber_rect.position.x = get_grabber_offset() + decr->get_width() + theme_cache.scroll_style->get_margin(SIDE_LEFT);
|
|
|
} else {
|
|
} else {
|
|
|
- grabber_rect.size.width = get_size().width;
|
|
|
|
|
|
|
+ int padding_left = MAX(theme_cache.padding_left, 0);
|
|
|
|
|
+ int padding_right = MAX(theme_cache.padding_right, 0);
|
|
|
|
|
+ grabber_rect.size.width = get_size().width - padding_left - padding_right;
|
|
|
grabber_rect.size.height = get_grabber_size();
|
|
grabber_rect.size.height = get_grabber_size();
|
|
|
grabber_rect.position.y = get_grabber_offset() + decr->get_height() + theme_cache.scroll_style->get_margin(SIDE_TOP);
|
|
grabber_rect.position.y = get_grabber_offset() + decr->get_height() + theme_cache.scroll_style->get_margin(SIDE_TOP);
|
|
|
- grabber_rect.position.x = 0;
|
|
|
|
|
|
|
+ grabber_rect.position.x = padding_left;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
grabber->draw(ci, grabber_rect);
|
|
grabber->draw(ci, grabber_rect);
|
|
@@ -488,7 +492,10 @@ Size2 ScrollBar::get_minimum_size() const {
|
|
|
Size2 minsize;
|
|
Size2 minsize;
|
|
|
|
|
|
|
|
if (orientation == VERTICAL) {
|
|
if (orientation == VERTICAL) {
|
|
|
|
|
+ int padding_left = MAX(theme_cache.padding_left, 0);
|
|
|
|
|
+ int padding_right = MAX(theme_cache.padding_right, 0);
|
|
|
minsize.width = MAX(incr->get_size().width, bg->get_minimum_size().width);
|
|
minsize.width = MAX(incr->get_size().width, bg->get_minimum_size().width);
|
|
|
|
|
+ minsize.width += padding_left + padding_right;
|
|
|
minsize.height += incr->get_size().height;
|
|
minsize.height += incr->get_size().height;
|
|
|
minsize.height += decr->get_size().height;
|
|
minsize.height += decr->get_size().height;
|
|
|
minsize.height += bg->get_minimum_size().height;
|
|
minsize.height += bg->get_minimum_size().height;
|
|
@@ -496,7 +503,10 @@ Size2 ScrollBar::get_minimum_size() const {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (orientation == HORIZONTAL) {
|
|
if (orientation == HORIZONTAL) {
|
|
|
|
|
+ int padding_top = MAX(theme_cache.padding_top, 0);
|
|
|
|
|
+ int padding_bottom = MAX(theme_cache.padding_bottom, 0);
|
|
|
minsize.height = MAX(incr->get_size().height, bg->get_minimum_size().height);
|
|
minsize.height = MAX(incr->get_size().height, bg->get_minimum_size().height);
|
|
|
|
|
+ minsize.height += padding_top + padding_bottom;
|
|
|
minsize.width += incr->get_size().width;
|
|
minsize.width += incr->get_size().width;
|
|
|
minsize.width += decr->get_size().width;
|
|
minsize.width += decr->get_size().width;
|
|
|
minsize.width += bg->get_minimum_size().width;
|
|
minsize.width += bg->get_minimum_size().width;
|
|
@@ -669,3 +679,13 @@ ScrollBar::ScrollBar(Orientation p_orientation) {
|
|
|
|
|
|
|
|
ScrollBar::~ScrollBar() {
|
|
ScrollBar::~ScrollBar() {
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+void VScrollBar::_bind_methods() {
|
|
|
|
|
+ BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, VScrollBar, padding_left);
|
|
|
|
|
+ BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, VScrollBar, padding_right);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void HScrollBar::_bind_methods() {
|
|
|
|
|
+ BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, HScrollBar, padding_top);
|
|
|
|
|
+ BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, HScrollBar, padding_bottom);
|
|
|
|
|
+}
|