Refactor CellWidget constructor to accept selected

Update `CellWidget::new` to take a `selected` flag and remove the
chaining return values from `set_selected` and `set_zoom_level`. The
board code now passes the selection state directly during construction.
This commit is contained in:
2026-04-08 23:43:16 +02:00
parent 247f5c143b
commit 56bef7c98e
2 changed files with 9 additions and 12 deletions
+5 -6
View File
@@ -48,12 +48,11 @@ impl BoardState {
let mut rows: Vec<CellWidget> = Vec::new();
for col in 0..map_width {
rows.push(*CellWidget::new(row, col, zoom_level).set_selected(
if row == focused_cell.get_row() && col == focused_cell.get_col() {
true
} else {
false
},
rows.push(CellWidget::new(
row,
col,
row == focused_cell.get_row() && col == focused_cell.get_col(),
zoom_level,
));
}