#[derive(Clone, Copy, PartialEq)]
pub struct Keybind {
pub key: &'static str,
pub alt: bool,
pub ctrl: bool,
}
impl Keybind {
#[cfg(target_arch = "wasm32")]
pub(crate) fn matches(&self, key: &str, alt: bool, ctrl: bool) -> bool {
self.key == key && self.alt == alt && self.ctrl == ctrl
}
}
#[derive(Clone, Copy, PartialEq)]
pub struct Keybinds {
pub undo: Keybind = Keybind { key: "u", alt: false, ctrl: false },
pub redo: Keybind = Keybind { key: "U", alt: false, ctrl: false },
pub close: Keybind = Keybind { key: "Backspace", alt: false, ctrl: false },
pub maximize: Keybind = Keybind { key: "f", alt: false, ctrl: false },
pub help: Keybind = Keybind { key: "?", alt: false, ctrl: false },
}
impl Default for Keybinds {
fn default() -> Self {
Self { .. }
}
}
#[derive(Clone, Default, PartialEq)]
pub struct Config {
pub keybinds: Keybinds,
pub actions: Vec<(Keybind, dioxus::prelude::Callback<crate::render::packed::PackedApi>)>,
pub steps: u32 = 64,
pub rows: u32 = 36,
}