Scaffolding for selection & scanning modes
The gizmo currently draws as an annulus with the intention that it is an area selection tool. These new components will serve as mode selectors so that different selection modes can be used.
This commit is contained in:
@@ -15,7 +15,7 @@ fn setup(
|
||||
mut materials: ResMut<Assets<ColorMaterial>>,
|
||||
) {
|
||||
commands.spawn((
|
||||
Cursor,
|
||||
ScannerWidget::default(),
|
||||
MaterialMesh2dBundle {
|
||||
mesh: meshes.add(Annulus::new(9.5, 10.0)).into(),
|
||||
material: materials.add(Color::srgb(0.0, 0.0, 0.0)),
|
||||
@@ -24,9 +24,38 @@ fn setup(
|
||||
));
|
||||
}
|
||||
|
||||
#[derive(Bundle)]
|
||||
struct ScannerWidget {
|
||||
cursor: Cursor,
|
||||
select: SelectionMode,
|
||||
scan: ScannerMode,
|
||||
}
|
||||
|
||||
impl Default for ScannerWidget {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
cursor: Cursor,
|
||||
select: SelectionMode::CircularArea,
|
||||
scan: ScannerMode::CenterOfMass,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Component)]
|
||||
struct Cursor;
|
||||
|
||||
#[derive(Component)]
|
||||
enum SelectionMode {
|
||||
NearestSingle,
|
||||
CircularArea,
|
||||
}
|
||||
|
||||
#[derive(Component)]
|
||||
enum ScannerMode {
|
||||
CenterOfMass,
|
||||
Velocity,
|
||||
}
|
||||
|
||||
fn update_cursor(
|
||||
window: Query<&Window, With<PrimaryWindow>>,
|
||||
camera: Query<(&Camera, &GlobalTransform)>,
|
||||
|
||||
Reference in New Issue
Block a user