Add Touchpad navigation: Shift to pan, Alt/Option to orbit (#1220)

An opt-in Touchpad navigation preset: Shift + pointer motion pans, Alt/Option + motion orbits, vertical scroll zooms, all without a mouse button. Existing presets are unchanged; view.navigate gains continuous motion for the control channel and scenarios.
This commit is contained in:
Emil Petersson authored and GitHub committed 2026-10-14 22:46:33 -04:00
1 parent b4edf05373
commit bd8db8ea1c
17 files changed
+717 -60

No files matched your search

+5
View File
@@ -238,6 +238,11 @@ pub(crate) fn cancel(ctx: &egui::Context, id: egui::Id) {
ctx.data_mut(|d| d.remove::<State>(id));
}
/// Hit-test before registering the dynamic egui drag widget or changing the camera.
pub(crate) fn contains_pointer(proj: &Proj, t: &Triad, p: Pos2) -> bool {
mm_per_px(proj, t.center).and_then(|scale| shapes(proj, t, scale * LEN_PX)).is_some_and(|sh| hit(&sh, p).is_some())
}
/// Draw the triad and run a drag on it. `step` is the distance snap step.
pub fn show(ui: &mut egui::Ui, painter: &egui::Painter, proj: &Proj, id: egui::Id, t: &Triad, step: f64) -> Option<Drag> {
let tk = Tokens::get();