Select Other: a still hold opens the list while Orbit, Pan or Zoom is lit (#8437) (#8438)

* Select Other: a still hold opens the list while Orbit, Pan or Zoom is lit

With a mode lit in the navigation bar (or Space held), holding the left button still on overlapping geometry opened nothing, and the release then selected the top item as a click. The viewport treats such a mode as owning left drags: a plain click still selects, and every other check on the mode sits on a drag. The hold was the one place a press that had not moved counted as navigation.

The hold is now cancelled only by a navigation that has started (the drag past the click distance), so it behaves as it does with no mode lit. The hint and the user guide already describe the hold without that condition. A preset's modifier binding (Maya Alt, Alias Shift+Alt, HFSS Alt) and Ctrl+left orbit still cancel it at the press, as before: holding such a chord is a gesture to navigate.

Tests: holding still with each mode lit opens the list, picks from it and a click still selects; a drag under each mode still moves the view and opens nothing; Maya's Alt chord held still does not open the list (it fails without the preset check).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Select Other: the press that opened the list does not move the view

egui calls a press a drag once it has lasted 0.8 s. With Orbit, Pan or Zoom lit, the press that opened Select Other at 0.5 s then became an orbit, pan or zoom, and moving the pointer to a row turned the view under the open list. While the list is open, a primary press no longer takes the lit mode.

Test: a press held past 0.8 s that then moves keeps the list open and the view still, for each mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daniel
2026-10-28 20:07:33 +00:00
committed by GitHub
parent 90ef106e5f
commit 93066ab60c
3 changed files with 85 additions and 4 deletions
+3 -1
View File
@@ -639,7 +639,9 @@ pub(crate) fn handle(app: &mut SolveApp, ui: &mut egui::Ui, rect: Rect, resp: &e
if dragging && app.viewport.axis_drag.is_none() {
match button {
Some(b) => crate::prefs::nav_mode(app, b, mods),
None if primary_down => primary_nav,
// A press held still that opened Select Other stays its own: egui calls it a
// drag after 0.8 s, and moving to a row must not turn the view under the list.
None if primary_down && !crate::select_other::is_open(app) => primary_nav,
None => None,
}
} else {
+76
View File
@@ -486,3 +486,79 @@ fn an_edge_is_as_deep_as_its_point_under_the_pointer_not_its_middle() {
let mid = solidcraft_engine::geom::Vec3::new(15.0, 0.0, 2.0);
assert!((t - want).abs() < 0.5, "depth {t}, the point under the pointer {want}, its middle {}", (mid - o).dot(d));
}
/// The navigation bar's Orbit, Pan and Zoom: each one's slot and the mode it lights.
fn lit_modes() -> [(&'static str, crate::viewport::NavMode); 3] {
use crate::viewport::NavMode;
[("orbit", NavMode::Orbit), ("pan", NavMode::Pan), ("zoom", NavMode::Zoom)]
}
/// Screen point `at` moved by `d` points right and down.
fn offset(at: &Value, d: f64) -> Value {
json!([at[0].as_f64().unwrap_or_default() + d, at[1].as_f64().unwrap_or_default() + d])
}
/// A mode lit in the navigation bar owns left drags, not a press held still: the hold opens
/// the list as it does with no mode lit, and a plain click still selects.
#[test]
fn holding_still_opens_the_list_while_a_navigation_mode_is_lit() {
for (slot, mode) in lit_modes() {
let (mut h, at) = two_lines();
h.step(&json!({"click": {"handle": format!("nav:slot:{slot}")}})).unwrap();
assert_eq!(h.app.viewport.nav, Some(mode), "{slot} is lit");
let cam = h.app.cam;
h.step(&json!({"hold": at})).unwrap();
assert!(crate::select_other::is_open(&h.app), "a held press opens Select Other with {slot} lit");
assert_eq!(h.app.cam, cam, "{slot}: holding still did not move the view");
assert!(h.app.session.selection.is_empty(), "{slot}: {:?}", h.app.session.selection);
h.step(&json!({"click": {"handle": "select_other:1"}})).unwrap();
assert_eq!(curves(&h), ["l2"], "{slot}");
h.app.session.selection.clear();
h.step(&json!({"click": at})).unwrap();
assert_eq!(curves(&h).len(), 1, "{slot}: a click still selects");
assert_eq!(h.app.viewport.nav, Some(mode), "{slot} stays lit");
}
}
/// A drag under a lit mode still moves the view and does not open the list, whether it starts
/// at once or after the press was held still for longer than egui waits to call it a drag.
#[test]
fn a_drag_under_a_lit_navigation_mode_moves_the_view_and_opens_nothing() {
for (slot, _) in lit_modes() {
let (mut h, at) = two_lines();
h.step(&json!({"click": {"handle": format!("nav:slot:{slot}")}})).unwrap();
let cam = h.app.cam;
h.step(&json!({"drag": [at, offset(&at, 40.0)]})).unwrap();
assert_ne!(h.app.cam, cam, "{slot}: the drag moved the view");
assert!(!crate::select_other::is_open(&h.app), "{slot}: a drag does not open Select Other");
assert!(h.app.session.selection.is_empty(), "{slot}: {:?}", h.app.session.selection);
}
}
/// A preset's modifier chord is a gesture to navigate from the press on: Maya's Alt+left held
/// still on overlapping lines does not open the list, unlike a mode lit in the navigation bar.
#[test]
fn a_preset_chord_held_still_does_not_open_the_list() {
let (mut h, at) = two_lines();
h.app.preferences.nav = "maya".into();
let (x, y) = (at[0].as_f64().unwrap_or_default(), at[1].as_f64().unwrap_or_default());
h.call("ui.drag", json!({"x0": x, "y0": y, "x1": x, "y1": y, "steps": 1, "hold": 40, "alt": true}));
h.settle();
assert!(!crate::select_other::is_open(&h.app), "Maya Alt+left held still navigates, it does not open Select Other");
}
/// Once the list is open, the press it came from does not turn into a drag of the view at
/// egui's 0.8 s mark: the camera stays put under the open list while the pointer moves to a row.
#[test]
fn a_press_that_opened_the_list_does_not_move_the_view_when_it_moves_on() {
for (slot, _) in lit_modes() {
let (mut h, at) = two_lines();
h.step(&json!({"click": {"handle": format!("nav:slot:{slot}")}})).unwrap();
let cam = h.app.cam;
let (x, y) = (at[0].as_f64().unwrap_or_default(), at[1].as_f64().unwrap_or_default());
h.call("ui.drag", json!({"x0": x, "y0": y, "x1": x + 40.0, "y1": y + 40.0, "steps": 8, "hold": 60}));
h.settle();
assert!(crate::select_other::is_open(&h.app), "{slot}: the list stays open");
assert_eq!(h.app.cam, cam, "{slot}: the view did not move under the open list");
}
}
+6 -3
View File
@@ -3933,9 +3933,12 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
app.viewport.hover = cand.as_ref().map(|c| c.0.clone());
wake_centre(app, &hits);
// Select Other: a press held still opens the list of everything under it; while the list is
// open its row under the pointer is what lights up.
let held =
crate::select_other::track_hold(app, ui.ctx(), &proj, inside, primary_pressed, primary_down, hover, primary_nav.is_some() || mode.is_some());
// open its row under the pointer is what lights up. A mode lit in the navigation bar or a
// held Space owns drags, not a still press, so only a navigation that has started cancels
// it. A preset's modifier binding (Maya Alt, Alias Shift+Alt) or Ctrl+left orbit is a
// gesture to navigate from the press on, so it still cancels the hold at once.
let navigating_from_press = mode.is_some() || app.viewport.primary_nav.is_some();
let held = crate::select_other::track_hold(app, ui.ctx(), &proj, inside, primary_pressed, primary_down, hover, navigating_from_press);
crate::select_other::hover_override(app);
let painter = ui.painter_at(rect);
// Background gradient.