summaryrefslogtreecommitdiffstats
path: root/editor/plugins/texture_region_editor_plugin.cpp
diff options
context:
space:
mode:
authorMichael Alexsander <michaelalexsander@protonmail.com>2020-01-14 08:25:55 -0300
committerMichael Alexsander <michaelalexsander@protonmail.com>2020-01-14 08:25:55 -0300
commite69593842e1275922f36f2fa4d3d8a47ec2d600f (patch)
treed2aea6dc1c24976998eb20040be4889e2732b54e /editor/plugins/texture_region_editor_plugin.cpp
parentdbbfade584ed5f1ecedd8ce78552e90df66a538d (diff)
downloadredot-engine-e69593842e1275922f36f2fa4d3d8a47ec2d600f.tar.gz
Fix more scrollbar anchorings
Diffstat (limited to 'editor/plugins/texture_region_editor_plugin.cpp')
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 13faeb0edb..8672e936e0 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -178,6 +178,7 @@ void TextureRegionEditor::_region_draw() {
scroll_rect.size += scroll_margin * 2;
updating_scroll = true;
+
hscroll->set_min(scroll_rect.position.x);
hscroll->set_max(scroll_rect.position.x + scroll_rect.size.x);
if (ABS(scroll_rect.position.x - (scroll_rect.position.x + scroll_rect.size.x)) <= scroll_margin.x) {
@@ -198,6 +199,14 @@ void TextureRegionEditor::_region_draw() {
vscroll->set_page(scroll_margin.y);
vscroll->set_value(draw_ofs.y);
}
+
+ Size2 hmin = hscroll->get_combined_minimum_size();
+ Size2 vmin = vscroll->get_combined_minimum_size();
+
+ // Avoid scrollbar overlapping.
+ hscroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, vscroll->is_visible() ? -vmin.width : 0);
+ vscroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, hscroll->is_visible() ? -hmin.height : 0);
+
updating_scroll = false;
if (node_ninepatch || obj_styleBox.is_valid()) {