Skip to content

Commit

Permalink
refactor: handling of secondary button in graph
Browse files Browse the repository at this point in the history
Simpler and it also fixes a clippy lint.
  • Loading branch information
dodomorandi committed Jun 20, 2024
1 parent ec184ed commit 8a6400a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/ui/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,14 +544,14 @@ impl Graph {
}
}

let mut pointer_delta = egui::Vec2::ZERO;
if ui.ui_contains_pointer() // Can only be queried after the editor UI has been drawn
&& ui.input(|i| {
pointer_delta = i.pointer.delta();
i.pointer.secondary_down()
})
{
self.editor.pan_zoom.pan += pointer_delta;
// Can only be queried after the editor UI has been drawn
if ui.ui_contains_pointer() {
let (secondary_down, pointer_delta) =
ui.input(|i| (i.pointer.secondary_down(), i.pointer.delta()));

if secondary_down {
self.editor.pan_zoom.pan += pointer_delta;
}
}
});
}
Expand Down

0 comments on commit 8a6400a

Please sign in to comment.