Merge pull request #47193 from jmb462/prevent-resizing-minimap-bigger-than-GraphEdit

Prevent resizing minimap bigger than GraphEdit (Fix #47189)
This commit is contained in:
Rémi Verschelde 2021-03-20 17:51:50 +01:00 committed by GitHub
commit c655ed7926
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -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;