diff --git a/crates/ui-canvas/src/canvas/tool_host.rs b/crates/ui-canvas/src/canvas/tool_host.rs index 3dd7336d6..efcb91f98 100644 --- a/crates/ui-canvas/src/canvas/tool_host.rs +++ b/crates/ui-canvas/src/canvas/tool_host.rs @@ -507,6 +507,15 @@ impl<'m> ToolHost<'m> { } // A momentary tool takes the next press anywhere on the canvas, over the session members on its body. pointer::withhold_members(&ctx, pass.id, momentary_tool.is_some()); + if ctx.input(|i| i.pointer.button_pressed(egui::PointerButton::Secondary) || i.pointer.button_released(egui::PointerButton::Secondary)) { + eprintln!( + "DIAG space_hand_view_menu_keeps_escape_and_enter_from_the_pending_crop: host {:?} momentary {:?} gesture {} background {:?}", + pass.id, + momentary_tool, + state.gesture.is_some(), + pass.press.phase + ); + } // With no gesture and no momentary tool, a held stand-in key makes the stand-in the tool of hover, cursor and // paint while the selected tool does not take a primary press. let lent = if state.gesture.is_none() && momentary_tool.is_none() && !takes_primary { diff --git a/crates/ui-contract/src/primitives/sensing.rs b/crates/ui-contract/src/primitives/sensing.rs index 777c10321..3b97d458d 100644 --- a/crates/ui-contract/src/primitives/sensing.rs +++ b/crates/ui-contract/src/primitives/sensing.rs @@ -858,8 +858,14 @@ fn outcome_in(ctx: &Context, read: &PassRead, arena: ArenaId, layer: Layer, enab // egui gives no click target where a drag-only widget is on top (a resize grip over a layer's or a // window's edge): a root under it keeps its click there, but a drag is that widget's. let drag_elsewhere = targets.click.is_none() && targets.drag.is_some_and(|id| !mine(Some(id))); - resolve_press_in(state, members, xf, at, target) - .map(|hit| (hit, if drag_elsewhere { hit.sense.difference(Sense::DRAG) } else { hit.sense })) + let won = resolve_press_in(state, members, xf, at, target); + if !state.previous.is_empty() && ctx.input(|i| i.pointer.button_pressed(egui::PointerButton::Secondary)) { + eprintln!( + "DIAG space_hand_view_menu_keeps_escape_and_enter_from_the_pending_crop: root {root:?} members {members} targets {targets:?} won {:?}", + won.map(|hit| (hit.owner, hit.part)) + ); + } + won.map(|hit| (hit, if drag_elsewhere { hit.sense.difference(Sense::DRAG) } else { hit.sense })) }); cancelled = matches!(step.phase, Some(PressPhase::Cancel { .. })); release_held = machine.release_held();