Skip to content

Commit

Permalink
Prevent resizing minimap bigger than GraphEdit (Fix godotengine#47189)
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 045f55e)
  • Loading branch information
jmb462 authored and geekrelief committed Apr 5, 2021
1 parent 811bc2f commit cde19c4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scene/gui/graph_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,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;
Expand Down

0 comments on commit cde19c4

Please sign in to comment.