use std::collections::HashSet;
use bevy_ecs::prelude::*;
#[derive(Component)]
pub struct SelectorInput<T>(pub T);
#[derive(Component, Clone, Copy, Debug)]
pub struct Selectable {
pub is_selectable: bool,
pub element: Entity,
}
impl Selectable {
pub fn new(element: Entity) -> Self {
Selectable {
is_selectable: true,
element,
}
}
}
#[derive(Component, Debug, PartialEq, Eq)]
pub struct Selected {
pub is_selected: bool,
pub support_selected: HashSet<Entity>,
}
impl Selected {
pub fn cue(&self) -> bool {
self.is_selected || !self.support_selected.is_empty()
}
}
impl Default for Selected {
fn default() -> Self {
Self {
is_selected: false,
support_selected: Default::default(),
}
}
}
#[derive(Component, Debug, PartialEq, Eq)]
pub struct Hovered {
pub is_hovered: bool,
pub support_hovering: HashSet<Entity>,
}
impl Hovered {
pub fn cue(&self) -> bool {
self.is_hovered || !self.support_hovering.is_empty()
}
}
impl Default for Hovered {
fn default() -> Self {
Self {
is_hovered: false,
support_hovering: Default::default(),
}
}
}
#[derive(Component)]
pub struct CursorFrame;
#[derive(Component, Clone, Copy, Debug)]
pub struct Preview;