generated from GarandPLG/rust-flake-template
Add marking mode; rename resize and zoom methods
Introduce a marking mode that lets users toggle cells with Space and clear them with Backspace. BoardState now stores `marking_cells` and a list of `marked_cells` and provides methods to start, clear, and update marks. CellWidget tracks a `marked` flag and renders marked cells in LightMagenta. Keybindings are updated: Space now reads “Marking cells”, Backspace reads “Cancel marking”, and the original Enter binding is commented out. The former `resize_change` and `zoom_change` functions are renamed to `change_resize` and `change_zoom`; all call sites are updated accordingly.
This commit is contained in:
1 parent
b45c300bc3
commit
869ba0bb7f
6 files changed
+128
-50
No files matched your search
+11
-12
@@ -25,6 +25,8 @@ const ACTIONS: &[Action] = &[
|
||||
Action::ZoomOut,
|
||||
Action::VolumeUp,
|
||||
Action::VolumeDown,
|
||||
Action::Space,
|
||||
Action::Backspace,
|
||||
Action::Mute,
|
||||
Action::Quit,
|
||||
Action::Quit2,
|
||||
@@ -92,19 +94,16 @@ pub fn skirmish_view(app: &App, area: Rect, buf: &mut Buffer) {
|
||||
horizontal: 1,
|
||||
vertical: 1,
|
||||
});
|
||||
// .centered(
|
||||
// Constraint::Length(
|
||||
// (states.skirmish.board.cell_width * states.skirmish.board.cols) as u16,
|
||||
// ),
|
||||
// Constraint::Length(
|
||||
// (states.skirmish.board.cell_height * states.skirmish.board.rows) as u16,
|
||||
// ),
|
||||
// );
|
||||
|
||||
// TODO: add actual (effective) board sizes as Constraints
|
||||
BoardWidget::new(&states.skirmish.board).render(
|
||||
cells_area.centered(
|
||||
Constraint::Length(
|
||||
(states.skirmish.board.cell_width * states.skirmish.board.cols) as u16,
|
||||
),
|
||||
Constraint::Length(
|
||||
(states.skirmish.board.cell_height * states.skirmish.board.rows) as u16,
|
||||
),
|
||||
),
|
||||
buf,
|
||||
);
|
||||
BoardWidget::new(&states.skirmish.board).render(cells_area, buf);
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user