summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index d3f25d7a85..920fe347ca 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -370,6 +370,36 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
state_machine_draw->update();
}
+ // Move mouse while moving box select
+ 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));
+
+ for (int i = 0; i < node_rects.size(); i++) {
+ bool in_box = node_rects[i].node.intersects(box_selecting_rect);
+
+ if (in_box) {
+ if (previous_selected.has(node_rects[i].node_name)) {
+ selected_nodes.erase(node_rects[i].node_name);
+ } else {
+ selected_nodes.insert(node_rects[i].node_name);
+ }
+ } else {
+ if (previous_selected.has(node_rects[i].node_name)) {
+ selected_nodes.insert(node_rects[i].node_name);
+ } else {
+ selected_nodes.erase(node_rects[i].node_name);
+ }
+ }
+ }
+
+ state_machine_draw->update();
+ }
+
if (mm.is_valid()) {
state_machine_draw->grab_focus();