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:
ZacharyZhang-NY committed 2026-09-27 02:23:05 -04:00
1 parent 341420d1e4
commit 51ade29032
25 files changed
+188 -40

No files matched your search

+20 -4
View File
@@ -382,10 +382,25 @@ pub(crate) fn hang(
}
});
let placed = match spot {
Spot::Under => float(state.read(cx).anchor, menu.entries.len(), root, window, cx),
Spot::At(point) => raise(anchored().position(point).snap_to_window().child(
root.with_animation((id.clone(), "in"), enter.clone(), |root, t| root.opacity(t)),
))
Spot::Under => float(
(id.clone(), "panel"),
state.read(cx).anchor,
menu.entries.len(),
root,
window,
cx,
),
Spot::At(point) => raise(
(id.clone(), "panel"),
anchored()
.position(point)
.snap_to_window()
.child(
root.with_animation((id.clone(), "in"), enter.clone(), |root, t| {
root.opacity(t)
}),
),
)
.with_priority(1)
.into_any_element(),
};
@@ -393,6 +408,7 @@ pub(crate) fn hang(
let row = state.read(cx).levels[level - 1].row;
(row != Bounds::default()).then(|| {
raise(
(id.clone(), format!("level-{level}")),
anchored().position(row.top_right()).snap_to_window().child(
draw::panel(id, menu, state, level, &close, None, cx)
.mt_neg_1()
+1
View File
@@ -303,6 +303,7 @@ impl RenderOnce for PieMenu {
});
region.child(
raise(
(self.id.clone(), "raised"),
anchored()
.position(point(Pixels::ZERO, Pixels::ZERO))
.child(