1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Remove unnecessary scope from with_visual_transform

This commit is contained in:
lucasmerlin
2026-01-25 22:10:10 +01:00
parent 73b7b9e225
commit dea8b59ac0

View File

@@ -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<R>(
@@ -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());