Skip to content

Commit

Permalink
feat: add zoom in/out via keyboard
Browse files Browse the repository at this point in the history
- `ctrl`+`=`
- `ctrl`+`-`
  • Loading branch information
nozwock committed Dec 16, 2022
1 parent 5c050c3 commit b39d3a8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/gui/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl eframe::App for App {

/// Called each time the UI needs repainting, which may be many times per second.
/// Put your widgets into a `SidePanel`, `TopPanel`, `CentralPanel`, `Window` or `Area`.
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
// I hate the way this is being done...but ok T~T

// ! why's rust analyzer dead for this chunk of code. What's going on with it?
Expand Down Expand Up @@ -650,6 +650,11 @@ impl eframe::App for App {
}
}
});

// On web, the browser controls the gui zoom.
if !frame.is_web() {
egui::gui_zoom::zoom_with_keyboard_shortcuts(ctx, frame.info().native_pixels_per_point);
}
}
}

Expand Down

0 comments on commit b39d3a8

Please sign in to comment.