fix: Strg+Plus/Minus vergrößert nicht mehr die Oberfläche (Issue #34)
egui zoomte bei Strg+Plus/Minus zusätzlich zum Blatt die ganze Oberfläche. Danach lagen das bearbeitete Textfeld (und andere Overlays) um den Zoomfaktor versetzt und vergrößert über dem Blatt; beim Abwählen sprang der Text an seine echte Stelle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a5692e5430
commit
476d0e628f
2 files changed
+35
-1
No files matched your search
+1
-1
@@ -1323,7 +1323,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
// 3. egui Context und State initialisieren
|
||||
let egui_ctx = egui::Context::default();
|
||||
egui_ctx.set_visuals(egui::Visuals::dark());
|
||||
ui::configure_context(&egui_ctx);
|
||||
|
||||
// 4. In-App Gitea Updater initialisieren und im Hintergrund nach Releases fragen
|
||||
// Ergebnisse der PDF-Exporte aus dem Hintergrundthread
|
||||
|
||||
@@ -2895,6 +2895,14 @@ pub fn is_screen_point_in_ui(
|
||||
.is_some_and(|layer| layer.order != egui::Order::Background)
|
||||
}
|
||||
|
||||
/// Richtet den egui-Kontext ein. Strg+Plus/Minus/0 zoomen das Blatt; egui darf damit nicht
|
||||
/// zusätzlich die Oberfläche vergrößern, sonst passen Textfeld, Auswahl und Lineal nicht mehr
|
||||
/// zum Blatt (Issue #34).
|
||||
pub fn configure_context(ctx: &egui::Context) {
|
||||
ctx.set_visuals(egui::Visuals::dark());
|
||||
ctx.options_mut(|o| o.zoom_with_keyboard = false);
|
||||
}
|
||||
|
||||
/// Rendert die schwebende Toolbar und alle zugehörigen UI-Komponenten mit `egui`.
|
||||
///
|
||||
/// Gibt eine Liste von `UiAction`-Events zurück, die vom Hauptprogramm verarbeitet werden.
|
||||
@@ -5265,6 +5273,32 @@ mod tests {
|
||||
assert!(!actions.iter().any(|a| matches!(a, UiAction::ScrollTo(_))));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ctrl_plus_does_not_zoom_the_ui() {
|
||||
let ctx = egui::Context::default();
|
||||
configure_context(&ctx);
|
||||
let ctrl = egui::Modifiers {
|
||||
ctrl: true,
|
||||
command: true,
|
||||
..Default::default()
|
||||
};
|
||||
for _ in 0..2 {
|
||||
ctx.begin_frame(egui::RawInput {
|
||||
events: vec![egui::Event::Key {
|
||||
key: egui::Key::Plus,
|
||||
physical_key: None,
|
||||
pressed: true,
|
||||
repeat: false,
|
||||
modifiers: ctrl,
|
||||
}],
|
||||
modifiers: ctrl,
|
||||
..Default::default()
|
||||
});
|
||||
let _ = ctx.end_frame();
|
||||
}
|
||||
assert_eq!(ctx.zoom_factor(), 1.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_text_edit_overlay_takes_typing_and_escape() {
|
||||
let notebook = Notebook::new();
|
||||
|
||||
Reference in new issue
Block a user