Add Zoom Factor to options panel (#7517)

This commit is contained in:
Emil Ernerfeldt 2025-09-08 18:27:28 +02:00 committed by GitHub
parent b822977e7f
commit 01ee23c1a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 15 additions and 30 deletions

View File

@ -294,10 +294,11 @@ pub enum UserAttentionType {
/// egui emits a [`CursorIcon`] in [`PlatformOutput`] each frame as a request to the integration. /// egui emits a [`CursorIcon`] in [`PlatformOutput`] each frame as a request to the integration.
/// ///
/// Loosely based on <https://developer.mozilla.org/en-US/docs/Web/CSS/cursor>. /// Loosely based on <https://developer.mozilla.org/en-US/docs/Web/CSS/cursor>.
#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub enum CursorIcon { pub enum CursorIcon {
/// Normal cursor icon, whatever that is. /// Normal cursor icon, whatever that is.
#[default]
Default, Default,
/// Show no cursor /// Show no cursor
@ -457,12 +458,6 @@ impl CursorIcon {
]; ];
} }
impl Default for CursorIcon {
fn default() -> Self {
Self::Default
}
}
/// Things that happened during this frame that the integration may be interested in. /// Things that happened during this frame that the integration may be interested in.
/// ///
/// In particular, these events may be useful for accessibility, i.e. for screen readers. /// In particular, these events may be useful for accessibility, i.e. for screen readers.

View File

@ -357,7 +357,7 @@ impl Options {
theme_preference, theme_preference,
fallback_theme: _, fallback_theme: _,
system_theme: _, system_theme: _,
zoom_factor: _, // TODO(emilk) zoom_factor,
zoom_with_keyboard, zoom_with_keyboard,
tessellation_options, tessellation_options,
repaint_on_widget_change, repaint_on_widget_change,
@ -384,6 +384,11 @@ impl Options {
"Repaint if any widget moves or changes id", "Repaint if any widget moves or changes id",
); );
ui.horizontal(|ui| {
ui.label("Zoom factor:");
ui.add(crate::DragValue::new(zoom_factor).range(0.10..=10.0));
});
ui.checkbox( ui.checkbox(
zoom_with_keyboard, zoom_with_keyboard,
"Zoom with keyboard (Cmd +, Cmd -, Cmd 0)", "Zoom with keyboard (Cmd +, Cmd -, Cmd 0)",

View File

@ -80,9 +80,10 @@ impl eframe::App for ColorTestApp {
} }
} }
#[derive(Copy, Clone, Debug, Eq, PartialEq)] #[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub enum Anchor { pub enum Anchor {
#[default]
Demo, Demo,
EasyMarkEditor, EasyMarkEditor,
@ -138,12 +139,6 @@ impl From<Anchor> for egui::WidgetText {
} }
} }
impl Default for Anchor {
fn default() -> Self {
Self::Demo
}
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]

View File

@ -4,8 +4,9 @@ use egui::{
}; };
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[derive(Clone, Copy, Debug, PartialEq)] #[derive(Clone, Copy, Debug, Default, PartialEq)]
enum ScrollDemo { enum ScrollDemo {
#[default]
ScrollAppearance, ScrollAppearance,
ScrollTo, ScrollTo,
ManyLines, ManyLines,
@ -14,12 +15,6 @@ enum ScrollDemo {
Bidirectional, Bidirectional,
} }
impl Default for ScrollDemo {
fn default() -> Self {
Self::ScrollAppearance
}
}
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))] #[cfg_attr(feature = "serde", serde(default))]
#[derive(Default, PartialEq)] #[derive(Default, PartialEq)]

View File

@ -108,7 +108,7 @@ pub fn highlight_easymark(egui_style: &egui::Style, mut text: &str) -> egui::tex
// Swallow everything up to the next special character: // Swallow everything up to the next special character:
let line_end = text[skip..] let line_end = text[skip..]
.find('\n') .find('\n')
.map_or_else(|| text.len(), |i| (skip + i + 1)); .map_or_else(|| text.len(), |i| skip + i + 1);
let end = text[skip..] let end = text[skip..]
.find(&['*', '`', '~', '_', '/', '$', '^', '\\', '<', '['][..]) .find(&['*', '`', '~', '_', '/', '$', '^', '\\', '<', '['][..])
.map_or_else(|| text.len(), |i| (skip + i).max(1)); .map_or_else(|| text.len(), |i| (skip + i).max(1));

View File

@ -3,19 +3,14 @@
use crate::{ClippedShape, Galley, Mesh, Primitive, Shape}; use crate::{ClippedShape, Galley, Mesh, Primitive, Shape};
/// Size of the elements in a vector/array. /// Size of the elements in a vector/array.
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, Default, PartialEq)]
enum ElementSize { enum ElementSize {
#[default]
Unknown, Unknown,
Homogeneous(usize), Homogeneous(usize),
Heterogenous, Heterogenous,
} }
impl Default for ElementSize {
fn default() -> Self {
Self::Unknown
}
}
/// Aggregate information about a bunch of allocations. /// Aggregate information about a bunch of allocations.
#[derive(Clone, Copy, Default, PartialEq)] #[derive(Clone, Copy, Default, PartialEq)]
pub struct AllocInfo { pub struct AllocInfo {