Skip to content
Snippets Groups Projects
Unverified Commit aed7be30 authored by StaffEngineer's avatar StaffEngineer Committed by GitHub
Browse files

Merge pull request #19 from StaffEngineer/inactive-selection

Clear Inactive selection
parents 18c08a16 f1085211
No related branches found
No related tags found
No related merge requests found
......@@ -391,6 +391,7 @@ impl Plugin for CosmicEditPlugin {
cosmic_edit_redraw_buffer.before(on_scale_factor_change),
blink_cursor,
hide_inactive_cursor,
clear_inactive_selection,
),
)
.init_resource::<ActiveEditor>()
......@@ -931,7 +932,11 @@ pub fn cosmic_edit_bevy_events(
camera_transform,
) {
let (x, y) = point(node_cursor_pos);
editor.action(&mut font_system.0, Action::Drag { x, y });
if active_editor.is_changed() && !shift {
editor.action(&mut font_system.0, Action::Click { x, y });
} else {
editor.action(&mut font_system.0, Action::Drag { x, y });
}
}
return;
}
......@@ -1234,6 +1239,21 @@ fn hide_inactive_cursor(
}
}
fn clear_inactive_selection(
mut cosmic_editor_q: Query<(Entity, &mut CosmicEditor)>,
active_editor: Res<ActiveEditor>,
) {
if !active_editor.is_changed() || active_editor.entity.is_none() {
return;
}
for (e, mut editor) in &mut cosmic_editor_q.iter_mut() {
if e != active_editor.entity.unwrap() {
editor.0.set_select_opt(None);
}
}
}
fn cosmic_edit_redraw_buffer(
windows: Query<&Window, With<PrimaryWindow>>,
mut images: ResMut<Assets<Image>>,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment