Viewport: with Orbit, Pan or Zoom lit, a press held still keeps the highlight under it (#8864) (#8898)

* claim: #8864

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

* Viewport: with Orbit, Pan or Zoom lit, a press held still keeps the highlight under it (#8864)

A mode lit in the navigation bar, or a held Space, owns drags, not a still
press (#8438), but the hover pick counted any left press under such a mode
as navigation and dropped the highlight, so the line under a Select Other
hold went dark until the list opened. Only a preset's left-button binding
or Ctrl+left orbit navigates from the press on now; a lit mode's drag
still drops the highlight once it starts.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
austin62jakeandClaude Opus 5.5 authored and GitHub committed 2026-10-29 16:25:11 +00:00
1 parent 4aa2d6248e
commit e5ef3bad02
2 files changed
+40 -4

No files matched your search

+25
View File
@@ -520,6 +520,31 @@ fn holding_still_opens_the_list_while_a_navigation_mode_is_lit() {
}
}
/// A press held still on a line keeps the line lit until the list opens, with Orbit, Pan or
/// Zoom lit as with none: the press is not navigating yet (#8864).
#[test]
fn a_press_held_still_keeps_the_highlight_while_a_navigation_mode_is_lit() {
for slot in [None, Some("orbit"), Some("pan"), Some("zoom")] {
let (mut h, at) = two_lines();
if let Some(slot) = slot {
h.step(&json!({"click": {"handle": format!("nav:slot:{slot}")}})).unwrap();
}
h.step(&json!({"move": at})).unwrap();
h.frames(2);
assert!(hovered_curve(&h).is_some(), "{slot:?}: the line under the pointer is lit");
let pos = egui::pos2(at[0].as_f64().unwrap_or_default() as f32, at[1].as_f64().unwrap_or_default() as f32);
let button = |pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() };
h.app.synthetic.push(button(true));
h.frames(10);
assert!(!crate::select_other::is_open(&h.app), "{slot:?}: not open yet");
assert!(hovered_curve(&h).is_some(), "{slot:?}: still lit while the press is held");
h.frames(40);
assert!(crate::select_other::is_open(&h.app), "{slot:?}: the hold opened the list");
h.app.synthetic.push(button(false));
h.frames(2);
}
}
/// 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]
+15 -4
View File
@@ -4142,13 +4142,16 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
// events. Testing delta made the highlight reappear whenever a held drag paused.
// Resolve it before rendering so the GPU scene and screen overlays use the same hit.
// A 3D mouse moving the view is not such a gesture: the pointer hand is free, and hover
// and clicks keep picking while the other hand turns the view.
// and clicks keep picking while the other hand turns the view. Nor is a left press held
// still under a mode lit in the navigation bar or a held Space: they own drags, and the
// press may be opening Select Other (#8864); once it drags, `mode` says so. A preset's
// left-button binding or Ctrl+left orbit navigates from the press on.
let navigating = scroll != 0.0
|| pinch != 1.0
|| pan != egui::Vec2::ZERO
|| middle
|| secondary_down
|| (primary_nav.is_some() && primary_down)
|| (app.viewport.primary_nav.is_some() && primary_down)
|| mode.is_some()
|| app.viewport.axis_drag.is_some()
|| app.viewport.spin
@@ -8526,8 +8529,16 @@ mod tests {
hover_frame(&mut app, &ctx, vec![egui::Event::PointerMoved(p)]);
assert!(app.viewport.hover.is_some());
hover_frame(&mut app, &ctx, vec![egui::Event::PointerButton { pos: p, button, pressed: true, modifiers: Default::default() }]);
assert!(app.viewport.hover.is_none(), "hover on navigation press");
for offset in [1.0, 2.0, 3.0] {
// The lit mode owns drags, not a press held still (which may be opening Select
// Other, #8864): the highlight stays until the press drags.
let lit = button == egui::PointerButton::Primary;
assert_eq!(app.viewport.hover.is_some(), lit, "hover on a {button:?} press");
if lit {
hover_frame(&mut app, &ctx, vec![egui::Event::PointerMoved(p + vec2(1.0, 0.0))]);
assert!(app.viewport.hover.is_some(), "a press within click distance is still");
}
let offsets = if lit { [20.0, 21.0, 22.0] } else { [1.0, 2.0, 3.0] };
for offset in offsets {
hover_frame(&mut app, &ctx, vec![egui::Event::PointerMoved(p + vec2(offset, 0.0))]);
assert!(app.viewport.hover.is_none(), "hover while moving");
for _ in 0..3 {