From e1fbd5b1b96a3838d55d5a41b440521289d3445c Mon Sep 17 00:00:00 2001 From: aiongg Date: Fri, 20 Nov 2026 08:48:12 +0000 Subject: [PATCH] craft-ui: a scroll region's noted view is a clip The view of a scroll region cuts what lies outside it: a replay cut by the clip around it cuts the view as a run there does. --- crates/ui-contract/src/runtime/egui/widgets.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/ui-contract/src/runtime/egui/widgets.rs b/crates/ui-contract/src/runtime/egui/widgets.rs index c9c5a160c..6bf6f57ca 100644 --- a/crates/ui-contract/src/runtime/egui/widgets.rs +++ b/crates/ui-contract/src/runtime/egui/widgets.rs @@ -86,7 +86,12 @@ pub(crate) struct ScrollRegion { #[cfg(feature = "testing")] pub(crate) fn note_scroll_region(ctx: &Context, view: Rect, content: Rect) { noted::with(ctx, |pass| pass.scrolls.push(ScrollRegion { view, content })); - crate::runtime::replay::journal(ctx, || (view, content), |ctx, &(view, content)| note_scroll_region(ctx, view, content)); + // The view cuts what lies outside it, as a clip does: a replay cut by the clip around it cuts the view too. + crate::runtime::replay::journal( + ctx, + || (crate::runtime::Clip::new(view), content), + |ctx, &(view, content)| note_scroll_region(ctx, view.rect(), content), + ); } #[cfg(not(feature = "testing"))]