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

+18 -5
View File
@@ -434,7 +434,17 @@ impl OpenCADStudio {
}
/// Add an entity to the correct space (model or paper space layout).
pub(super) fn commit_entity(&mut self, mut entity: acadrust::EntityType) {
pub(super) fn commit_entity(&mut self, entity: acadrust::EntityType) {
let _ = self.commit_entity_handle(entity);
}
/// Like [`commit_entity`] but returns the handle the new entity was given
/// (or `None` if it could not be added). Lets callers follow up — e.g.
/// open the in-place text editor on a freshly created MultiLeader.
pub(super) fn commit_entity_handle(
&mut self,
mut entity: acadrust::EntityType,
) -> Option<Handle> {
let i = self.active_tab;
let layer = &self.tabs[i].active_layer;
if layer != "0" || entity.as_entity().layer().is_empty() {
@@ -531,13 +541,16 @@ impl OpenCADStudio {
{
Ok(new_handle) => {
self.tabs[i].scene.auto_fit_viewport(new_handle);
Some(new_handle)
}
Err(e) => {
self.command_line
.push_error(&format!("Viewport could not be added: {e}"));
None
}
Err(e) => self
.command_line
.push_error(&format!("Viewport could not be added: {e}")),
}
} else {
self.tabs[i].scene.add_entity(entity);
Some(self.tabs[i].scene.add_entity(entity))
}
}
}