From c2c7eead8a22baf006bfbb7ae619f5377c87587e Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Thu, 14 Dec 2023 10:02:54 -0700 Subject: [PATCH] Robustify checks for visibility --- crates/gpui2/src/elements/div.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/crates/gpui2/src/elements/div.rs b/crates/gpui2/src/elements/div.rs index 6b1dd3e5458ff83347d9e4c1ccfb4a7c878cd6fa..bb8e76c627fa65916380bec773cf7f69b46fdda5 100644 --- a/crates/gpui2/src/elements/div.rs +++ b/crates/gpui2/src/elements/div.rs @@ -642,10 +642,6 @@ impl Element for Div { &mut element_state.interactive_state, cx, |style, scroll_offset, cx| { - if style.visibility == Visibility::Hidden { - return; - } - let z_index = style.z_index.unwrap_or(0); cx.with_z_index(z_index, |cx| { @@ -779,6 +775,10 @@ impl Interactivity { ) { let style = self.compute_style(Some(bounds), element_state, cx); + if style.visibility == Visibility::Hidden { + return; + } + #[cfg(debug_assertions)] if self.element_id.is_some() && (style.debug || style.debug_below || cx.has_global::()) @@ -890,11 +890,10 @@ impl Interactivity { }); } - if style.visibility == Visibility::Visible - && style - .background - .as_ref() - .is_some_and(|fill| fill.color().is_some()) + if style + .background + .as_ref() + .is_some_and(|fill| fill.color().is_some_and(|color| !color.is_transparent())) { cx.with_z_index(style.z_index.unwrap_or(0), |cx| cx.add_opaque_layer(bounds)) }