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:
William Casarin
2024-05-17 19:14:55 -05:00
parent 93b7af1a4e
commit 3a891a982c

View File

@@ -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<()> { fn try_process_event(damus: &mut Damus, ctx: &egui::Context) -> Result<()> {
let amount = 0.2; ctx.input(|i| {
if ctx.input(|i| i.key_pressed(egui::Key::Equals)) { let amount = 0.2;
ctx.set_pixels_per_point(ctx.pixels_per_point() + amount); if i.key_pressed(egui::Key::Equals) {
} else if ctx.input(|i| i.key_pressed(egui::Key::Minus)) { ctx.set_pixels_per_point(ctx.pixels_per_point() + amount);
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 ctx2 = ctx.clone();
let wakeup = move || { let wakeup = move || {