diff --git a/crates/egui/src/painter.rs b/crates/egui/src/painter.rs index 7c83fe88..ba8d2703 100644 --- a/crates/egui/src/painter.rs +++ b/crates/egui/src/painter.rs @@ -20,7 +20,7 @@ pub struct Painter { ctx: Context, /// Where we paint - zlayer: ZLayer, + z_layer: ZLayer, /// Everything painted in this [`Painter`] will be clipped against this. /// This means nothing outside of this rectangle will be visible on screen. @@ -36,7 +36,7 @@ impl Painter { pub fn new(ctx: Context, area_layer: AreaLayerId, clip_rect: Rect) -> Self { Self { ctx, - zlayer: ZLayer::from_area_layer(area_layer), + z_layer: ZLayer::from_area_layer(area_layer), clip_rect, fade_to_color: None, } @@ -44,10 +44,10 @@ impl Painter { /// Redirect where you are painting. #[must_use] - pub fn with_layer(self, zlayer: ZLayer) -> Self { + pub fn with_layer(self, z_layer: ZLayer) -> Self { Self { ctx: self.ctx, - zlayer: zlayer, + z_layer, clip_rect: self.clip_rect, fade_to_color: None, } @@ -62,7 +62,7 @@ impl Painter { /// Redirect z-index #[must_use] pub fn with_z(self, z: ZOrder) -> Self { - let layer = self.zlayer.area_layer.with_z(z); + let layer = self.z_layer.area_layer.with_z(z); self.with_layer(layer) } @@ -73,7 +73,7 @@ impl Painter { pub fn with_clip_rect(&self, rect: Rect) -> Self { Self { ctx: self.ctx.clone(), - zlayer: self.zlayer, + z_layer: self.z_layer, clip_rect: rect.intersect(self.clip_rect), fade_to_color: self.fade_to_color, } @@ -81,17 +81,17 @@ impl Painter { /// Redirect what area layer you are painting. pub fn set_layer_id(&mut self, area_layer: AreaLayerId) { - self.zlayer.area_layer = area_layer; + self.z_layer.area_layer = area_layer; } /// Redirect at what z order you are drawing pub fn set_z(&mut self, z: ZOrder) { - self.zlayer.z = z; + self.z_layer.z = z; } /// Redirect where you are drawing pub fn set_layer(&mut self, layer: ZLayer) { - self.zlayer = layer; + self.z_layer = layer; } /// If set, colors will be modified to look like this @@ -112,7 +112,7 @@ impl Painter { pub fn sub_region(&self, rect: Rect) -> Self { Self { ctx: self.ctx.clone(), - zlayer: self.zlayer, + z_layer: self.z_layer, clip_rect: rect.intersect(self.clip_rect), fade_to_color: self.fade_to_color, } @@ -138,18 +138,18 @@ impl Painter { /// Where we paint #[inline(always)] pub fn area_layer_id(&self) -> AreaLayerId { - self.zlayer.area_layer + self.z_layer.area_layer } /// Where we paint, and on what Z-level #[inline(always)] - pub fn zlayer(&self) -> ZLayer { - self.zlayer + pub fn z_layer(&self) -> ZLayer { + self.z_layer } #[inline(always)] pub fn z(&self) -> ZOrder { - self.zlayer.z + self.z_layer.z } /// Everything painted in this [`Painter`] will be clipped against this. @@ -189,7 +189,7 @@ impl Painter { impl Painter { fn paint_list(&self, writer: impl FnOnce(&mut PaintList) -> R) -> R { self.ctx - .graphics_mut(|g| writer(g.list(self.zlayer.area_layer))) + .graphics_mut(|g| writer(g.list(self.z_layer.area_layer))) } fn transform_shape(&self, shape: &mut Shape) { @@ -199,11 +199,11 @@ impl Painter { } fn add_to_paint_list(&self, shape: Shape) -> ShapeIdx { - self.paint_list(|l| l.add_at_z(self.clip_rect, shape, self.zlayer.z)) + self.paint_list(|l| l.add_at_z(self.clip_rect, shape, self.z_layer.z)) } fn extend_paint_list(&self, shapes: impl IntoIterator) { - self.paint_list(|l| l.extend_at_z(self.clip_rect, shapes, self.zlayer.z)); + self.paint_list(|l| l.extend_at_z(self.clip_rect, shapes, self.z_layer.z)); } fn set_shape_in_paint_list(&self, idx: ShapeIdx, shape: Shape) { diff --git a/crates/egui/src/ui.rs b/crates/egui/src/ui.rs index a318a500..b2776db2 100644 --- a/crates/egui/src/ui.rs +++ b/crates/egui/src/ui.rs @@ -327,8 +327,8 @@ impl Ui { } #[inline] - pub fn zlayer(&self) -> ZLayer { - self.painter().zlayer() + pub fn z_layer(&self) -> ZLayer { + self.painter().z_layer() } /// The height of text of this text style @@ -633,7 +633,7 @@ impl Ui { self.ctx().interact( self.clip_rect(), self.spacing().item_spacing, - self.zlayer(), + self.z_layer(), id, rect, sense,