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<()> {
|
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 || {
|
||||||
|
|||||||
Reference in New Issue
Block a user