forked from 1b-agent/opencadstudio-upstream
feat(block-editor): edit definition properties in the Properties panel
Add the no-selection Block section with annotation, orientation, scaling, exploding, units, description and hyperlink controls. Integrate definition edits with editor history, save checkpoints and discard, and keep staged text tied to its definition. Persist annotation and hyperlink metadata on the block record, migrate legacy marker values on edit, and honor orientation and hyperlink descriptions during block creation. Cover native DWG/DXF roundtrips and replacement after reopening.
This commit is contained in:
1 parent
f3973f08a7
commit
c48fac7ae9
9 files changed
+952
-7
No files matched your search
@@ -2655,6 +2655,9 @@ impl OpenCADStudio {
|
||||
field: &'static str,
|
||||
value: String,
|
||||
) -> Task<Message> {
|
||||
if field.starts_with("bedit_") {
|
||||
return self.set_block_property(field, &value);
|
||||
}
|
||||
if matches!(field, "dyn_constraint_form" | "dyn_constraint_reference") {
|
||||
return self.on_dynamic_dimension_choice(field, &value);
|
||||
}
|
||||
@@ -3886,6 +3889,9 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
pub(super) fn on_prop_geom_commit(&mut self, field: &'static str) -> Task<Message> {
|
||||
if field.starts_with("bedit_") {
|
||||
return self.commit_block_property(field);
|
||||
}
|
||||
use crate::ui::window::named_parameters::ParamField;
|
||||
// A dynamic dimension's Name/Expression rows edit its parameter.
|
||||
let dynamic_field = match field {
|
||||
|
||||
@@ -243,6 +243,7 @@ impl OpenCADStudio {
|
||||
Some(WriteBlock) => self.wblock = None,
|
||||
Some(Hyperlink) => {
|
||||
self.hyperlink_editor_handles.clear();
|
||||
self.hyperlink_editor_block = None;
|
||||
self.hyperlink_editor_url.clear();
|
||||
self.hyperlink_editor_description.clear();
|
||||
self.hyperlink_editor_mixed = false;
|
||||
@@ -5251,7 +5252,11 @@ impl OpenCADStudio {
|
||||
}
|
||||
Message::PropHyperlinkOpen => {
|
||||
let i = self.active_tab;
|
||||
self.hyperlink_editor_block = None;
|
||||
let handles = self.property_target_handles(i);
|
||||
if handles.is_empty() && self.open_block_property_hyperlink(i) {
|
||||
return Task::none();
|
||||
}
|
||||
if handles.is_empty() {
|
||||
return Task::none();
|
||||
}
|
||||
@@ -5311,6 +5316,9 @@ impl OpenCADStudio {
|
||||
return Task::none();
|
||||
}
|
||||
let description = self.hyperlink_editor_description.trim().to_owned();
|
||||
if self.hyperlink_editor_block.is_some() {
|
||||
return self.apply_block_property_hyperlink(&url, &description);
|
||||
}
|
||||
if let Some(block_def) = self.block_definition.as_mut() {
|
||||
block_def.hyperlink_url = url;
|
||||
block_def.hyperlink_desc = description;
|
||||
@@ -5340,6 +5348,9 @@ impl OpenCADStudio {
|
||||
Task::none()
|
||||
}
|
||||
Message::HyperlinkRemove => {
|
||||
if self.hyperlink_editor_block.is_some() {
|
||||
return self.apply_block_property_hyperlink("", "");
|
||||
}
|
||||
if let Some(block_def) = self.block_definition.as_mut() {
|
||||
block_def.hyperlink_url.clear();
|
||||
block_def.hyperlink_desc.clear();
|
||||
@@ -5858,6 +5869,7 @@ impl OpenCADStudio {
|
||||
Task::none()
|
||||
}
|
||||
Message::BlockDefHyperlink => {
|
||||
self.hyperlink_editor_block = None;
|
||||
if let Some(state) = self.block_definition.as_ref() {
|
||||
self.hyperlink_editor_url = state.hyperlink_url.clone();
|
||||
self.hyperlink_editor_description = state.hyperlink_desc.clone();
|
||||
|
||||
Reference in new issue
Block a user