Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple selection #214

Merged
merged 5 commits into from
Feb 25, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 22 additions & 24 deletions crates/editor_ui/src/tools/gizmo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,39 +106,37 @@
}
});

let input = world.resource::<Input<GizmoHotkey>>();

Check warning on line 110 in crates/editor_ui/src/tools/gizmo.rs

View check run for this annotation

Codecov / codecov/patch

crates/editor_ui/src/tools/gizmo.rs#L109-L110

Added lines #L109 - L110 were not covered by tests
let mut del = false;
let mut clone_pressed = false;
let mut multiple_pressed = false;

if !ui.ctx().wants_keyboard_input() {
//hot keys. Blender keys preffer
let mode2key = vec![
(GizmoMode::Translate, GizmoHotkey::Translate),
(GizmoMode::Rotate, GizmoHotkey::Rotate),
(GizmoMode::Scale, GizmoHotkey::Scale),
];

let input = world.resource::<Input<GizmoHotkey>>();
//hot keys. Blender keys preffer
let mode2key = vec![
(GizmoMode::Translate, GizmoHotkey::Translate),
(GizmoMode::Rotate, GizmoHotkey::Rotate),
(GizmoMode::Scale, GizmoHotkey::Scale),
];

Check warning on line 120 in crates/editor_ui/src/tools/gizmo.rs

View check run for this annotation

Codecov / codecov/patch

crates/editor_ui/src/tools/gizmo.rs#L115-L120

Added lines #L115 - L120 were not covered by tests

for (mode, key) in mode2key {
if input.just_pressed(key) {
self.gizmo_mode = mode;
}
for (mode, key) in mode2key {
if input.just_pressed(key) {
self.gizmo_mode = mode;

Check warning on line 124 in crates/editor_ui/src/tools/gizmo.rs

View check run for this annotation

Codecov / codecov/patch

crates/editor_ui/src/tools/gizmo.rs#L122-L124

Added lines #L122 - L124 were not covered by tests
}
}

if ui.input(|s| s.key_pressed(Key::Delete) || input.just_pressed(GizmoHotkey::Delete)) {
del = true;
}
if ui.input(|s| s.key_pressed(Key::Delete) || input.just_pressed(GizmoHotkey::Delete)) {
del = true;
}

Check warning on line 130 in crates/editor_ui/src/tools/gizmo.rs

View check run for this annotation

Codecov / codecov/patch

crates/editor_ui/src/tools/gizmo.rs#L128-L130

Added lines #L128 - L130 were not covered by tests

if !input.pressed(GizmoHotkey::Clone) {
self.is_move_cloned_entities = false;
} else {
clone_pressed = true;
}
if !input.pressed(GizmoHotkey::Clone) {
self.is_move_cloned_entities = false;
} else {
clone_pressed = true;
}

Check warning on line 136 in crates/editor_ui/src/tools/gizmo.rs

View check run for this annotation

Codecov / codecov/patch

crates/editor_ui/src/tools/gizmo.rs#L132-L136

Added lines #L132 - L136 were not covered by tests

if input.pressed(GizmoHotkey::Multiple) {
multiple_pressed = true;
}
if input.pressed(GizmoHotkey::Multiple) {
multiple_pressed = true;

Check warning on line 139 in crates/editor_ui/src/tools/gizmo.rs

View check run for this annotation

Codecov / codecov/patch

crates/editor_ui/src/tools/gizmo.rs#L138-L139

Added lines #L138 - L139 were not covered by tests
}

if del {
Expand Down
Loading