summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/center_container.cpp6
-rw-r--r--scene/gui/control.cpp5
-rw-r--r--scene/gui/graph_edit.cpp7
-rw-r--r--scene/gui/scroll_container.cpp12
4 files changed, 30 insertions, 0 deletions
diff --git a/scene/gui/center_container.cpp b/scene/gui/center_container.cpp
index 9f4353ceb6..64d6885bc8 100644
--- a/scene/gui/center_container.cpp
+++ b/scene/gui/center_container.cpp
@@ -54,7 +54,13 @@ Size2 CenterContainer::get_minimum_size() const {
void CenterContainer::set_use_top_left(bool p_enable) {
+ if (use_top_left == p_enable) {
+ return;
+ }
+
use_top_left = p_enable;
+
+ minimum_size_changed();
queue_sort();
}
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 9a67745e0d..4f499af186 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2682,6 +2682,11 @@ Vector2 Control::get_pivot_offset() const {
void Control::set_scale(const Vector2 &p_scale) {
data.scale = p_scale;
+ // Avoid having 0 scale values, can lead to errors in physics and rendering.
+ if (data.scale.x == 0)
+ data.scale.x = CMP_EPSILON;
+ if (data.scale.y == 0)
+ data.scale.y = CMP_EPSILON;
update();
_notify_transform();
}
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index be465751b6..42bb8023f2 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -200,6 +200,13 @@ void GraphEdit::_update_scroll() {
else
v_scroll->show();
+ Size2 hmin = h_scroll->get_combined_minimum_size();
+ Size2 vmin = v_scroll->get_combined_minimum_size();
+
+ // Avoid scrollbar overlapping.
+ h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, v_scroll->is_visible() ? -vmin.width : 0);
+ v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, h_scroll->is_visible() ? -hmin.height : 0);
+
set_block_minimum_size_adjust(false);
if (!awaiting_scroll_offset_update) {
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index dc1183df74..4712f4cb9d 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -420,6 +420,9 @@ void ScrollContainer::update_scrollbars() {
v_scroll->hide();
scroll.y = 0;
+
+ // modify the horizontal scrollbar's right anchor to fill the container's width
+ h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
} else {
v_scroll->show();
@@ -431,12 +434,18 @@ void ScrollContainer::update_scrollbars() {
}
scroll.y = v_scroll->get_value();
+
+ // modify the horizontal scrollbar's right anchor to stop at the left of the vertical scrollbar
+ h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -vmin.width);
}
if (hide_scroll_h) {
h_scroll->hide();
scroll.x = 0;
+
+ // modify the vertical scrollbar's bottom anchor to fill the container's height
+ v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
} else {
h_scroll->show();
@@ -448,6 +457,9 @@ void ScrollContainer::update_scrollbars() {
}
scroll.x = h_scroll->get_value();
+
+ // modify the vertical scrollbar's bottom anchor to stop at the top of the horizontal scrollbar
+ v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -hmin.height);
}
}