forked from 1b-agent/opencadstudio-upstream
fix(text): grip-drag no longer hides text (#316)
Dragging text by a grip hid it until release. The dragged entity is hidden from the base wire set and shown as a preview overlay, but its SDF glyph quads (text_verts) were never uploaded for the preview, so the text vanished mid-drag. Add a per-frame preview_text GPU buffer (sibling to preview_wires). A rigid whole-entity move of pure text (TEXT/MTEXT, Square insertion grip) slides the drag-start glyphs by the drag delta instead of re-shaping the run every move; reshape grips (MTEXT width), dimensions and wire entities re-tessellate and feed the same buffer. Also fold preview_text into render_signature: a pure-text slide leaves preview_wires empty, so without it the scene-render cache froze the dragged text at its first frame (grip moved but text stayed, then jumped to place on release). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
88450f0cd1
commit
67fe363775
9 files changed
+176
-5
No files matched your search
@@ -120,6 +120,29 @@ pub fn push_glyph_vertices(
|
||||
}
|
||||
}
|
||||
|
||||
/// Slide every glyph vertex by a world-space delta, re-splitting the
|
||||
/// double-single position. Lets a grip drag move already-shaped text by
|
||||
/// translating the drag-start glyphs each frame instead of re-tessellating
|
||||
/// (re-shaping) the run on every cursor move (issue #316).
|
||||
pub fn translate_verts(verts: &[TextVertex], delta: [f64; 3]) -> Vec<TextVertex> {
|
||||
verts
|
||||
.iter()
|
||||
.map(|v| {
|
||||
let wx = v.pos[0] as f64 + v.pos_low[0] as f64 + delta[0];
|
||||
let wy = v.pos[1] as f64 + v.pos_low[1] as f64 + delta[1];
|
||||
let wz = v.pos[2] as f64 + v.pos_low[2] as f64 + delta[2];
|
||||
let (xh, xl) = split_ds(wx);
|
||||
let (yh, yl) = split_ds(wy);
|
||||
let (zh, zl) = split_ds(wz);
|
||||
TextVertex {
|
||||
pos: [xh, yh, zh],
|
||||
pos_low: [xl, yl, zl],
|
||||
..*v
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
// ── Atlas texture ───────────────────────────────────────────────────────────
|
||||
|
||||
/// The shared glyph atlas on the GPU: a single-channel (R8) SDF texture plus
|
||||
|
||||
Reference in new issue
Block a user