forked from 1b-agent/opencadstudio-upstream
fix(text): show text in command previews (move/copy/etc) (#316)
Command previews (MOVE, COPY, ROTATE, SCALE, STRETCH, MIRROR, ARRAY, PASTE, INSERT) build ghost WireModels via WireModel::translated/rotated/ scaled/stretched/mirrored, but those helpers moved only `points`, never `text_verts`, and the ghosts' glyphs were never uploaded — so text vanished (or froze at its source) during the preview, same root cause as the grip-drag case. Transform text_verts alongside points in all five helpers (shared map_text_verts, reconstructing + re-splitting the double-single world position), and gather preview_wires' glyphs into the per-frame preview-text buffer in the render path. This covers every command preview automatically. The grip-drag else branch no longer sets preview_text explicitly (the render gather handles it); the grip-slide fast path keeps its own scene.preview_text channel (empty preview_wires, so no double-draw). MIRROR honours MIRRTEXT: on -> true glyph mirror via mirrored(); off -> readable relocation via translated(). Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
67fe363775
commit
f5870b011d
4 files changed
+95
-14
No files matched your search
@@ -812,12 +812,11 @@ pub(super) fn on_tick(&mut self, t: Instant) -> Task<Message> {
|
||||
self.tabs[i].scene.set_preview_text(slid);
|
||||
self.tabs[i].scene.set_preview_wires(Vec::new());
|
||||
} else {
|
||||
// Wire geometry, or a reshape grip: re-tessellate. The
|
||||
// preview WireModels carry the entity's glyphs (gathered
|
||||
// for the preview-text buffer in the render path), so a
|
||||
// dimension / MTEXT-width drag keeps its text visible too.
|
||||
let preview = self.tabs[i].scene.wire_models_for(&[grip.handle]);
|
||||
let ptext = preview
|
||||
.iter()
|
||||
.flat_map(|w| w.text_verts.iter().copied())
|
||||
.collect();
|
||||
self.tabs[i].scene.set_preview_text(ptext);
|
||||
self.tabs[i].scene.set_preview_wires(preview);
|
||||
}
|
||||
self.refresh_selected_grips();
|
||||
|
||||
Reference in new issue
Block a user