mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-01-08 02:44:20 +01:00
input: process input once
Instead of calling ctx.input multiple times, let's do it once. We are going to do a lot more stuff in here, such as vim key bindings
This commit is contained in:
14
src/app.rs
14
src/app.rs
@@ -105,12 +105,14 @@ fn send_initial_filters(damus: &mut Damus, relay_url: &str) {
|
||||
}
|
||||
|
||||
fn try_process_event(damus: &mut Damus, ctx: &egui::Context) -> Result<()> {
|
||||
let amount = 0.2;
|
||||
if ctx.input(|i| i.key_pressed(egui::Key::Equals)) {
|
||||
ctx.set_pixels_per_point(ctx.pixels_per_point() + amount);
|
||||
} else if ctx.input(|i| i.key_pressed(egui::Key::Minus)) {
|
||||
ctx.set_pixels_per_point(ctx.pixels_per_point() - amount);
|
||||
}
|
||||
ctx.input(|i| {
|
||||
let amount = 0.2;
|
||||
if i.key_pressed(egui::Key::Equals) {
|
||||
ctx.set_pixels_per_point(ctx.pixels_per_point() + amount);
|
||||
} else if i.key_pressed(egui::Key::Minus) {
|
||||
ctx.set_pixels_per_point(ctx.pixels_per_point() - amount);
|
||||
}
|
||||
});
|
||||
|
||||
let ctx2 = ctx.clone();
|
||||
let wakeup = move || {
|
||||
|
||||
Reference in New Issue
Block a user