feat(text): in-place editors for all text entities

Route every text-bearing entity to an in-place editor instead of the
command line: a plain text box for single-line text (Text, attributes,
dimension override, tolerance) and the rich MText editor for MText /
MultiLeader. A Leader resolves to the entity it annotates.

- TEXT places a plain text box at the click; double-click edits in place.
- DDEDIT and double-click on any text entity open the matching editor.
- MLEADER places the leader then opens the MText editor on its content.
- LEADER follows the classic flow: points, Enter, then a linked empty
  MText annotation opens in the editor; the leader's annotation_handle
  links the pair so they edit/erase as a unit.

Adds shared field read/write helpers and a begin_text_edit router, plus
CommitAndEditText / CommitManyAndEditText results that commit an entity
and open its editor (commit_entity now returns the new handle).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-05-31 14:44:18 +03:00
1 parent ac9022676f
commit 2627d06224
13 files changed
+551 -346

No files matched your search

+9
View File
@@ -6,6 +6,7 @@ mod history;
mod layers;
mod mtext_editor;
mod properties;
mod text_inline;
mod update;
mod view;
@@ -253,6 +254,8 @@ pub(super) struct OpenCADStudio {
shift_down: bool,
/// Open in-place MText editor (toolbar + text area + live preview), if any.
mtext_editor: Option<mtext_editor::MTextEditorState>,
/// Open in-place single-line TEXT editor (plain text-entry box), if any.
text_inline: Option<text_inline::TextInlineState>,
/// Which layout tab has its context menu open (None = closed).
layout_context_menu: Option<String>,
/// Inline rename state: (original_name, current_edit_value).
@@ -755,6 +758,11 @@ pub enum Message {
MTextOk,
/// Discard the editor without creating / changing the entity.
MTextCancel,
// ── In-place single-line TEXT editor ────────────────────────────────
/// Text-field input changed.
TextInlineInput(String),
/// Commit the editor: create or update the TEXT entity.
TextInlineOk,
// ── Draw Order context menu ─────────────────────────────────────────
/// Toggle the Draw Order sub-items in the viewport context menu.
DrawOrderSubmenuToggle,
@@ -996,6 +1004,7 @@ impl OpenCADStudio {
clipboard_centroid: glam::Vec3::ZERO,
shift_down: false,
mtext_editor: None,
text_inline: None,
layout_context_menu: None,
layout_rename_state: None,
last_vp_click_time: None,