feat: Implement in-place MText editor with formatting toolbar and live preview

MTEXT (and double-clicking an MText) now opens an in-place editor anchored
at the insertion point instead of typing a single line on the command line.

The editor has a two-row formatting toolbar: text style / font / height,
bold, italic, underline, overline, strike, upper/lowercase and a colour
dropdown on top; oblique angle, width factor, character spacing, paragraph
alignment, justification, line spacing and OK/Cancel below. Character
toggles wrap the selection in DXF inline codes; global fields apply as
leading runs or entity properties.

Editing is shown in the editor's own area, not on the drawing: a Code/Preview
toggle switches between the raw text input and a rendered preview canvas that
draws the tessellated glyph strokes at real size, scrolling when the text
outgrows the view. The MText box keeps a fixed width so text wraps to the
next line instead of stretching into one line.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-05-31 01:51:20 +03:00
1 parent de08bd598c
commit a5ad0666ce
4 files changed
+75 -43

No files matched your search

+7
View File
@@ -3539,6 +3539,13 @@ impl OpenCADStudio {
self.rebuild_mtext_preview();
Task::none()
}
Message::MTextTogglePreview => {
if let Some(ed) = self.mtext_editor.as_mut() {
ed.show_preview = !ed.show_preview;
}
self.rebuild_mtext_preview();
Task::none()
}
Message::MTextOk => {
self.mtext_commit();
Task::none()