generated from GarandPLG/rust-flake-template
Add zoom support and dynamic keybinding layout
Introduce ZoomIn/ZoomOut actions and a Zoom group with corresponding keybindings. Add a CLI option to set the initial zoom level and a ZoomLevel enum. Expose a utility to compute the largest keybinding group size for layout sizing. Refactor board widget to adjust cell dimensions based on zoom level and simplify offset calculations. Update views to use the new layout sizing helper and integrate zoom handling in skirmish logic.
This commit is contained in:
@@ -8,4 +8,4 @@ pub use main_menu::MainMenuState;
|
||||
pub use perk_decks::{PerkDecks, PerkDecksState};
|
||||
pub use settings::SettingsState;
|
||||
pub use skills_config::SkillsConfigState;
|
||||
pub use skirmish::{GameMode, Offset, SkirmishState};
|
||||
pub use skirmish::{GameMode, Offset, SkirmishState, ZoomLevel};
|
||||
|
||||
@@ -33,9 +33,9 @@ impl Offset {
|
||||
}
|
||||
|
||||
pub fn set_max(&mut self, max: usize) {
|
||||
if self.max_initiated {
|
||||
return;
|
||||
}
|
||||
// if self.max_initiated {
|
||||
// return;
|
||||
// }
|
||||
|
||||
self.max = max;
|
||||
self.max_initiated = true;
|
||||
@@ -59,6 +59,7 @@ pub struct SkirmishState {
|
||||
pub vertical_offset: Offset,
|
||||
pub horizontal_offset: Offset,
|
||||
pub board_cells: Vec<CellWidget>,
|
||||
pub zoom_level: ZoomLevel,
|
||||
}
|
||||
|
||||
impl SkirmishState {
|
||||
@@ -80,3 +81,10 @@ pub enum GameMode {
|
||||
LastManStanding,
|
||||
FrontLines,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, ValueEnum)]
|
||||
pub enum ZoomLevel {
|
||||
ZoomedIn,
|
||||
Default,
|
||||
ZoomedOut,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user