refactor: allow opting out of automatic keyboard navigation

This commit is contained in:
Ashley Wulber 2024-03-01 13:53:15 -05:00 committed by Ashley Wulber
parent 268b47d000
commit 3e68e39366
2 changed files with 27 additions and 5 deletions

View file

@ -46,6 +46,9 @@ pub struct Core {
/// Whether the window is too small for the nav bar + main content.
is_condensed: bool,
/// Enables built in keyboard navigation
pub(super) keyboard_nav: bool,
/// Current status of the nav bar panel.
nav_bar: NavBar,
@ -78,6 +81,7 @@ impl Default for Core {
Self {
debug: false,
is_condensed: false,
keyboard_nav: true,
nav_bar: NavBar {
active: true,
toggled: true,
@ -134,6 +138,17 @@ impl Core {
self.scale_factor
}
/// Enable or disable keyboard navigation
pub fn set_keyboard_nav(&mut self, enabled: bool) {
self.keyboard_nav = enabled;
}
#[must_use]
/// Enable or disable keyboard navigation
pub fn keyboard_nav(&self) -> bool {
self.keyboard_nav
}
/// Changes the scaling factor used by the application.
pub(crate) fn set_scale_factor(&mut self, factor: f32) {
self.scale_factor = factor;