forked from 1b-agent/opencadstudio-upstream
fix(annotate): correctly resolve Leader annotations in TEXTEDIT
- Custom recursive resolver ensures Leader entities trace back to their editable Text/MText annotations. - Bypasses overly strict baseline field checks so TEXTEDIT can natively target and launch the inline editor on Leaders.
This commit is contained in:
1 parent
9a258f29ce
commit
8e48bf02a0
2 files changed
+20
-6
No files matched your search
@@ -98,6 +98,25 @@ pub struct TextInlineState {
|
||||
/// Canvas-space anchor where the field is drawn (the insertion-point click).
|
||||
pub screen_anchor: iced::Point,
|
||||
}
|
||||
pub(super) fn can_edit_text(mut handle: Handle, document: &acadrust::CadDocument) -> bool {
|
||||
for _ in 0..8 {
|
||||
match document.get_entity(handle) {
|
||||
Some(acadrust::EntityType::Leader(l)) => {
|
||||
let ann = l.annotation_handle;
|
||||
if ann.is_null() || ann == handle {
|
||||
return false;
|
||||
}
|
||||
handle = ann;
|
||||
}
|
||||
_ => break,
|
||||
}
|
||||
}
|
||||
if let Some(entity) = document.get_entity(handle) {
|
||||
read_text_field(entity).is_some()
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
impl super::OpenCADStudio {
|
||||
/// Open the right in-place editor for `handle`: the plain box for single-
|
||||
|
||||
Reference in new issue
Block a user