fix text sizing, and add custom hotkey support
This commit is contained in:
parent
09590edd95
commit
ee425e224e
10 changed files with 1096 additions and 280 deletions
|
|
@ -24,6 +24,15 @@ pub const ZOOM_STEP: f64 = 0.25;
|
|||
/// Pan step in pixels for keyboard navigation.
|
||||
pub const PAN_STEP: f64 = 50.0;
|
||||
|
||||
/// Minimum text em size (50%).
|
||||
pub const TEXT_EM_MIN: f64 = 0.5;
|
||||
|
||||
/// Maximum text em size (200%).
|
||||
pub const TEXT_EM_MAX: f64 = 2.0;
|
||||
|
||||
/// Text em size step increment.
|
||||
pub const TEXT_EM_STEP: f64 = 0.1;
|
||||
|
||||
/// Calculate the minimum zoom level for pan mode.
|
||||
///
|
||||
/// - Large scenes: min zoom fills the viewport
|
||||
|
|
@ -71,6 +80,10 @@ pub struct ViewerSettings {
|
|||
|
||||
/// Saved vertical scroll position for pan mode.
|
||||
pub scroll_y: f64,
|
||||
|
||||
/// Text size multiplier for display names, chat bubbles, and badges.
|
||||
/// Range: 0.5 to 2.0 (50% to 200%).
|
||||
pub text_em_size: f64,
|
||||
}
|
||||
|
||||
impl Default for ViewerSettings {
|
||||
|
|
@ -81,6 +94,7 @@ impl Default for ViewerSettings {
|
|||
enlarge_props: true,
|
||||
scroll_x: 0.0,
|
||||
scroll_y: 0.0,
|
||||
text_em_size: 1.0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -181,4 +195,9 @@ impl ViewerSettings {
|
|||
self.scroll_x = 0.0;
|
||||
self.scroll_y = 0.0;
|
||||
}
|
||||
|
||||
/// Adjust text em size by a delta, clamping to valid range.
|
||||
pub fn adjust_text_em(&mut self, delta: f64) {
|
||||
self.text_em_size = (self.text_em_size + delta).clamp(TEXT_EM_MIN, TEXT_EM_MAX);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue