Store a z-index id per-layer

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Julia 2024-01-18 10:59:23 -05:00
parent 5b906e731d
commit 2c3d9805a4
9 changed files with 50 additions and 49 deletions

View file

@ -110,7 +110,7 @@ pub struct Style {
/// The mouse cursor style shown when the mouse pointer is over an element.
pub mouse_cursor: Option<CursorStyle>,
pub z_index: Option<u8>,
pub z_index: Option<u16>,
#[cfg(debug_assertions)]
pub debug: bool,
@ -337,7 +337,7 @@ impl Style {
let background_color = self.background.as_ref().and_then(Fill::color);
if background_color.map_or(false, |color| !color.is_transparent()) {
cx.with_z_index(0, |cx| {
cx.with_z_index(1, |cx| {
let mut border_color = background_color.unwrap_or_default();
border_color.a = 0.;
cx.paint_quad(quad(
@ -350,12 +350,12 @@ impl Style {
});
}
cx.with_z_index(0, |cx| {
cx.with_z_index(2, |cx| {
continuation(cx);
});
if self.is_border_visible() {
cx.with_z_index(0, |cx| {
cx.with_z_index(3, |cx| {
let corner_radii = self.corner_radii.to_pixels(bounds.size, rem_size);
let border_widths = self.border_widths.to_pixels(rem_size);
let max_border_width = border_widths.max();