diff --git a/crates/egui/src/layers.rs b/crates/egui/src/layers.rs index fedc7571..ae250f09 100644 --- a/crates/egui/src/layers.rs +++ b/crates/egui/src/layers.rs @@ -124,27 +124,9 @@ impl AreaLayerId { pub struct ZOrder(pub i32); impl ZOrder { - const BASE: ZOrder = ZOrder(0); - const ABOVE_ALL: ZOrder = ZOrder(i32::MAX); - const BELOW_ALL: ZOrder = ZOrder(i32::MIN); - - /// Base z-order, corresponding to a level of 0 - #[inline(always)] - pub fn base() -> Self { - Self::BASE - } - - /// Maximal z-order - nothing on the same area layer can render above this - #[inline(always)] - pub fn above_all() -> Self { - Self::ABOVE_ALL - } - - /// Minimal z-order - nothing on the same area layer can render below this - #[inline(always)] - pub fn below_all() -> Self { - Self::BELOW_ALL - } + pub const BASE: ZOrder = ZOrder(0); + pub const ABOVE_ALL: ZOrder = ZOrder(i32::MAX); + pub const BELOW_ALL: ZOrder = ZOrder(i32::MIN); /// Directly above pub fn above(self) -> Self { @@ -278,7 +260,7 @@ impl PaintList { /// Returns the index of the new [`Shape`] at base z-index that can be used with `PaintList::set`. #[inline(always)] pub fn add(&mut self, clip_rect: Rect, shape: Shape) -> ShapeIdx { - self.add_at_z(clip_rect, shape, ZOrder::base()) + self.add_at_z(clip_rect, shape, ZOrder::BASE) } pub fn extend_at_z>( @@ -295,7 +277,7 @@ impl PaintList { } pub fn extend>(&mut self, clip_rect: Rect, shapes: I) { - self.extend_at_z(clip_rect, shapes, ZOrder::base()); + self.extend_at_z(clip_rect, shapes, ZOrder::BASE); } /// Modify an existing [`Shape`]. diff --git a/examples/z_order/src/main.rs b/examples/z_order/src/main.rs index 033d20f1..1fa8d056 100644 --- a/examples/z_order/src/main.rs +++ b/examples/z_order/src/main.rs @@ -71,7 +71,7 @@ impl eframe::App for MyApp { }); } - let base = ZOrder::base(); + let base = ZOrder::BASE; let above = base.above(); draw_squares(ui, Vec2::new(0.0, 0.0), base, above);