gpui: Rework overlay element (#9911)

There was a problem using deferred draws with `overlay` and tooltips at
the same time.

The `overlay` element was removed and was split up into two separate
elements
- `deferred`
- `anchored` - Mimics the `overlay` behavior but does not render its
children as deferred

`tooltip_container` does not defer its drawing anymore and only uses
`anchored`.

/cc @as-cii 


Release Notes:
- Fixed tooltip for the recent projects popover not showing anymore

---------

Co-authored-by: Antonio <antonio@zed.dev>
This commit is contained in:
Bennet Bo Fenner 2024-03-29 16:26:16 +01:00 committed by GitHub
parent 49144d94bf
commit 77f1cc95b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 144 additions and 136 deletions

View file

@ -1,4 +1,4 @@
use gpui::{overlay, Action, AnyView, IntoElement, Render, VisualContext};
use gpui::{anchored, Action, AnyView, IntoElement, Render, VisualContext};
use settings::Settings;
use theme::ThemeSettings;
@ -90,8 +90,8 @@ pub fn tooltip_container<V>(
f: impl FnOnce(Div, &mut ViewContext<V>) -> Div,
) -> impl IntoElement {
let ui_font = ThemeSettings::get_global(cx).ui_font.family.clone();
overlay().child(
// padding to avoid mouse cursor
// padding to avoid mouse cursor
anchored().child(
div().pl_2().pt_2p5().child(
v_flex()
.elevation_2(cx)