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
@@ -62,27 +62,40 @@ pub fn skirmish_keybindings(app: &mut App, key_event: &KeyEvent) {
|
||||
Action::ZoomIn => match board.zoom_level {
|
||||
ZoomLevel::ZoomedIn => {}
|
||||
ZoomLevel::Default => {
|
||||
board.zoom_change(ZoomLevel::ZoomedIn);
|
||||
board.change_zoom(ZoomLevel::ZoomedIn);
|
||||
board.vertical_offset.next();
|
||||
}
|
||||
ZoomLevel::ZoomedOut => {
|
||||
board.zoom_change(ZoomLevel::Default);
|
||||
board.change_zoom(ZoomLevel::Default);
|
||||
board.vertical_offset.next();
|
||||
board.vertical_offset.next();
|
||||
}
|
||||
},
|
||||
Action::ZoomOut => match board.zoom_level {
|
||||
ZoomLevel::ZoomedIn => {
|
||||
board.zoom_change(ZoomLevel::Default);
|
||||
board.change_zoom(ZoomLevel::Default);
|
||||
board.vertical_offset.prev();
|
||||
}
|
||||
ZoomLevel::Default => {
|
||||
board.zoom_change(ZoomLevel::ZoomedOut);
|
||||
board.change_zoom(ZoomLevel::ZoomedOut);
|
||||
board.vertical_offset.prev();
|
||||
board.vertical_offset.prev();
|
||||
}
|
||||
ZoomLevel::ZoomedOut => {}
|
||||
},
|
||||
Action::Space => {
|
||||
if board.marking_cells {
|
||||
board.marking_cells = false;
|
||||
board.clear_marked_cells();
|
||||
} else {
|
||||
board.marking_cells = true;
|
||||
board.start_marking_cells();
|
||||
}
|
||||
}
|
||||
Action::Backspace => {
|
||||
board.marking_cells = false;
|
||||
board.clear_marked_cells()
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user