Primitives · a raise keeps its state under its owner's id
A raise inside another was namespaced by its place in the layer's queue, so one that came before it moved its id path and rebuilt its keyed state and focus: an open date popup would lose its month when a tip appeared. raise now takes its owner's id and draws under it, and float and float_height pass the owner's id on from every call site. A test holds a focused box in a raise while another comes before it.
This commit is contained in:
1 parent
341420d1e4
commit
51ade29032
25 files changed
+188
-40
No files matched your search
@@ -271,6 +271,7 @@ impl RenderOnce for Dialog {
|
||||
let viewport = window.viewport_size();
|
||||
let top = cx.theme().titlebar_height().to_pixels(window.rem_size());
|
||||
return raise(
|
||||
(self.id.clone(), "raised"),
|
||||
anchored().position(point(Pixels::ZERO, top)).child(
|
||||
div()
|
||||
.w(viewport.width)
|
||||
|
||||
@@ -69,6 +69,7 @@ impl RenderOnce for FloatingToolbar {
|
||||
let lift = cx.theme().float_gap().to_pixels(window.rem_size());
|
||||
host.child(
|
||||
raise(
|
||||
(self.id.clone(), "raised"),
|
||||
anchored()
|
||||
.position(anchor.origin - point(gpui::Pixels::ZERO, lift))
|
||||
.anchor(Corner::BottomLeft)
|
||||
|
||||
@@ -132,6 +132,13 @@ impl RenderOnce for HoverCard {
|
||||
.size_full(),
|
||||
);
|
||||
let (anchor, height) = (state.read(cx).host, state.read(cx).height);
|
||||
host.child(float_height(anchor, height, card, window, cx))
|
||||
host.child(float_height(
|
||||
self.id.clone(),
|
||||
anchor,
|
||||
height,
|
||||
card,
|
||||
window,
|
||||
cx,
|
||||
))
|
||||
}
|
||||
}
|
||||
@@ -291,8 +291,11 @@ impl RenderOnce for Lightbox {
|
||||
),
|
||||
),
|
||||
);
|
||||
raise(anchored().position(Point::default()).child(stage))
|
||||
.with_priority(1)
|
||||
.into_any_element()
|
||||
raise(
|
||||
(self.id.clone(), "raised"),
|
||||
anchored().position(Point::default()).child(stage),
|
||||
)
|
||||
.with_priority(1)
|
||||
.into_any_element()
|
||||
}
|
||||
}
|
||||
@@ -176,6 +176,13 @@ impl RenderOnce for Popover {
|
||||
.left_0()
|
||||
.size_full(),
|
||||
);
|
||||
host.child(float_height(anchor, height, panel, window, cx))
|
||||
host.child(float_height(
|
||||
self.id.clone(),
|
||||
anchor,
|
||||
height,
|
||||
panel,
|
||||
window,
|
||||
cx,
|
||||
))
|
||||
}
|
||||
}
|
||||
@@ -193,13 +193,21 @@ fn light(
|
||||
div()
|
||||
.child(
|
||||
raise(
|
||||
(id.clone(), "raised"),
|
||||
anchored()
|
||||
.position(Point::default())
|
||||
.child(div().w(viewport.width).h(viewport.height).child(frame)),
|
||||
)
|
||||
.with_priority(1),
|
||||
)
|
||||
.child(float_height(target, card_height, card, window, cx))
|
||||
.child(float_height(
|
||||
(id.clone(), "card"),
|
||||
target,
|
||||
card_height,
|
||||
card,
|
||||
window,
|
||||
cx,
|
||||
))
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user