generated from GarandPLG/rust-flake-template
Add scrolling actions and board widget
Introduce directional and scroll actions, update keybindings, add scrollbar state to SkirmishState, and render the board with a new BoardWidget. Adjust CLI defaults and layout heights accordingly.
This commit is contained in:
@@ -7,6 +7,12 @@ pub enum Action {
|
||||
Quit2,
|
||||
Up,
|
||||
Down,
|
||||
Left,
|
||||
Right,
|
||||
ScrollUp,
|
||||
ScrollDown,
|
||||
ScrollLeft,
|
||||
ScrollRight,
|
||||
Space,
|
||||
Enter,
|
||||
Esc,
|
||||
@@ -17,6 +23,7 @@ pub enum Action {
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, ValueEnum)]
|
||||
pub enum Group {
|
||||
Movement,
|
||||
Scroll,
|
||||
Select,
|
||||
Input,
|
||||
Quit,
|
||||
@@ -70,6 +77,60 @@ pub static KEYBINDINGS: &[KeyBinding] = &[
|
||||
symbol: "↓",
|
||||
description: "Down",
|
||||
},
|
||||
KeyBinding {
|
||||
action: Action::Left,
|
||||
code: KeyCode::Left,
|
||||
kind: KeyEventKind::Press,
|
||||
modifiers: KeyModifiers::NONE,
|
||||
group: Group::Movement,
|
||||
symbol: "←",
|
||||
description: "Left",
|
||||
},
|
||||
KeyBinding {
|
||||
action: Action::Right,
|
||||
code: KeyCode::Right,
|
||||
kind: KeyEventKind::Press,
|
||||
modifiers: KeyModifiers::NONE,
|
||||
group: Group::Movement,
|
||||
symbol: "→",
|
||||
description: "Right",
|
||||
},
|
||||
KeyBinding {
|
||||
action: Action::ScrollUp,
|
||||
code: KeyCode::Up,
|
||||
kind: KeyEventKind::Press,
|
||||
modifiers: KeyModifiers::CONTROL,
|
||||
group: Group::Movement,
|
||||
symbol: "Ctrl + ↑",
|
||||
description: "Scroll Up ",
|
||||
},
|
||||
KeyBinding {
|
||||
action: Action::ScrollDown,
|
||||
code: KeyCode::Down,
|
||||
kind: KeyEventKind::Press,
|
||||
modifiers: KeyModifiers::CONTROL,
|
||||
group: Group::Movement,
|
||||
symbol: "Ctrl + ↓",
|
||||
description: "Scroll Down",
|
||||
},
|
||||
KeyBinding {
|
||||
action: Action::ScrollLeft,
|
||||
code: KeyCode::Left,
|
||||
kind: KeyEventKind::Press,
|
||||
modifiers: KeyModifiers::CONTROL,
|
||||
group: Group::Movement,
|
||||
symbol: "Ctrl + ←",
|
||||
description: "Scroll Left",
|
||||
},
|
||||
KeyBinding {
|
||||
action: Action::ScrollRight,
|
||||
code: KeyCode::Right,
|
||||
kind: KeyEventKind::Press,
|
||||
modifiers: KeyModifiers::CONTROL,
|
||||
group: Group::Movement,
|
||||
symbol: "Ctrl + →",
|
||||
description: "Scroll Right",
|
||||
},
|
||||
KeyBinding {
|
||||
action: Action::Space,
|
||||
code: KeyCode::Char(' '),
|
||||
|
||||
Reference in New Issue
Block a user