summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmb462 <jmb462@gmail.com>2021-03-20 15:04:23 +0100
committerjmb462 <jmb462@gmail.com>2021-03-20 15:09:50 +0100
commit045f55ec00d7358cc496474fd68ab47bda9a83a7 (patch)
tree2397c0bd9fd59a600c1cc861a36b7c5c61de1314
parent62e134a0c01bf19c2623dc73e05ebb6e0ab0c1b5 (diff)
Prevent resizing minimap bigger than GraphEdit (Fix #47189)
Minimap size couldn't be resized back after been resized bigger than GraphEdit cause the grabber was out of GraphEdit. This commit prevents resizing minimap bigger than GraphEdit and fix this issue.
-rw-r--r--scene/gui/graph_edit.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 09a9cbf95b..71d31434d4 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -180,7 +180,12 @@ void GraphEditMinimap::_gui_input(const Ref<InputEvent> &p_ev) {
accept_event();
} else if (mm.is_valid() && is_pressing) {
if (is_resizing) {
- ge->set_minimap_size(ge->get_minimap_size() - mm->get_relative());
+ // Prevent setting minimap wider than GraphEdit
+ Vector2 new_minimap_size;
+ new_minimap_size.x = MIN(get_size().x - mm->get_relative().x, ge->get_size().x - 2.0 * minimap_padding.x);
+ new_minimap_size.y = MIN(get_size().y - mm->get_relative().y, ge->get_size().y - 2.0 * minimap_padding.y);
+ ge->set_minimap_size(new_minimap_size);
+
update();
} else {
Vector2 click_position = _convert_to_graph_position(mm->get_position() - minimap_padding) - graph_padding;