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:
2026-04-10 19:06:47 +02:00
parent b45c300bc3
commit 869ba0bb7f
6 changed files with 128 additions and 50 deletions
+11
View File
@@ -27,6 +27,7 @@ pub struct CellWidget {
selected: bool,
zoom_level: ZoomLevel,
tag: CellTag,
marked: bool,
}
impl CellWidget {
@@ -43,6 +44,7 @@ impl CellWidget {
selected,
zoom_level,
tag,
marked: false,
}
}
@@ -58,6 +60,14 @@ impl CellWidget {
self.tag = tag;
}
pub fn get_marked(&self) -> bool {
self.marked
}
pub fn set_marked(&mut self, marked: bool) {
self.marked = marked
}
fn col_to_letters(&self) -> String {
let mut col: usize = self.col + 1;
let mut letters: Vec<char> = Vec::new();
@@ -80,6 +90,7 @@ impl CellWidget {
fn fg_color(&self) -> Color {
match self.tag {
_ if self.marked => Color::LightMagenta,
_ if self.selected => Color::LightYellow,
CellTag::Base(Players::Player) if !self.selected => Color::LightBlue,
CellTag::Base(Players::Enemy) if !self.selected => Color::LightRed,