1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Use Vector* component-wise min/max/clamp functions where applicable

This commit is contained in:
A Thousand Ships
2024-03-03 12:49:08 +01:00
parent fe01776f05
commit 79ba22a73f
53 changed files with 95 additions and 176 deletions

View File

@@ -337,10 +337,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT && tool_select->is_pressed()) {
box_selecting = true;
box_selecting_from = box_selecting_to = state_machine_draw->get_local_mouse_position();
box_selecting_rect = Rect2(MIN(box_selecting_from.x, box_selecting_to.x),
MIN(box_selecting_from.y, box_selecting_to.y),
ABS(box_selecting_from.x - box_selecting_to.x),
ABS(box_selecting_from.y - box_selecting_to.y));
box_selecting_rect = Rect2(box_selecting_from.min(box_selecting_to), (box_selecting_from - box_selecting_to).abs());
if (mb->is_command_or_control_pressed() || mb->is_shift_pressed()) {
previous_selected = selected_nodes;
@@ -423,10 +420,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
if (mm.is_valid() && box_selecting) {
box_selecting_to = state_machine_draw->get_local_mouse_position();
box_selecting_rect = Rect2(MIN(box_selecting_from.x, box_selecting_to.x),
MIN(box_selecting_from.y, box_selecting_to.y),
ABS(box_selecting_from.x - box_selecting_to.x),
ABS(box_selecting_from.y - box_selecting_to.y));
box_selecting_rect = Rect2(box_selecting_from.min(box_selecting_to), (box_selecting_from - box_selecting_to).abs());
for (int i = 0; i < node_rects.size(); i++) {
bool in_box = node_rects[i].node.intersects(box_selecting_rect);