Merge PR #1097: configure block double-click editing

This commit is contained in:
Hakan Seven committed 2026-09-09 13:10:21 +03:00
commit f41d79221b
8 files changed
+86 -8

No files matched your search

+4
View File
@@ -365,6 +365,8 @@ impl OpenCADStudio {
zoom_factor: self.zoom_factor,
cursor_size: self.cursor_size,
pick_box: self.pick_box,
double_click_block_refedit: self.double_click_block_refedit,
double_click_block_attedit: self.double_click_block_attedit,
cursor_type: self.cursor_type,
crosshair_color: self.crosshair_color,
lineweight_display_scale: self.lineweight_display_scale,
@@ -418,6 +420,8 @@ impl OpenCADStudio {
self.zoom_factor = s.zoom_factor.clamp(3, 100);
self.cursor_size = s.cursor_size.clamp(1, 100);
self.pick_box = s.pick_box.clamp(0, 50);
self.double_click_block_refedit = s.double_click_block_refedit;
self.double_click_block_attedit = s.double_click_block_attedit;
self.cursor_type = s.cursor_type;
self.crosshair_color = s.crosshair_color;
self.crosshair_color_input = s
+12
View File
@@ -5916,6 +5916,18 @@ impl OpenCADStudio {
Task::none()
}
Message::DoubleClickBlockRefeditChanged(enabled) => {
self.double_click_block_refedit = enabled;
self.persist_settings_if_changed();
Task::none()
}
Message::DoubleClickBlockAtteditChanged(enabled) => {
self.double_click_block_attedit = enabled;
self.persist_settings_if_changed();
Task::none()
}
Message::CursorTypeChanged(value) => {
self.cursor_type = value;
self.persist_settings_if_changed();
+14 -6
View File
@@ -4734,15 +4734,17 @@ properties={:.1}ms picked={}",
return self.begin_text_edit(handle);
}
// Double-clicking a block with attributes opens the
// attribute editor (edit its values); a block with
// no attributes opens the block editor (BEDIT) — a
// space tab scoped to the block's own geometry, so
// edits reflect in every instance. (#136, #192, #261)
// attribute editor (edit its values). For blocks without
// attributes, Options > Drawing chooses BEDIT (default)
// or in-place REFEDIT. (#136, #192, #261)
let insert_has_attrs = matches!(
self.tabs[i].scene.document.get_entity(handle),
Some(AcadEntityType::Insert(ins)) if !ins.attributes.is_empty()
);
if insert_has_attrs && self.tabs[i].active_block_edit.is_none() {
if insert_has_attrs
&& self.double_click_block_attedit
&& self.tabs[i].active_block_edit.is_none()
{
return Task::done(Message::AttrEditorOpen(handle));
}
let is_insert = matches!(
@@ -4750,8 +4752,14 @@ properties={:.1}ms picked={}",
Some(AcadEntityType::Insert(_))
);
if is_insert && self.tabs[i].refedit_session.is_none() {
let command = if self.double_click_block_refedit {
"REFEDIT_BEGIN"
} else {
"BEDIT_BEGIN"
};
return Task::done(Message::Command(format!(
"BEDIT_BEGIN:{}",
"{}:{}",
command,
handle.value()
)));
}