core: layer deferred surfaces with draw priorities
This commit is contained in:
+21
-17
@@ -5,13 +5,13 @@ use gpui::{
|
||||
Animation, AnimationExt as _, AnyElement, App, DefiniteLength, ElementId,
|
||||
InteractiveElement as _, IntoElement, KeyDownEvent, MouseButton, ParentElement as _,
|
||||
RenderOnce, Role, ScrollHandle, SharedString, StatefulInteractiveElement as _, Styled as _,
|
||||
Window, canvas, div, ease_out_quint, relative,
|
||||
Window, canvas, deferred, div, ease_out_quint, relative,
|
||||
};
|
||||
use gpui_native_icons::IconRole;
|
||||
use gpui_native_theme::{ActiveTheme as _, TextRole, Typeset as _};
|
||||
|
||||
use crate::button::{Button, ButtonVariant};
|
||||
use crate::common::{Sizable, v_flex};
|
||||
use crate::common::{DIALOG_LAYER, Sizable, v_flex};
|
||||
use crate::scroll_area::ScrollArea;
|
||||
|
||||
/// Requests the dialog's close: `false` closes.
|
||||
@@ -136,7 +136,7 @@ impl RenderOnce for Dialog {
|
||||
let root = div().absolute().inset_0();
|
||||
|
||||
if !self.open {
|
||||
return root;
|
||||
return root.into_any_element();
|
||||
}
|
||||
|
||||
let (scrim_color, border, foreground, surface, radius, shadows, enter_duration) = {
|
||||
@@ -292,19 +292,23 @@ impl RenderOnce for Dialog {
|
||||
})
|
||||
});
|
||||
|
||||
root.flex()
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.p_4()
|
||||
.child(scrim.with_animation(
|
||||
"dialog-scrim-enter",
|
||||
Animation::new(enter_duration).with_easing(ease_out_quint()),
|
||||
|scrim, delta| scrim.opacity(delta),
|
||||
))
|
||||
.child(panel.with_animation(
|
||||
"dialog-enter",
|
||||
Animation::new(enter_duration).with_easing(ease_out_quint()),
|
||||
|panel, delta| panel.opacity(delta),
|
||||
))
|
||||
deferred(
|
||||
root.flex()
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.p_4()
|
||||
.child(scrim.with_animation(
|
||||
"dialog-scrim-enter",
|
||||
Animation::new(enter_duration).with_easing(ease_out_quint()),
|
||||
|scrim, delta| scrim.opacity(delta),
|
||||
))
|
||||
.child(panel.with_animation(
|
||||
"dialog-enter",
|
||||
Animation::new(enter_duration).with_easing(ease_out_quint()),
|
||||
|panel, delta| panel.opacity(delta),
|
||||
)),
|
||||
)
|
||||
.with_priority(DIALOG_LAYER)
|
||||
.into_any_element()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user