From dea8b59ac04caaa766ed3949aeff6b5089b9a945 Mon Sep 17 00:00:00 2001 From: lucasmerlin Date: Sun, 25 Jan 2026 22:10:10 +0100 Subject: [PATCH] Remove unnecessary scope from with_visual_transform --- crates/egui/src/ui.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/egui/src/ui.rs b/crates/egui/src/ui.rs index daabd10b0..d0b5b985e 100644 --- a/crates/egui/src/ui.rs +++ b/crates/egui/src/ui.rs @@ -2969,10 +2969,12 @@ impl Ui { (InnerResponse { inner, response }, payload) } - /// Create a new Scope and transform its contents via a [`emath::TSTransform`]. + /// Transform the contents of this closure via a [`emath::TSTransform`]. /// This only affects visuals, inputs will not be transformed. So this is mostly useful /// to create visual effects on interactions, e.g. scaling a button on hover / click. /// + /// This doesn't create a new scope, so it'll work fine within horizontal_wrapped layouts. + /// /// Check out [`Context::set_transform_layer`] for a persistent transform that also affects /// inputs. pub fn with_visual_transform( @@ -2985,7 +2987,7 @@ impl Ui { .map_or(crate::layers::ShapeIdx(0), |l| l.next_idx()) }); - let r = self.scope_dyn(UiBuilder::new(), Box::new(add_contents)); + add_contents(self); self.ctx().graphics_mut(|g| { let list = g.entry(self.layer_id());