text editor
git clone https://git.lucas.co/cce-text-editor.git
feat: dropdown popover on the direct PaintCtx path
PaintCtx is a RenderTarget — render_popover draws the real expanded
inset-plate surface (the status-interface grown-trigger treatment) with
its own per-label bounds; the PopoverCollector flatten-and-rebound
replay is gone. Where missing, ui_context_mut is exposed so the engine
ticks the context and drives the expand/contract animation frames.
Co-Authored-By: Claude Fable 5 <[email protected]>
src/main.rs | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index f491d3b..48432e2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -451,21 +451,10 @@ impl Application for TextEditorApp {
// it hit-tests (the engine xdg popup is gone). Labels carry bounds equal to the
// popover rect: clips them to the plate and exempts them from the occlusion clamp
// (the is-overlay-text convention).
- if let Some((px, py, pw, ph)) = self.menu_dropdown.popover_rect() {
- let mut coll = cce_ui::layout::PopoverCollector::new();
- self.menu_dropdown.render_popover(&mut coll);
- for &(c, x, y, qw, qh) in &coll.rects {
- pc.quad(Rect { x, y, width: qw, height: qh }, c);
- }
- let pop_bounds = Some([px, py, px + pw, py + ph]);
- for (content, size, tx, ty, color, font, _bounds) in coll.texts {
- let color_u8 = [
- (color[0] * 255.0).clamp(0.0, 255.0) as u8,
- (color[1] * 255.0).clamp(0.0, 255.0) as u8,
- (color[2] * 255.0).clamp(0.0, 255.0) as u8,
- ];
- pc.text_with(content, tx, ty, size, color_u8, font, pop_bounds);
- }
+ if self.menu_dropdown.popover_rect().is_some() {
+ // PaintCtx is a RenderTarget: the popover draws its real prims (the
+ // dropdown's expanded inset-plate surface) with its own bounds.
+ self.menu_dropdown.render_popover(&mut pc);
}
Some(pc.finish())
}