Add bounded focus and padding to skirmish UI

- Initialize FocusedCell with map dimensions and start near the map
  centre.
- Store max rows/cols in FocusedCell and clamp moves to these bounds.
- Scroll actions now adjust the corresponding offset and also move the
  focused cell, keeping navigation consistent.
- Zoom actions modify the vertical offset to keep the view centered
  after
  changing zoom levels.
- Cell widget now uses a Padding widget with dynamic top padding based
  on
  the area height.
This commit is contained in:
2026-03-30 16:32:28 +02:00
parent 363baa1c1a
commit 07e941eba1
4 changed files with 50 additions and 20 deletions
+6 -1
View File
@@ -32,7 +32,12 @@ impl GameStates {
map_height: args.map_height as usize,
board_cells: Vec::new(),
zoom_level: args.zoom_level,
focused_cell: FocusedCell::new(0, 0),
focused_cell: FocusedCell::new(
(args.map_height / 2) as usize - 1,
2,
args.map_height as usize,
args.map_width as usize,
),
},
perk_decks: PerkDecksState {
id: 2,