From 9fc3f4ec2feb7e139439e4266d6a1efcdecf1565 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Wed, 25 Nov 2026 19:44:28 +0100 Subject: [PATCH] Say what the recorded outside press is for The comments and the doc of absorbed_press described a press and its release sharing a frame, which the one-press rule rules out. They now say the record is the one point the press landed on, for the layers the pass had when it was made, and that opening is what ties a layer to it. --- crates/ui-contract/src/contract/overlay/dismissal.rs | 9 ++++----- crates/ui-contract/src/runtime/overlay.rs | 5 +++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/ui-contract/src/contract/overlay/dismissal.rs b/crates/ui-contract/src/contract/overlay/dismissal.rs index ea5d1dfee9..0f5ea1ba7d 100644 --- a/crates/ui-contract/src/contract/overlay/dismissal.rs +++ b/crates/ui-contract/src/contract/overlay/dismissal.rs @@ -34,12 +34,11 @@ pub(super) fn dismissal( if dismiss.anchor_gone && layer.overlay.opener.as_ref().is_some_and(|first| !first.active(ctx, None).0.enabled) { return Some(CloseReason::AnchorGone); } - // The input hook recorded the press (and removed a primary one) beside the layers open in that pass; presses inside - // the family and its anchors never get here. + // The input hook recorded the press (and removed a primary one) as the lone point it landed on; the record stands + // for the layers the pass already had, and presses inside the family and its anchors never get here. if dismiss.outside == Outside::Absorb { - // A layer that appears in this pass was not open when the press was made, so the press is not outside it: a - // secondary press reaches the part below, which opens its own menu in the same pass when a press and its - // release share a frame. + // A layer that appears in this pass opened after the press was made, so the press is not outside it: `opening` + // is what tells it from the layers the record stands for. if overlay::absorbed_press(ctx).is_some() && !overlay::opening(ctx, layer.id) { return Some(CloseReason::Outside); } diff --git a/crates/ui-contract/src/runtime/overlay.rs b/crates/ui-contract/src/runtime/overlay.rs index dd3fc27824..0ecf40a398 100644 --- a/crates/ui-contract/src/runtime/overlay.rs +++ b/crates/ui-contract/src/runtime/overlay.rs @@ -745,8 +745,9 @@ pub(crate) fn absorb_presses(ctx: &Context, input: &mut crate::runtime::egui::in input.events.len() != before } -/// The outside press the input hook recorded for the running pass, beside the layers open when it was made. A tracked -/// input (`Input::Press`). +/// The outside press the input hook recorded for the running pass: the lone point it landed on, for the layers the pass +/// showed before it. `opening` is how a layer that appears in the pass tells it is none of those. A tracked input +/// (`Input::Press`). pub(crate) fn absorbed_press(ctx: &Context) -> Option { crate::runtime::replay::note_input(ctx, crate::runtime::inputs::Input::Press); absorbed_press_raw(ctx)