From 7ca5158c5f7cf5d7640ca111ed7888592cd6590e Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sun, 22 Nov 2026 09:10:43 +0700 Subject: [PATCH] ui-contract: gesture_note reports no gesture for a component that was not shown in the pass before --- crates/ui-contract/src/runtime/edit.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ui-contract/src/runtime/edit.rs b/crates/ui-contract/src/runtime/edit.rs index d1ac47df4..0c04cc59f 100644 --- a/crates/ui-contract/src/runtime/edit.rs +++ b/crates/ui-contract/src/runtime/edit.rs @@ -36,8 +36,12 @@ pub(crate) fn gesture_key(id: Id) -> Id { /// The note the component `id` set on its running gesture with [`Cx::propose_with`](crate::contract::Cx::propose_with), /// when it is an `N`; `None` while no gesture of the component runs. `V` is the component's value type, under which -/// its gesture is kept. A reader outside the component's pass, drawn before or after it, reads the same note. +/// its gesture is kept. A reader outside the component's pass, drawn before or after it, reads the same note. A +/// component not shown in the pass before has no running gesture: it lost its press, as its own value step finds. pub fn gesture_note(ctx: &Context, id: Id) -> Option { + if !crate::runtime::memory::shown_last_pass(ctx, id) { + return None; + } MemoryStage::peek_with::, _>(ctx, gesture_key(id), |gesture| { if !gesture.is_running() { return None;