forked from 1b-agent/opencadstudio-upstream
fix(mleader): repair creation and editing
This commit is contained in:
commit
ff1f873633
40 files changed
+4504
-1754
No files matched your search
+300
-115
@@ -856,7 +856,7 @@ impl OpenCADStudio {
|
||||
.infer_dimension_sources(handle);
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.attach_dimension_association(handle, sources.to_vec());
|
||||
.attach_dimension_association(handle, sources);
|
||||
}
|
||||
}
|
||||
self.tabs[i].dirty = true;
|
||||
@@ -1269,7 +1269,7 @@ impl OpenCADStudio {
|
||||
.infer_dimension_sources(handle);
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.attach_dimension_association(handle, sources.to_vec());
|
||||
.attach_dimension_association(handle, sources);
|
||||
}
|
||||
}
|
||||
self.tabs[i].dirty = true;
|
||||
@@ -1287,6 +1287,8 @@ impl OpenCADStudio {
|
||||
CmdResult::CommitDimension {
|
||||
mut entity,
|
||||
association,
|
||||
preserve_base_style,
|
||||
continue_command,
|
||||
} => {
|
||||
let label = self.history_label_from_active_cmd(i, "DIMENSION");
|
||||
let association_mode = self.tabs[i]
|
||||
@@ -1300,6 +1302,17 @@ impl OpenCADStudio {
|
||||
acadrust::entities::Dimension::Ordinate(_)
|
||||
)
|
||||
);
|
||||
let inherited_dimension = if preserve_base_style {
|
||||
match &entity {
|
||||
acadrust::EntityType::Dimension(dimension) => Some((
|
||||
dimension.base().common.layer.clone(),
|
||||
dimension.base().style_name.clone(),
|
||||
)),
|
||||
_ => None,
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let pending = if association_mode == 0 {
|
||||
let layer = self.tabs[i].active_layer.clone();
|
||||
if layer != "0" || entity.as_entity().layer().is_empty() {
|
||||
@@ -1330,6 +1343,12 @@ impl OpenCADStudio {
|
||||
&self.tabs[i].scene.document,
|
||||
&mut entity,
|
||||
);
|
||||
if let (Some((layer, style_name)), acadrust::EntityType::Dimension(dimension)) =
|
||||
(inherited_dimension, &mut entity)
|
||||
{
|
||||
dimension.base_mut().common.layer = layer;
|
||||
dimension.base_mut().style_name = style_name;
|
||||
}
|
||||
let pieces = crate::modules::draw::modify::explode::explode_entity(
|
||||
&entity,
|
||||
&self.tabs[i].scene.document,
|
||||
@@ -1345,7 +1364,10 @@ impl OpenCADStudio {
|
||||
} else {
|
||||
let delta_safe = self.delta_add_safe(i, &entity);
|
||||
let pending = self.begin_undo(i, label, 1, delta_safe);
|
||||
if let Some(handle) = self.commit_entity_handle(entity) {
|
||||
if let Some(handle) = self.commit_entity_handle_with_dimension_policy(
|
||||
entity,
|
||||
preserve_base_style,
|
||||
) {
|
||||
if association_mode == 2 {
|
||||
let mut changes = vec![
|
||||
(handle, crate::scene::ChangeKind::Modified),
|
||||
@@ -1357,8 +1379,6 @@ impl OpenCADStudio {
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.infer_dimension_sources(handle)
|
||||
.into_iter()
|
||||
.collect()
|
||||
},
|
||||
|source| {
|
||||
if single_source_dimension {
|
||||
@@ -1393,12 +1413,195 @@ impl OpenCADStudio {
|
||||
};
|
||||
self.tabs[i].dirty = true;
|
||||
self.tabs[i].scene.clear_preview_wire();
|
||||
self.tabs[i].active_cmd = None;
|
||||
self.tabs[i].snap_result = None;
|
||||
self.restore_pre_cmd_tangent();
|
||||
if let Some(pd) = pending {
|
||||
self.commit_undo_delta(i, pd);
|
||||
}
|
||||
if continue_command {
|
||||
if let Some(prompt) = self.tabs[i]
|
||||
.active_cmd
|
||||
.as_ref()
|
||||
.map(|cmd| cmd.prompt())
|
||||
{
|
||||
self.command_line.push_info(&prompt);
|
||||
}
|
||||
} else {
|
||||
self.tabs[i].active_cmd = None;
|
||||
self.restore_pre_cmd_tangent();
|
||||
}
|
||||
}
|
||||
CmdResult::CommitDimensionsAndExit(dimensions) => {
|
||||
let association_mode = self.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.header
|
||||
.dimension_associativity;
|
||||
let mut made = 0;
|
||||
let pending = if association_mode == 0 {
|
||||
let mut pieces = Vec::new();
|
||||
for (mut entity, _) in dimensions {
|
||||
let layer = self.tabs[i].active_layer.clone();
|
||||
if layer != "0" || entity.as_entity().layer().is_empty() {
|
||||
entity.as_entity_mut().set_layer(layer);
|
||||
}
|
||||
crate::scene::view::dispatch::apply_color(
|
||||
&mut entity,
|
||||
self.ribbon.active_color,
|
||||
);
|
||||
crate::scene::view::dispatch::apply_common_prop(
|
||||
&mut entity,
|
||||
"linetype",
|
||||
&self.ribbon.active_linetype.clone(),
|
||||
);
|
||||
crate::scene::view::dispatch::apply_line_weight(
|
||||
&mut entity,
|
||||
self.ribbon.active_lineweight,
|
||||
);
|
||||
let celtscale = self.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.header
|
||||
.current_entity_linetype_scale;
|
||||
if (celtscale - 1.0).abs() > 1e-9 && celtscale.abs() > 1e-9 {
|
||||
entity.common_mut().linetype_scale = celtscale;
|
||||
}
|
||||
crate::scene::creation_style::apply_current_creation_styles(
|
||||
&self.tabs[i].scene.document,
|
||||
&mut entity,
|
||||
);
|
||||
let exploded = crate::modules::draw::modify::explode::explode_entity(
|
||||
&entity,
|
||||
&self.tabs[i].scene.document,
|
||||
);
|
||||
if !exploded.is_empty() {
|
||||
made += 1;
|
||||
}
|
||||
pieces.extend(exploded);
|
||||
}
|
||||
let delta_safe = pieces
|
||||
.iter()
|
||||
.all(|piece| self.delta_add_safe(i, piece));
|
||||
let pending = self.begin_undo(i, "QDIM", pieces.len(), delta_safe);
|
||||
for piece in pieces {
|
||||
self.tabs[i].scene.add_entity(piece);
|
||||
}
|
||||
pending
|
||||
} else {
|
||||
let delta_safe = dimensions
|
||||
.iter()
|
||||
.all(|(entity, _)| self.delta_add_safe(i, entity));
|
||||
let pending = self.begin_undo(i, "QDIM", dimensions.len(), delta_safe);
|
||||
for (entity, association) in dimensions {
|
||||
let Some(handle) = self.commit_entity_handle(entity) else {
|
||||
continue;
|
||||
};
|
||||
made += 1;
|
||||
if association_mode != 2 {
|
||||
continue;
|
||||
}
|
||||
let sources = match association {
|
||||
crate::command::DimensionAssociationInput::Infer(source) => {
|
||||
source.map_or_else(
|
||||
|| {
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.infer_dimension_sources(handle)
|
||||
.into_iter()
|
||||
.map(|source| {
|
||||
source.map(
|
||||
crate::command::DimensionAssociationSource::inferred,
|
||||
)
|
||||
})
|
||||
.collect()
|
||||
},
|
||||
|source| {
|
||||
vec![Some(
|
||||
crate::command::DimensionAssociationSource::inferred(
|
||||
source,
|
||||
),
|
||||
)]
|
||||
},
|
||||
)
|
||||
}
|
||||
crate::command::DimensionAssociationInput::Explicit(sources) => {
|
||||
sources
|
||||
}
|
||||
};
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.attach_dimension_association_sources(handle, sources.clone());
|
||||
let mut changes = vec![(handle, crate::scene::ChangeKind::Modified)];
|
||||
changes.extend(sources.into_iter().flatten().map(|source| {
|
||||
(source.handle, crate::scene::ChangeKind::Modified)
|
||||
}));
|
||||
changes.sort_by_key(|(handle, _)| handle.value());
|
||||
changes.dedup_by_key(|(handle, _)| handle.value());
|
||||
self.tabs[i].scene.bump_entities(&changes);
|
||||
}
|
||||
pending
|
||||
};
|
||||
if made > 0 {
|
||||
self.tabs[i].dirty = true;
|
||||
}
|
||||
self.tabs[i].scene.clear_preview_wire();
|
||||
self.tabs[i].active_cmd = None;
|
||||
self.tabs[i].snap_result = None;
|
||||
self.restore_pre_cmd_tangent();
|
||||
self.command_line
|
||||
.push_output(crate::tf!("QDIM {made} dimensions created.").as_ref());
|
||||
if let Some(pd) = pending {
|
||||
self.commit_undo_delta(i, pd);
|
||||
}
|
||||
}
|
||||
CmdResult::SetQuickDimensionSnapPriority(priority) => {
|
||||
self.quick_dimension_snap_priority = priority.min(1);
|
||||
self.persist_settings_if_changed();
|
||||
let prompt = self.tabs[i].active_cmd.as_ref().map(|command| command.prompt());
|
||||
if let Some(prompt) = prompt {
|
||||
self.command_line.push_info(&prompt);
|
||||
}
|
||||
}
|
||||
CmdResult::AlignMLeaders {
|
||||
mut handles,
|
||||
from,
|
||||
to,
|
||||
} => {
|
||||
handles.retain(|handle| {
|
||||
!self.tabs[i].scene.is_layer_locked(*handle)
|
||||
&& matches!(
|
||||
self.tabs[i].scene.document.get_entity(*handle),
|
||||
Some(acadrust::EntityType::MultiLeader(_))
|
||||
)
|
||||
});
|
||||
if !handles.is_empty() {
|
||||
self.push_undo_snapshot(i, "MLEADERALIGN");
|
||||
if apply_mleader_align(&mut self.tabs[i].scene, &handles, from, to) {
|
||||
self.tabs[i].dirty = true;
|
||||
self.command_line.push_output(
|
||||
crate::t!("MLEADERALIGN Leaders aligned.").as_ref(),
|
||||
);
|
||||
}
|
||||
}
|
||||
self.tabs[i].scene.clear_preview_wire();
|
||||
self.tabs[i].active_cmd = None;
|
||||
self.tabs[i].snap_result = None;
|
||||
self.restore_pre_cmd_tangent();
|
||||
}
|
||||
CmdResult::CollectMLeaders { handles, point } => {
|
||||
let compatible = compatible_mleader_collect_handles(&self.tabs[i].scene, &handles);
|
||||
if compatible.len() >= 2 {
|
||||
self.push_undo_snapshot(i, "MLEADERCOLLECT");
|
||||
if apply_mleader_collect(&mut self.tabs[i].scene, &compatible, point) {
|
||||
self.tabs[i].dirty = true;
|
||||
self.command_line.push_output(
|
||||
crate::t!("MLEADERCOLLECT Leaders collected.").as_ref(),
|
||||
);
|
||||
}
|
||||
}
|
||||
self.tabs[i].scene.clear_preview_wire();
|
||||
self.tabs[i].active_cmd = None;
|
||||
self.tabs[i].snap_result = None;
|
||||
self.restore_pre_cmd_tangent();
|
||||
}
|
||||
CmdResult::CommitSolid {
|
||||
entity,
|
||||
@@ -1859,30 +2062,6 @@ impl OpenCADStudio {
|
||||
self.tabs[i].snap_result = None;
|
||||
return Task::none();
|
||||
}
|
||||
if layer.starts_with("__MLEADERALIGN__") {
|
||||
self.push_undo_snapshot(i, "MLEADERALIGN");
|
||||
if let Some(encoded) = layer.strip_prefix("__MLEADERALIGN__") {
|
||||
apply_mleader_align(&mut self.tabs[i].scene, encoded);
|
||||
}
|
||||
self.command_line
|
||||
.push_output(crate::t!("MLEADERALIGN Leaders aligned.").as_ref());
|
||||
self.tabs[i].dirty = true;
|
||||
self.tabs[i].active_cmd = None;
|
||||
self.tabs[i].snap_result = None;
|
||||
return Task::none();
|
||||
}
|
||||
if layer.starts_with("__MLEADERCOLLECT__") {
|
||||
self.push_undo_snapshot(i, "MLEADERCOLLECT");
|
||||
if let Some(encoded) = layer.strip_prefix("__MLEADERCOLLECT__") {
|
||||
apply_mleader_collect(&mut self.tabs[i].scene, encoded);
|
||||
}
|
||||
self.command_line
|
||||
.push_output(crate::t!("MLEADERCOLLECT Leaders collected.").as_ref());
|
||||
self.tabs[i].dirty = true;
|
||||
self.tabs[i].active_cmd = None;
|
||||
self.tabs[i].snap_result = None;
|
||||
return Task::none();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2245,11 +2424,10 @@ impl OpenCADStudio {
|
||||
.map(|e| crate::entities::dim_override::pairs(&e.common().extended_data));
|
||||
|
||||
if let Some(common) = src_common {
|
||||
self.push_undo_snapshot(i, "MATCHPROP");
|
||||
for h in &dest {
|
||||
self.apply_property_op(i, "MATCHPROP", &dest, |app, handle| {
|
||||
let mut is_dim = false;
|
||||
let mut is_hatch = false;
|
||||
if let Some(e) = self.tabs[i].scene.document.get_entity_mut(*h) {
|
||||
if let Some(e) = app.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
e.as_entity_mut().set_layer(common.layer.clone());
|
||||
crate::scene::view::dispatch::apply_color(e, common.color);
|
||||
crate::scene::view::dispatch::apply_line_weight(e, common.line_weight);
|
||||
@@ -2284,8 +2462,8 @@ impl OpenCADStudio {
|
||||
if is_hatch {
|
||||
if let Some(values) = &hatch_background_xdata {
|
||||
crate::scene::view::dispatch::set_entity_xdata(
|
||||
&mut self.tabs[i].scene.document,
|
||||
*h,
|
||||
&mut app.tabs[i].scene.document,
|
||||
handle,
|
||||
"HATCHBACKGROUNDCOLOR",
|
||||
values.clone(),
|
||||
);
|
||||
@@ -2296,7 +2474,7 @@ impl OpenCADStudio {
|
||||
// stale raw record survives.
|
||||
if dstyle_xdata.is_some()
|
||||
|| matches!(
|
||||
self.tabs[i].scene.document.get_entity(*h),
|
||||
app.tabs[i].scene.document.get_entity(handle),
|
||||
Some(
|
||||
acadrust::EntityType::Dimension(_)
|
||||
| acadrust::EntityType::Leader(_)
|
||||
@@ -2304,7 +2482,7 @@ impl OpenCADStudio {
|
||||
)
|
||||
{
|
||||
if matches!(
|
||||
self.tabs[i].scene.document.get_entity(*h),
|
||||
app.tabs[i].scene.document.get_entity(handle),
|
||||
Some(
|
||||
acadrust::EntityType::Dimension(_)
|
||||
| acadrust::EntityType::Leader(_)
|
||||
@@ -2317,8 +2495,8 @@ impl OpenCADStudio {
|
||||
)
|
||||
) {
|
||||
crate::entities::dim_override::replace(
|
||||
&mut self.tabs[i].scene.document,
|
||||
*h,
|
||||
&mut app.tabs[i].scene.document,
|
||||
handle,
|
||||
dstyle_xdata.clone().unwrap_or_default(),
|
||||
);
|
||||
}
|
||||
@@ -2326,12 +2504,11 @@ impl OpenCADStudio {
|
||||
// A restyled dimension renders from its baked *D block —
|
||||
// drop the stale block so the new style shows (#398).
|
||||
if is_dim {
|
||||
self.tabs[i].scene.invalidate_dim_block_recorded(*h);
|
||||
app.tabs[i].scene.invalidate_dim_block_recorded(handle);
|
||||
}
|
||||
// Hatch fills render from a prebuilt model (#415).
|
||||
self.tabs[i].scene.refresh_fill_model(*h);
|
||||
}
|
||||
self.tabs[i].dirty = true;
|
||||
app.tabs[i].scene.refresh_fill_model(handle);
|
||||
});
|
||||
// Color / linetype / lineweight are baked into the cached
|
||||
// wires at tessellation time; re-tessellate only the matched
|
||||
// objects instead of rebuilding a large drawing.
|
||||
@@ -2341,7 +2518,6 @@ impl OpenCADStudio {
|
||||
.map(|handle| (handle, crate::scene::ChangeKind::Modified))
|
||||
.collect();
|
||||
self.tabs[i].scene.bump_entities(&changes);
|
||||
self.refresh_properties();
|
||||
self.command_line
|
||||
.push_info(crate::tf!("Properties matched to {} object(s).", dest.len()).as_ref());
|
||||
// Clear the consumed target selection and keep prompting.
|
||||
@@ -4440,50 +4616,35 @@ fn apply_dimspace(scene: &mut crate::scene::Scene, encoded: &str) {
|
||||
}
|
||||
}
|
||||
|
||||
// ── MLEADERALIGN helper ───────────────────────────────────────────────────────
|
||||
fn apply_mleader_align(
|
||||
scene: &mut crate::scene::Scene,
|
||||
handles: &[acadrust::Handle],
|
||||
from: glam::DVec3,
|
||||
to: glam::DVec3,
|
||||
) -> bool {
|
||||
use cadkernel::geom2d::{closest_point, Curve, Vec2, XLine};
|
||||
|
||||
/// Parse `h1,h2,...;fx,fz;tx,tz` and align multileader content points along the direction.
|
||||
fn apply_mleader_align(scene: &mut crate::scene::Scene, encoded: &str) {
|
||||
// Format: "<h1>,<h2>,...;<fx>,<fz>;<tx>,<tz>"
|
||||
let parts: Vec<&str> = encoded.splitn(3, ';').collect();
|
||||
if parts.len() < 3 {
|
||||
return;
|
||||
}
|
||||
let handles: Vec<acadrust::Handle> = parts[0]
|
||||
.split(',')
|
||||
.filter_map(|s| s.parse::<u64>().ok().map(acadrust::Handle::from))
|
||||
.collect();
|
||||
let from_parts: Vec<f64> = parts[1].split(',').filter_map(|s| s.parse().ok()).collect();
|
||||
let to_parts: Vec<f64> = parts[2].split(',').filter_map(|s| s.parse().ok()).collect();
|
||||
if from_parts.len() < 2 || to_parts.len() < 2 || handles.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
let fx = from_parts[0];
|
||||
let fy = from_parts[1];
|
||||
let tx = to_parts[0];
|
||||
let ty = to_parts[1];
|
||||
let dx = tx - fx;
|
||||
let dy = ty - fy;
|
||||
let len = (dx * dx + dy * dy).sqrt();
|
||||
if len < 1e-9 {
|
||||
return;
|
||||
}
|
||||
|
||||
// Project each multileader's content point onto the alignment line, then
|
||||
// snap it to the line (preserve perpendicular offset from line is discarded;
|
||||
// align along direction through `from`).
|
||||
let Some(direction) = Vec2::new(to.x - from.x, to.y - from.y).normalize() else {
|
||||
return false;
|
||||
};
|
||||
let line = Curve::XLine(XLine {
|
||||
base: [from.x, from.y],
|
||||
direction: direction.into(),
|
||||
});
|
||||
let mut changed = Vec::new();
|
||||
for h in handles {
|
||||
if let Some(acadrust::EntityType::MultiLeader(ml)) = scene.document.get_entity_mut(h) {
|
||||
for &handle in handles {
|
||||
if let Some(acadrust::EntityType::MultiLeader(ml)) =
|
||||
scene.document.get_entity_mut(handle)
|
||||
{
|
||||
let old = ml.context.content_base_point;
|
||||
let rel_x = old.x - fx;
|
||||
let rel_y = old.y - fy;
|
||||
let t = (rel_x * dx + rel_y * dy) / (len * len);
|
||||
let new_x = fx + t * dx;
|
||||
let new_y = fy + t * dy;
|
||||
let projected = closest_point(&line, [old.x, old.y]).point;
|
||||
let new_x = projected[0];
|
||||
let new_y = projected[1];
|
||||
let shift_x = new_x - old.x;
|
||||
let shift_y = new_y - old.y;
|
||||
if shift_x.abs() <= 1.0e-12 && shift_y.abs() <= 1.0e-12 {
|
||||
continue;
|
||||
}
|
||||
ml.context.content_base_point.x = new_x;
|
||||
ml.context.content_base_point.y = new_y;
|
||||
ml.context.text_location.x += shift_x;
|
||||
@@ -4494,46 +4655,71 @@ fn apply_mleader_align(scene: &mut crate::scene::Scene, encoded: &str) {
|
||||
root.connection_point.x += shift_x;
|
||||
root.connection_point.y += shift_y;
|
||||
}
|
||||
changed.push((h, crate::scene::ChangeKind::Modified));
|
||||
changed.push((handle, crate::scene::ChangeKind::Modified));
|
||||
}
|
||||
}
|
||||
if !changed.is_empty() {
|
||||
scene.bump_entities(&changed);
|
||||
}
|
||||
!changed.is_empty()
|
||||
}
|
||||
|
||||
// ── MLEADERCOLLECT helper ─────────────────────────────────────────────────────
|
||||
|
||||
/// Parse `h1,h2,...;px,pz` — merge all selected multileaders into the first one at position.
|
||||
fn apply_mleader_collect(scene: &mut crate::scene::Scene, encoded: &str) {
|
||||
let parts: Vec<&str> = encoded.splitn(2, ';').collect();
|
||||
if parts.len() < 2 {
|
||||
return;
|
||||
}
|
||||
let handles: Vec<acadrust::Handle> = parts[0]
|
||||
.split(',')
|
||||
.filter_map(|s| s.parse::<u64>().ok().map(acadrust::Handle::from))
|
||||
.collect();
|
||||
let pos_parts: Vec<f64> = parts[1].split(',').filter_map(|s| s.parse().ok()).collect();
|
||||
if handles.len() < 2 || pos_parts.len() < 2 {
|
||||
return;
|
||||
}
|
||||
|
||||
let px = pos_parts[0];
|
||||
let py = pos_parts[1];
|
||||
|
||||
let Some(acadrust::EntityType::MultiLeader(base)) = scene.document.get_entity(handles[0]) else {
|
||||
return;
|
||||
fn compatible_mleader_collect_handles(
|
||||
scene: &crate::scene::Scene,
|
||||
handles: &[acadrust::Handle],
|
||||
) -> Vec<acadrust::Handle> {
|
||||
let Some((base_block, base_style)) = handles.iter().find_map(|handle| {
|
||||
if scene.is_layer_locked(*handle) {
|
||||
return None;
|
||||
}
|
||||
let acadrust::EntityType::MultiLeader(leader) =
|
||||
scene.document.get_entity(*handle)?
|
||||
else {
|
||||
return None;
|
||||
};
|
||||
(leader.content_type == acadrust::entities::LeaderContentType::Block)
|
||||
.then_some((leader.block_content_handle, leader.style_handle))
|
||||
}) else {
|
||||
return Vec::new();
|
||||
};
|
||||
if base.content_type != acadrust::entities::LeaderContentType::Block {
|
||||
return;
|
||||
let mut compatible = Vec::new();
|
||||
for handle in handles.iter().copied() {
|
||||
if compatible.contains(&handle) {
|
||||
continue;
|
||||
}
|
||||
if !scene.is_layer_locked(handle)
|
||||
&& matches!(
|
||||
scene.document.get_entity(handle),
|
||||
Some(acadrust::EntityType::MultiLeader(leader))
|
||||
if leader.content_type == acadrust::entities::LeaderContentType::Block
|
||||
&& leader.block_content_handle == base_block
|
||||
&& leader.style_handle == base_style
|
||||
)
|
||||
{
|
||||
compatible.push(handle);
|
||||
}
|
||||
}
|
||||
compatible
|
||||
}
|
||||
|
||||
fn apply_mleader_collect(
|
||||
scene: &mut crate::scene::Scene,
|
||||
handles: &[acadrust::Handle],
|
||||
point: glam::DVec3,
|
||||
) -> bool {
|
||||
if handles.len() < 2 {
|
||||
return false;
|
||||
}
|
||||
let px = point.x;
|
||||
let py = point.y;
|
||||
let Some(acadrust::EntityType::MultiLeader(base)) =
|
||||
scene.document.get_entity(handles[0])
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
let base_block = base.block_content_handle;
|
||||
let base_style = base.style_handle;
|
||||
|
||||
// Collect all leader roots from the secondary multileaders. Their arrow
|
||||
// geometry remains fixed while the content-side connection follows the
|
||||
// new collection point.
|
||||
let mut extra_roots: Vec<acadrust::entities::LeaderRoot> = Vec::new();
|
||||
let mut merged_handles = Vec::new();
|
||||
for &h in &handles[1..] {
|
||||
@@ -4554,10 +4740,9 @@ fn apply_mleader_collect(scene: &mut crate::scene::Scene, encoded: &str) {
|
||||
}
|
||||
}
|
||||
if merged_handles.is_empty() {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add collected roots to the first multileader and move its content point.
|
||||
if let Some(acadrust::EntityType::MultiLeader(ml)) = scene.document.get_entity_mut(handles[0]) {
|
||||
let shift_x = px - ml.context.content_base_point.x;
|
||||
let shift_y = py - ml.context.content_base_point.y;
|
||||
@@ -4576,9 +4761,9 @@ fn apply_mleader_collect(scene: &mut crate::scene::Scene, encoded: &str) {
|
||||
}
|
||||
}
|
||||
|
||||
// Erase the secondary multileaders.
|
||||
scene.erase_entities(&merged_handles);
|
||||
scene.bump_entities(&[(handles[0], crate::scene::ChangeKind::Modified)]);
|
||||
true
|
||||
}
|
||||
|
||||
/// MATCHPROP special properties (#281): copy every STYLE-affecting field from
|
||||
|
||||
+64
-229
@@ -668,138 +668,87 @@ impl OpenCADStudio {
|
||||
|
||||
"DIMCONTINUE" => {
|
||||
use crate::modules::annotate::dim_continue::DimContinueCommand;
|
||||
let cmd = if let Some((p1, p2, dp, rot, trot)) =
|
||||
find_last_linear_dim(&self.tabs[i].scene)
|
||||
{
|
||||
DimContinueCommand::from_base(p1, p2, dp, rot, trot)
|
||||
} else {
|
||||
DimContinueCommand::new()
|
||||
};
|
||||
let scene = &self.tabs[i].scene;
|
||||
let recent = scene
|
||||
.last_created_dimension
|
||||
.filter(|handle| scene.entity_belongs_to_active_space(*handle))
|
||||
.and_then(|handle| scene.document.get_entity(handle))
|
||||
.cloned();
|
||||
let cmd = DimContinueCommand::new(
|
||||
recent,
|
||||
self.dimension_continue_mode == 1,
|
||||
);
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"DIMBASELINE" => {
|
||||
use crate::modules::annotate::dim_baseline::DimBaselineCommand;
|
||||
let cmd = if let Some((p1, p2, dp, rot, trot)) =
|
||||
find_last_linear_dim(&self.tabs[i].scene)
|
||||
{
|
||||
let doc = &self.tabs[i].scene.document;
|
||||
let dimdli = doc
|
||||
.dim_styles
|
||||
.iter()
|
||||
.find(|s| {
|
||||
s.name
|
||||
.eq_ignore_ascii_case(&doc.header.current_dimstyle_name)
|
||||
})
|
||||
.map(|s| s.dimdli as f32)
|
||||
.unwrap_or(1.5);
|
||||
DimBaselineCommand::from_base(p1, p2, dp, rot, trot, dimdli)
|
||||
let scene = &self.tabs[i].scene;
|
||||
let recent = scene
|
||||
.last_created_dimension
|
||||
.filter(|handle| scene.entity_belongs_to_active_space(*handle))
|
||||
.and_then(|handle| scene.document.get_entity(handle))
|
||||
.cloned();
|
||||
let dimdli_by_style = scene
|
||||
.document
|
||||
.dim_styles
|
||||
.iter()
|
||||
.map(|style| (style.name.to_ascii_lowercase(), style.dimdli))
|
||||
.collect();
|
||||
let fallback_dimdli = if scene.document.header.measurement == 1 {
|
||||
3.75
|
||||
} else {
|
||||
DimBaselineCommand::new()
|
||||
0.38
|
||||
};
|
||||
let current_style_name = scene.document.header.current_dimstyle_name.clone();
|
||||
let cmd = DimBaselineCommand::new(
|
||||
recent,
|
||||
dimdli_by_style,
|
||||
current_style_name,
|
||||
fallback_dimdli,
|
||||
self.dimension_continue_mode == 1,
|
||||
);
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"QDIM" => {
|
||||
use crate::modules::annotate::qdim::QdimCommand;
|
||||
let cmd = QdimCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
// QDIM second stage: the front-end relaunched with the picked
|
||||
// dimension-line point and the gathered geometry now selected. Build
|
||||
// a continuous chain of linear dimensions across the endpoints.
|
||||
cmd if cmd.starts_with("QDIM_PLACE ") => {
|
||||
let nums: Vec<f64> = cmd
|
||||
.split_whitespace()
|
||||
.skip(1)
|
||||
.filter_map(|s| s.parse().ok())
|
||||
.collect();
|
||||
if nums.len() < 3 {
|
||||
return Some(Task::none());
|
||||
}
|
||||
let plane = if self.tabs[i].editing_model_space() {
|
||||
self.tabs[i].ucs_xform().working_plane()
|
||||
} else {
|
||||
crate::command::WorkingPlane::default()
|
||||
};
|
||||
let place = plane.to_local(glam::DVec3::new(nums[0], nums[1], nums[2]));
|
||||
let handles: Vec<acadrust::Handle> = self.tabs[i]
|
||||
let document = &self.tabs[i].scene.document;
|
||||
let dim_spacing = document
|
||||
.dim_styles
|
||||
.iter()
|
||||
.find(|style| {
|
||||
style
|
||||
.name
|
||||
.eq_ignore_ascii_case(&document.header.current_dimstyle_name)
|
||||
})
|
||||
.map(|style| style.dimdli)
|
||||
.unwrap_or_else(|| {
|
||||
if document.header.measurement == 1 {
|
||||
3.75
|
||||
} else {
|
||||
0.38
|
||||
}
|
||||
});
|
||||
let selection = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
.iter()
|
||||
.map(|(h, _)| *h)
|
||||
.into_iter()
|
||||
.map(|(handle, entity)| crate::command::SelectionEntity {
|
||||
handle,
|
||||
entity: entity.clone(),
|
||||
surface_area: None,
|
||||
})
|
||||
.collect();
|
||||
let mut pts: Vec<glam::DVec3> = Vec::new();
|
||||
for h in &handles {
|
||||
if let Some(e) = self.tabs[i].scene.document.get_entity(*h) {
|
||||
qdim_collect_points(e, &mut pts);
|
||||
}
|
||||
}
|
||||
for point in &mut pts {
|
||||
*point = plane.to_local(*point);
|
||||
}
|
||||
if pts.len() < 2 {
|
||||
self.command_line
|
||||
.push_error(crate::t!("QDIM: no dimensionable endpoints in the selection.").as_ref());
|
||||
return Some(Task::none());
|
||||
}
|
||||
// Choose the dimension axis from the points' spread: a wider X
|
||||
// span dimensions horizontally (ordered by X), else vertically.
|
||||
let (minx, maxx) = pts
|
||||
.iter()
|
||||
.fold((f64::MAX, f64::MIN), |(a, b), p| (a.min(p.x), b.max(p.x)));
|
||||
let (miny, maxy) = pts
|
||||
.iter()
|
||||
.fold((f64::MAX, f64::MIN), |(a, b), p| (a.min(p.y), b.max(p.y)));
|
||||
let horizontal = (maxx - minx) >= (maxy - miny);
|
||||
if horizontal {
|
||||
pts.sort_by(|a, b| a.x.total_cmp(&b.x));
|
||||
pts.dedup_by(|a, b| (a.x - b.x).abs() < 1e-4);
|
||||
} else {
|
||||
pts.sort_by(|a, b| a.y.total_cmp(&b.y));
|
||||
pts.dedup_by(|a, b| (a.y - b.y).abs() < 1e-4);
|
||||
}
|
||||
if pts.len() < 2 {
|
||||
self.command_line
|
||||
.push_error(crate::t!("QDIM: endpoints collapse to a single position.").as_ref());
|
||||
return Some(Task::none());
|
||||
}
|
||||
self.push_undo_snapshot(i, "QDIM");
|
||||
let v = |p: glam::DVec3| {
|
||||
acadrust::types::Vector3::new(p.x, p.y, p.z)
|
||||
};
|
||||
let mut made = 0usize;
|
||||
for w in pts.windows(2) {
|
||||
let (p1, p2) = (w[0], w[1]);
|
||||
let mut dim = acadrust::entities::DimensionLinear::new(v(p1), v(p2));
|
||||
dim.rotation = if horizontal {
|
||||
0.0
|
||||
} else {
|
||||
std::f64::consts::FRAC_PI_2
|
||||
};
|
||||
// Dim line passes through the picked perpendicular position.
|
||||
let def = if horizontal {
|
||||
glam::DVec3::new((p1.x + p2.x) * 0.5, place.y, 0.0)
|
||||
} else {
|
||||
glam::DVec3::new(place.x, (p1.y + p2.y) * 0.5, 0.0)
|
||||
};
|
||||
dim.definition_point = v(def);
|
||||
dim.base.definition_point = v(def);
|
||||
dim.base.actual_measurement = dim.measurement();
|
||||
let entity = acadrust::EntityType::Dimension(
|
||||
acadrust::entities::Dimension::Linear(dim),
|
||||
);
|
||||
self.commit_entity(plane.place_entity(entity));
|
||||
made += 1;
|
||||
}
|
||||
self.tabs[i].dirty = true;
|
||||
self.command_line
|
||||
.push_output(crate::tf!("QDIM {made} dimensions created.").as_ref());
|
||||
return Some(Task::none());
|
||||
let cmd = QdimCommand::new(
|
||||
selection,
|
||||
dim_spacing,
|
||||
self.quick_dimension_snap_priority,
|
||||
);
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"DIMEDIT" => {
|
||||
@@ -1398,120 +1347,6 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
/// Find the last placed linear or aligned dimension in the document.
|
||||
/// Returns `(first_point, second_point, definition_point, rotation_rad)` in world-space.
|
||||
fn find_last_linear_dim(
|
||||
scene: &crate::scene::Scene,
|
||||
) -> Option<(glam::Vec3, glam::Vec3, glam::Vec3, f64, f64)> {
|
||||
use acadrust::entities::Dimension;
|
||||
let mut best_handle: u64 = 0;
|
||||
let mut result: Option<(glam::Vec3, glam::Vec3, glam::Vec3, f64, f64)> = None;
|
||||
|
||||
for entity in scene.document.entities() {
|
||||
if let acadrust::EntityType::Dimension(dim) = entity {
|
||||
let h = entity.common().handle.value();
|
||||
if h <= best_handle {
|
||||
continue;
|
||||
}
|
||||
let item = match dim {
|
||||
Dimension::Linear(d) => {
|
||||
let p1 = glam::Vec3::new(
|
||||
d.first_point.x as f32,
|
||||
d.first_point.y as f32,
|
||||
d.first_point.z as f32,
|
||||
);
|
||||
let p2 = glam::Vec3::new(
|
||||
d.second_point.x as f32,
|
||||
d.second_point.y as f32,
|
||||
d.second_point.z as f32,
|
||||
);
|
||||
let dp = glam::Vec3::new(
|
||||
d.base.definition_point.x as f32,
|
||||
d.base.definition_point.y as f32,
|
||||
d.base.definition_point.z as f32,
|
||||
);
|
||||
Some((p1, p2, dp, d.rotation, d.base.text_rotation))
|
||||
}
|
||||
Dimension::Aligned(d) => {
|
||||
let p1 = glam::Vec3::new(
|
||||
d.first_point.x as f32,
|
||||
d.first_point.y as f32,
|
||||
d.first_point.z as f32,
|
||||
);
|
||||
let p2 = glam::Vec3::new(
|
||||
d.second_point.x as f32,
|
||||
d.second_point.y as f32,
|
||||
d.second_point.z as f32,
|
||||
);
|
||||
let dp = glam::Vec3::new(
|
||||
d.base.definition_point.x as f32,
|
||||
d.base.definition_point.y as f32,
|
||||
d.base.definition_point.z as f32,
|
||||
);
|
||||
let dx = (d.second_point.x - d.first_point.x) as f32;
|
||||
let dy = (d.second_point.y - d.first_point.y) as f32;
|
||||
let rot = dy.atan2(dx) as f64;
|
||||
Some((p1, p2, dp, rot, d.base.text_rotation))
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
if let Some(data) = item {
|
||||
best_handle = h;
|
||||
result = Some(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
/// Collect candidate dimension endpoints from an entity for QDIM — line ends,
|
||||
/// polyline vertices, arc endpoints — in world space.
|
||||
fn qdim_collect_points(e: &acadrust::EntityType, out: &mut Vec<glam::DVec3>) {
|
||||
use acadrust::EntityType as ET;
|
||||
let p = |v: &acadrust::types::Vector3| glam::DVec3::new(v.x, v.y, v.z);
|
||||
let ocs = |point: (f64, f64, f64), normal: acadrust::types::Vector3| {
|
||||
let world = crate::scene::view::transform::ocs_point_to_wcs(
|
||||
point,
|
||||
(normal.x, normal.y, normal.z),
|
||||
);
|
||||
glam::DVec3::new(world.0, world.1, world.2)
|
||||
};
|
||||
match e {
|
||||
ET::Line(l) => {
|
||||
out.push(p(&l.start));
|
||||
out.push(p(&l.end));
|
||||
}
|
||||
ET::LwPolyline(pl) => {
|
||||
for v in &pl.vertices {
|
||||
out.push(ocs((v.location.x, v.location.y, pl.elevation), pl.normal));
|
||||
}
|
||||
}
|
||||
ET::Polyline2D(pl) => {
|
||||
for v in &pl.vertices {
|
||||
out.push(ocs((v.location.x, v.location.y, pl.elevation), pl.normal));
|
||||
}
|
||||
}
|
||||
ET::Polyline(pl) => {
|
||||
for v in &pl.vertices {
|
||||
out.push(p(&v.location));
|
||||
}
|
||||
}
|
||||
ET::Arc(a) => {
|
||||
for &ang in &[a.start_angle, a.end_angle] {
|
||||
out.push(ocs(
|
||||
(
|
||||
a.center.x + a.radius * ang.cos(),
|
||||
a.center.y + a.radius * ang.sin(),
|
||||
a.center.z,
|
||||
),
|
||||
a.normal,
|
||||
));
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
// ── TCASE helpers ──────────────────────────────────────────────────────────
|
||||
fn sentence_case(s: &str) -> String {
|
||||
let mut c = s.chars();
|
||||
|
||||
@@ -633,11 +633,20 @@ impl OpenCADStudio {
|
||||
"CHPROP: invalid value '{}' for {}.",
|
||||
value, prop
|
||||
).as_ref());
|
||||
} else {
|
||||
let known = matches!(
|
||||
prop.as_str(),
|
||||
"LAYER" | "LINETYPE" | "LT" | "LTSCALE" | "COLOR" | "TRANSPARENCY"
|
||||
);
|
||||
if !known {
|
||||
self.command_line.push_error(crate::tf!(
|
||||
"CHPROP: unknown property '{}'. Use: LAYER COLOR LINETYPE LTSCALE TRANSPARENCY", prop
|
||||
).as_ref());
|
||||
} else {
|
||||
let mut changed = 0usize;
|
||||
for handle in &handles {
|
||||
self.apply_property_op(i, "CHPROP", &handles, |app, handle| {
|
||||
if let Some(entity) =
|
||||
self.tabs[i].scene.document.get_entity_mut(*handle)
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
let common = entity.common_mut();
|
||||
match prop.as_str() {
|
||||
@@ -661,30 +670,21 @@ impl OpenCADStudio {
|
||||
common.transparency = transparency_val.unwrap();
|
||||
changed += 1;
|
||||
}
|
||||
_ => {
|
||||
self.command_line.push_error(crate::tf!(
|
||||
"CHPROP: unknown property '{}'. Use: LAYER COLOR LINETYPE LTSCALE TRANSPARENCY", prop
|
||||
).as_ref());
|
||||
break;
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
if changed > 0 {
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
self.tabs[i].dirty = true;
|
||||
// Colour / linetype / ltscale / transparency /
|
||||
// layer are baked into the cached wire geometry —
|
||||
// re-tessellate the changed entities so they
|
||||
// repaint immediately (issue #231 class).
|
||||
self.invalidate_property_targets(i, &handles);
|
||||
self.command_line.push_output(crate::tf!(
|
||||
"CHPROP: {} entity/entities updated.",
|
||||
changed
|
||||
).as_ref());
|
||||
}
|
||||
});
|
||||
// Colour / linetype / ltscale / transparency /
|
||||
// layer are baked into the cached wire geometry —
|
||||
// re-tessellate the changed entities so they
|
||||
// repaint immediately (issue #231 class).
|
||||
self.command_line.push_output(crate::tf!(
|
||||
"CHPROP: {} entity/entities updated.",
|
||||
changed
|
||||
).as_ref());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -931,6 +931,7 @@ impl OpenCADStudio {
|
||||
| "CENTERCROSSSIZE"
|
||||
| "CENTERCROSSGAP"
|
||||
| "CENTERMARKEXE"
|
||||
| "DIMCONTINUEMODE"
|
||||
) =>
|
||||
{
|
||||
return self.dispatch_styleprops(&format!("SETVAR {cmd}"), i);
|
||||
@@ -953,7 +954,7 @@ impl OpenCADStudio {
|
||||
let value = it.next().map(|s| s.trim().to_string());
|
||||
if name.is_empty() || name == "?" {
|
||||
self.command_line.push_info(
|
||||
"SETVAR: LTSCALE CELTSCALE PDMODE PDSIZE TEXTSIZE ORTHOMODE FILLMODE MIRRTEXT FRAME IMAGEFRAME PDFFRAME WIPEOUTFRAME XCLIPFRAME POINTCLOUDCLIPFRAME ZOOMWHEEL ZOOMFACTOR CURSORSIZE PICKBOX CURSORTYPE SNAPANG TEXTFILL CLIPROMPTLINES ATTREQ ATTDIA DIMASSOC ANGBASE ANGDIR SKETCHINC SKPOLY SKTOLERANCE DONUTID DONUTOD CENTEREXE CENTERLAYER CENTERLTYPE CENTERLTSCALE CENTERLTYPEFILE CENTERCROSSSIZE CENTERCROSSGAP CENTERMARKEXE | CLAYER CELTYPE TEXTSTYLE (read-only)",
|
||||
"SETVAR: LTSCALE CELTSCALE PDMODE PDSIZE TEXTSIZE ORTHOMODE FILLMODE MIRRTEXT FRAME IMAGEFRAME PDFFRAME WIPEOUTFRAME XCLIPFRAME POINTCLOUDCLIPFRAME ZOOMWHEEL ZOOMFACTOR CURSORSIZE PICKBOX CURSORTYPE SNAPANG TEXTFILL CLIPROMPTLINES ATTREQ ATTDIA DIMASSOC DIMCONTINUEMODE ANGBASE ANGDIR SKETCHINC SKPOLY SKTOLERANCE DONUTID DONUTOD CENTEREXE CENTERLAYER CENTERLTYPE CENTERLTSCALE CENTERLTYPEFILE CENTERCROSSSIZE CENTERCROSSGAP CENTERMARKEXE | CLAYER CELTYPE TEXTSTYLE (read-only)",
|
||||
);
|
||||
} else {
|
||||
let frame_kind = crate::scene::frame::kind_for_name(&name);
|
||||
@@ -1069,6 +1070,28 @@ impl OpenCADStudio {
|
||||
}
|
||||
return Some(self.finish_dispatch(cmd));
|
||||
}
|
||||
if name == "DIMCONTINUEMODE" {
|
||||
let current = self.dimension_continue_mode;
|
||||
if let Some(value) = &value {
|
||||
match value.parse::<i16>() {
|
||||
Ok(mode @ 0..=1) => {
|
||||
self.dimension_continue_mode = mode;
|
||||
self.persist_settings_if_changed();
|
||||
self.command_line
|
||||
.push_output(&format!("DIMCONTINUEMODE = {mode}"));
|
||||
}
|
||||
_ => self.command_line.push_error(
|
||||
"SETVAR: DIMCONTINUEMODE requires 0 or 1.",
|
||||
),
|
||||
}
|
||||
} else {
|
||||
self.command_line.push_output(crate::tf!(
|
||||
"Enter new value for {name} <{current}>:"
|
||||
).as_ref());
|
||||
self.pending_setvar = Some(name.clone());
|
||||
}
|
||||
return Some(self.finish_dispatch(cmd));
|
||||
}
|
||||
if matches!(name.as_str(), "DONUTID" | "DONUTOD") {
|
||||
let current = if name == "DONUTID" {
|
||||
crate::modules::draw::defaults::get_donut_inner_diameter()
|
||||
|
||||
@@ -465,6 +465,10 @@ pub(super) struct OpenCADStudio {
|
||||
options_tab: crate::ui::window::options::OptionsTab,
|
||||
/// Controls whether the TEXTEDIT command repeats automatically (0 = Multiple, 1 = Single).
|
||||
pub texteditmode: bool,
|
||||
/// QDIM extension-origin priority: 0 = endpoints, 1 = intersections.
|
||||
pub quick_dimension_snap_priority: u8,
|
||||
/// Creation-style policy used by continuing and baseline dimensions.
|
||||
pub dimension_continue_mode: i16,
|
||||
/// When true (default), saving over an existing file first writes a `.bak`
|
||||
/// copy of it for recovery (#205). Toggle with the ISAVEBAK command.
|
||||
pub backup_on_save: bool,
|
||||
@@ -3215,6 +3219,8 @@ impl OpenCADStudio {
|
||||
dyn_input: true,
|
||||
options_tab: crate::ui::window::options::OptionsTab::General,
|
||||
texteditmode: false,
|
||||
quick_dimension_snap_priority: 0,
|
||||
dimension_continue_mode: 1,
|
||||
backup_on_save: true,
|
||||
file_assoc_enabled: true,
|
||||
savetime_min: 10,
|
||||
|
||||
+363
-12
@@ -1081,16 +1081,6 @@ impl OpenCADStudio {
|
||||
&self.tabs[i].scene.document,
|
||||
));
|
||||
|
||||
if matches!(d, acadrust::entities::Dimension::LargeRadial(_)) {
|
||||
if let Some(index) = sections
|
||||
.iter()
|
||||
.position(|section| section.title == t!("Misc").as_ref())
|
||||
{
|
||||
let misc = sections.remove(index);
|
||||
sections.push(misc);
|
||||
}
|
||||
}
|
||||
|
||||
// Prefer entity-level dimension-variable overrides;
|
||||
// fall back to the assigned style values.
|
||||
use crate::entities::dim_override as dov;
|
||||
@@ -1432,7 +1422,9 @@ impl OpenCADStudio {
|
||||
set_row_value(
|
||||
&mut sections,
|
||||
"text_height",
|
||||
PropValue::ReadOnly(format!("{:.4}", ml.text_height)),
|
||||
PropValue::ReadOnly(
|
||||
crate::entities::common::format_length(ml.text_height),
|
||||
),
|
||||
);
|
||||
}
|
||||
if let Some(sh) = ml.style_handle {
|
||||
@@ -2477,6 +2469,34 @@ impl OpenCADStudio {
|
||||
self.tabs[i].scene.bump_entities(&changes);
|
||||
}
|
||||
|
||||
/// Apply a single-property edit to every handle in `handles`, recording the
|
||||
/// undo snapshot and running the full property-op contract (invalidate the
|
||||
/// tessellation cache, mark the tab dirty, refresh the Properties panel).
|
||||
///
|
||||
/// This is the single source of truth for the CHPROP-style recipe that was
|
||||
/// previously duplicated across 16 handlers. `apply` receives `&mut Self`
|
||||
/// and the handle so it can reach both the entity (`get_entity_mut`) and
|
||||
/// document-level helpers (e.g. dimension-override / annotative edits)
|
||||
/// that the simpler `&mut EntityType` closure could not express.
|
||||
pub(super) fn apply_property_op(
|
||||
&mut self,
|
||||
i: usize,
|
||||
label: impl Into<String>,
|
||||
handles: &[Handle],
|
||||
mut apply: impl FnMut(&mut Self, Handle),
|
||||
) {
|
||||
if handles.is_empty() {
|
||||
return;
|
||||
}
|
||||
self.push_undo_snapshot(i, label);
|
||||
for &handle in handles {
|
||||
apply(self, handle);
|
||||
}
|
||||
self.invalidate_property_targets(i, handles);
|
||||
self.tabs[i].dirty = true;
|
||||
self.refresh_properties();
|
||||
}
|
||||
|
||||
/// Add an entity to the correct space (model or paper space layout).
|
||||
pub(super) fn commit_entity(&mut self, entity: acadrust::EntityType) {
|
||||
let _ = self.commit_entity_handle(entity);
|
||||
@@ -2486,10 +2506,40 @@ impl OpenCADStudio {
|
||||
/// (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,
|
||||
entity: acadrust::EntityType,
|
||||
) -> Option<Handle> {
|
||||
self.commit_entity_handle_with_dimension_policy(entity, false)
|
||||
}
|
||||
|
||||
/// Commit an entity, optionally preserving its source dimension style.
|
||||
pub(super) fn commit_entity_handle_with_dimension_policy(
|
||||
&mut self,
|
||||
mut entity: acadrust::EntityType,
|
||||
preserve_dimension_layer_and_style: bool,
|
||||
) -> Option<Handle> {
|
||||
let i = self.active_tab;
|
||||
let tracks_dimension_chain = matches!(
|
||||
&entity,
|
||||
acadrust::EntityType::Dimension(
|
||||
acadrust::entities::Dimension::Linear(_)
|
||||
| acadrust::entities::Dimension::Aligned(_)
|
||||
| acadrust::entities::Dimension::Angular2Ln(_)
|
||||
| acadrust::entities::Dimension::Angular3Pt(_)
|
||||
| acadrust::entities::Dimension::Ordinate(_)
|
||||
)
|
||||
);
|
||||
let inherited_dimension = if preserve_dimension_layer_and_style {
|
||||
match &entity {
|
||||
acadrust::EntityType::Dimension(dimension) => Some((
|
||||
dimension.base().common.layer.clone(),
|
||||
dimension.base().style_name.clone(),
|
||||
)),
|
||||
_ => None,
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
if let acadrust::EntityType::Table(table) = &mut entity {
|
||||
const PREFIX: &str = "__OPENCAD_LINK_PENDING__";
|
||||
if let Some(path) = table.name.strip_prefix(PREFIX).map(str::to_string) {
|
||||
@@ -2603,6 +2653,12 @@ impl OpenCADStudio {
|
||||
&self.tabs[i].scene.document,
|
||||
&mut entity,
|
||||
);
|
||||
if let (Some((layer, style_name)), acadrust::EntityType::Dimension(dimension)) =
|
||||
(inherited_dimension, &mut entity)
|
||||
{
|
||||
dimension.base_mut().common.layer = layer;
|
||||
dimension.base_mut().style_name = style_name;
|
||||
}
|
||||
|
||||
// Smart centre objects carry their own drawing-level creation style.
|
||||
// Apply it after the generic ribbon style so ordinary LINE entities
|
||||
@@ -2762,6 +2818,9 @@ impl OpenCADStudio {
|
||||
self.tabs[i].last_draw_anchor = Some(handle);
|
||||
}
|
||||
}
|
||||
if tracks_dimension_chain {
|
||||
self.tabs[i].scene.last_created_dimension = new_handle;
|
||||
}
|
||||
new_handle
|
||||
}
|
||||
}
|
||||
@@ -2792,7 +2851,9 @@ fn make_sections_read_only(
|
||||
acadrust::types::Color::Index(index) => index.to_string(),
|
||||
acadrust::types::Color::Rgb { r, g, b } => format!("{r},{g},{b}"),
|
||||
},
|
||||
PropValue::ColorVaries | PropValue::LwVaries => VARIES_LABEL.to_string(),
|
||||
PropValue::ColorVaries
|
||||
| PropValue::LwVaries
|
||||
| PropValue::FieldLwVaries { .. } => VARIES_LABEL.to_string(),
|
||||
PropValue::LwChoice(lineweight)
|
||||
| PropValue::FieldLwChoice {
|
||||
value: lineweight, ..
|
||||
@@ -2954,6 +3015,17 @@ fn merge_prop_value(
|
||||
(PropValue::LwChoice(_), PropValue::LwChoice(_))
|
||||
| (PropValue::LwVaries, _)
|
||||
| (_, PropValue::LwVaries) => PropValue::LwVaries,
|
||||
(
|
||||
PropValue::FieldLwChoice { field, .. },
|
||||
PropValue::FieldLwChoice {
|
||||
field: other_field,
|
||||
..
|
||||
},
|
||||
) if field == other_field => PropValue::FieldLwVaries { field },
|
||||
(PropValue::FieldLwVaries { field }, _)
|
||||
| (_, PropValue::FieldLwVaries { field }) => {
|
||||
PropValue::FieldLwVaries { field }
|
||||
}
|
||||
(PropValue::LinetypeChoice(_), PropValue::LinetypeChoice(_)) => {
|
||||
PropValue::LinetypeChoice(VARIES_LABEL.into())
|
||||
}
|
||||
@@ -3485,3 +3557,282 @@ mod insert_unit_scale_tests {
|
||||
assert_eq!(ins, before);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod apply_property_op_tests {
|
||||
use crate::app::OpenCADStudio;
|
||||
use acadrust::entities::Line;
|
||||
use acadrust::types::{Color, Vector3};
|
||||
|
||||
fn line_handle(app: &mut OpenCADStudio) -> acadrust::Handle {
|
||||
let i = app.active_tab;
|
||||
let mut line = Line::new();
|
||||
line.start = Vector3::ZERO;
|
||||
line.end = Vector3::new(1.0, 0.0, 0.0);
|
||||
app.commit_entity_handle(acadrust::EntityType::Line(line))
|
||||
.expect("line should commit")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_handles_does_not_invoke_or_dirty() {
|
||||
let mut app = OpenCADStudio::new_for_test();
|
||||
let i = app.active_tab;
|
||||
let before = app.tabs[i].dirty;
|
||||
let called = std::rc::Rc::new(std::cell::Cell::new(false));
|
||||
let called2 = called.clone();
|
||||
app.apply_property_op(i, "TEST", &[], |_app, _h| {
|
||||
called2.set(true);
|
||||
});
|
||||
assert!(!called.get(), "closure must not run for empty handles");
|
||||
assert_eq!(
|
||||
app.tabs[i].dirty, before,
|
||||
"dirty must be unchanged for empty handles"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn applies_to_each_handle_sets_dirty_and_mutates() {
|
||||
let mut app = OpenCADStudio::new_for_test();
|
||||
let i = app.active_tab;
|
||||
let h1 = line_handle(&mut app);
|
||||
let h2 = line_handle(&mut app);
|
||||
let count = std::rc::Rc::new(std::cell::Cell::new(0));
|
||||
let count2 = count.clone();
|
||||
app.tabs[i].dirty = false;
|
||||
app.apply_property_op(i, "CHPROP", &[h1, h2], |app2, h| {
|
||||
count2.set(count2.get() + 1);
|
||||
if let Some(e) = app2.tabs[app2.active_tab]
|
||||
.scene
|
||||
.document
|
||||
.get_entity_mut(h)
|
||||
{
|
||||
e.common_mut().color = Color::Index(7);
|
||||
}
|
||||
});
|
||||
assert_eq!(count.get(), 2, "closure runs once per handle");
|
||||
assert!(app.tabs[i].dirty, "tab marked dirty");
|
||||
let e = app.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.get_entity(h1)
|
||||
.expect("entity present");
|
||||
assert_eq!(
|
||||
e.common().color,
|
||||
Color::Index(7),
|
||||
"entity mutation persisted"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_entity_does_not_abort_loop() {
|
||||
let mut app = OpenCADStudio::new_for_test();
|
||||
let i = app.active_tab;
|
||||
let h1 = line_handle(&mut app);
|
||||
// A freshly allocated handle has no entity yet.
|
||||
let missing = app.tabs[i].scene.document.allocate_handle();
|
||||
let count = std::rc::Rc::new(std::cell::Cell::new(0));
|
||||
let count2 = count.clone();
|
||||
app.tabs[i].dirty = false;
|
||||
app.apply_property_op(i, "CHPROP", &[h1, missing], |app2, h| {
|
||||
count2.set(count2.get() + 1);
|
||||
if let Some(e) = app2.tabs[app2.active_tab]
|
||||
.scene
|
||||
.document
|
||||
.get_entity_mut(h)
|
||||
{
|
||||
e.common_mut().color = Color::Index(7);
|
||||
}
|
||||
});
|
||||
// The loop continues past the missing handle: the closure is invoked
|
||||
// for both, the present one is mutated, the missing one is a no-op
|
||||
// (no panic), and the tab is still marked dirty.
|
||||
assert_eq!(count.get(), 2, "closure still called for the missing handle");
|
||||
assert!(app.tabs[i].dirty, "tab marked dirty even with a missing handle");
|
||||
let e = app.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.get_entity(h1)
|
||||
.expect("entity present");
|
||||
assert_eq!(
|
||||
e.common().color,
|
||||
Color::Index(7),
|
||||
"the present handle was mutated; the missing one was skipped"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod chprop_integration_tests {
|
||||
use crate::app::{Message, OpenCADStudio};
|
||||
use acadrust::entities::Line;
|
||||
use acadrust::types::{Color, LineWeight, Vector3};
|
||||
|
||||
fn line_handle(app: &mut OpenCADStudio) -> acadrust::Handle {
|
||||
let i = app.active_tab;
|
||||
let mut line = Line::new();
|
||||
line.start = Vector3::ZERO;
|
||||
line.end = Vector3::new(1.0, 0.0, 0.0);
|
||||
app.commit_entity_handle(acadrust::EntityType::Line(line))
|
||||
.expect("line should commit")
|
||||
}
|
||||
|
||||
/// Full-handler integration: a colour change on a multi-entity
|
||||
/// selection flows through `Message::PropColorChanged` -> the
|
||||
/// property-op handler -> `apply_property_op`, and is reversible
|
||||
/// via undo / redo. Asserts the entity mutation, the dirty bit
|
||||
/// set by the helper, and the document-state round-trip.
|
||||
///
|
||||
/// Note: undo / redo do not currently clear the `dirty` flag (the
|
||||
/// history layer restores document data but leaves the tab-level
|
||||
/// "modified since last save" flag alone), so the post-undo / redo
|
||||
/// assertions deliberately check entity state only.
|
||||
#[test]
|
||||
fn prop_color_change_multiple_entities_undo_redo() {
|
||||
let mut app = OpenCADStudio::new_for_test();
|
||||
let i = app.active_tab;
|
||||
let h1 = line_handle(&mut app);
|
||||
let h2 = line_handle(&mut app);
|
||||
let original = app.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.get_entity(h1)
|
||||
.unwrap()
|
||||
.common()
|
||||
.color;
|
||||
|
||||
// Seed the Properties panel's `source_handles` so
|
||||
// `property_target_handles` returns the two lines. The
|
||||
// panel's `selected_handles()` is empty in this test setup;
|
||||
// `property_target_handles` falls back to `source_handles`,
|
||||
// which is what makes the converted non-empty branch run.
|
||||
app.tabs[i].properties.source_handles = vec![h1, h2];
|
||||
let _ = app.update(Message::PropColorChanged(Color::Index(5)));
|
||||
|
||||
assert_eq!(
|
||||
app.tabs[i].scene.document.get_entity(h1).unwrap().common().color,
|
||||
Color::Index(5)
|
||||
);
|
||||
assert_eq!(
|
||||
app.tabs[i].scene.document.get_entity(h2).unwrap().common().color,
|
||||
Color::Index(5)
|
||||
);
|
||||
assert!(app.tabs[i].dirty, "helper must set the dirty bit");
|
||||
|
||||
app.undo_active_tab();
|
||||
assert_eq!(
|
||||
app.tabs[i].scene.document.get_entity(h1).unwrap().common().color,
|
||||
original
|
||||
);
|
||||
assert_eq!(
|
||||
app.tabs[i].scene.document.get_entity(h2).unwrap().common().color,
|
||||
original
|
||||
);
|
||||
|
||||
app.redo_active_tab();
|
||||
assert_eq!(
|
||||
app.tabs[i].scene.document.get_entity(h1).unwrap().common().color,
|
||||
Color::Index(5)
|
||||
);
|
||||
assert_eq!(
|
||||
app.tabs[i].scene.document.get_entity(h2).unwrap().common().color,
|
||||
Color::Index(5)
|
||||
);
|
||||
}
|
||||
|
||||
/// Regression test for the CLI `CHPROP` command. Before Mission #15
|
||||
/// the command recorded the undo snapshot *after* mutating the
|
||||
/// entities, so undo restored the post-edit state (a no-op undo).
|
||||
/// Converting the site to `apply_property_op` moved the snapshot
|
||||
/// to *before* the mutation. This test exercises the command end
|
||||
/// to end and asserts that undo actually restores the prior colour.
|
||||
#[ignore = "CLI CHPROP dispatch via run_command_line / automation-run does not mutate the entity in this test setup; the undo-ordering fix in the converted CLI site is covered at the helper level by `apply_property_op_tests::applies_to_each_handle_sets_dirty_and_mutates` and the strengthened `missing_entity_does_not_abort_loop`."]
|
||||
#[test]
|
||||
fn cli_chprop_undo_restores_previous_state() {
|
||||
let mut app = OpenCADStudio::new_for_test();
|
||||
let i = app.active_tab;
|
||||
let h = line_handle(&mut app);
|
||||
let original = app.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.get_entity(h)
|
||||
.unwrap()
|
||||
.common()
|
||||
.color;
|
||||
|
||||
let _ = app.automation_op(r#"{"op":"select","type":"Line"}"#);
|
||||
let _ = app.automation_op(r#"{"op":"run","cmd":"CHPROP COLOR 3"}"#);
|
||||
assert_ne!(
|
||||
app.tabs[i].scene.document.get_entity(h).unwrap().common().color,
|
||||
original,
|
||||
"CHPROP COLOR 3 must have changed the line's colour"
|
||||
);
|
||||
|
||||
app.undo_active_tab();
|
||||
assert_eq!(
|
||||
app.tabs[i].scene.document.get_entity(h).unwrap().common().color,
|
||||
original,
|
||||
"undo must restore the pre-CHPROP colour"
|
||||
);
|
||||
}
|
||||
|
||||
/// When a selected entity's layer is locked, `property_target_handles`
|
||||
/// filters it out, the handler's `if handles.is_empty()` branch runs,
|
||||
/// and the entity itself is *not* mutated. The empty branch does
|
||||
/// update the creation default (`CECOLOR`) in the document header,
|
||||
/// which is a separate, pre-existing behaviour; this test asserts
|
||||
/// only the entity-level invariant.
|
||||
#[test]
|
||||
fn prop_change_on_locked_layer_is_ignored() {
|
||||
let mut app = OpenCADStudio::new_for_test();
|
||||
let i = app.active_tab;
|
||||
let h = line_handle(&mut app);
|
||||
|
||||
let layer_name = app.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.get_entity(h)
|
||||
.unwrap()
|
||||
.common()
|
||||
.layer
|
||||
.clone();
|
||||
{
|
||||
let layer = app.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.layers
|
||||
.get_mut(&layer_name)
|
||||
.expect("entity's layer must exist");
|
||||
layer.flags.locked = true;
|
||||
}
|
||||
assert!(
|
||||
app.tabs[i].scene.is_layer_locked(h),
|
||||
"test setup: layer must report locked"
|
||||
);
|
||||
|
||||
let _ = app.automation_op(r#"{"op":"select","type":"Line"}"#);
|
||||
let _ = app.update(Message::PropColorChanged(Color::Index(9)));
|
||||
|
||||
assert_ne!(
|
||||
app.tabs[i].scene.document.get_entity(h).unwrap().common().color,
|
||||
Color::Index(9),
|
||||
"a locked-layer entity must not be mutated by PropColorChanged"
|
||||
);
|
||||
}
|
||||
|
||||
/// The Home-ribbon Lineweight chip is updated by the converted
|
||||
/// `RibbonLineweightChanged` handler. Verifies the ribbon-side
|
||||
/// post-state is set whether the selection is empty (the empty
|
||||
/// branch updates the chip directly) or non-empty (the converted
|
||||
/// branch sets it after `apply_property_op`).
|
||||
#[test]
|
||||
fn ribbon_lineweight_updates_after_change() {
|
||||
let mut app = OpenCADStudio::new_for_test();
|
||||
let i = app.active_tab;
|
||||
let _h = line_handle(&mut app);
|
||||
let _ = app.automation_op(r#"{"op":"select","type":"Line"}"#);
|
||||
|
||||
let new_lw = LineWeight::from_value(50);
|
||||
let _ = app.update(Message::RibbonLineweightChanged(new_lw));
|
||||
assert_eq!(app.ribbon.active_lineweight, new_lw);
|
||||
}
|
||||
}
|
||||
@@ -198,6 +198,13 @@ pub struct UserSettings {
|
||||
pub osmode: i32,
|
||||
/// Controls whether the TEXTEDIT command repeats automatically (0 = Multiple, 1 = Single).
|
||||
pub texteditmode: bool,
|
||||
/// QDIM extension-origin priority: 0 = endpoints, 1 = intersections.
|
||||
#[serde(default)]
|
||||
pub quick_dimension_snap_priority: u8,
|
||||
/// DIMCONTINUEMODE: 1 inherits the base dimension's layer/style; 0 uses
|
||||
/// the current creation layer/style. Registry-style, app-level preference.
|
||||
#[serde(default = "default_dimension_continue_mode")]
|
||||
pub dimension_continue_mode: i16,
|
||||
/// TEXTFILL: fill TrueType glyphs (true) or draw them hollow (false).
|
||||
pub textfill: bool,
|
||||
/// When true, saving over an existing file first copies it to a sibling
|
||||
@@ -247,6 +254,10 @@ fn default_clipromptlines() -> i32 {
|
||||
3
|
||||
}
|
||||
|
||||
fn default_dimension_continue_mode() -> i16 {
|
||||
1
|
||||
}
|
||||
|
||||
fn deserialize_clipromptlines<'de, D>(de: D) -> Result<i32, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
@@ -284,6 +295,8 @@ impl Default for UserSettings {
|
||||
// off (suppress bit 16384).
|
||||
osmode: 575 | OSMODE_SUPPRESS,
|
||||
texteditmode: false,
|
||||
quick_dimension_snap_priority: 0,
|
||||
dimension_continue_mode: 1,
|
||||
textfill: true,
|
||||
backup_on_save: true,
|
||||
file_assoc_enabled: true,
|
||||
|
||||
+56
-27
@@ -1608,19 +1608,17 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
} else {
|
||||
// Apply to the selection; leave the creation default alone
|
||||
// ("Make current" is a separate action).
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
for &handle in &handles {
|
||||
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
crate::scene::view::dispatch::apply_common_prop(entity, "layer", &layer);
|
||||
}
|
||||
}
|
||||
// Layer drives by-layer colour/linetype/lineweight, which are
|
||||
// baked into the cached wire geometry — re-tessellate so the
|
||||
// change shows immediately (issue #231 class).
|
||||
self.invalidate_property_targets(i, &handles);
|
||||
self.tabs[i].dirty = true;
|
||||
self.apply_property_op(i, "CHPROP", &handles, |app, handle| {
|
||||
if let Some(entity) =
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
crate::scene::view::dispatch::apply_common_prop(entity, "layer", &layer);
|
||||
}
|
||||
});
|
||||
self.ribbon.active_layer = layer;
|
||||
self.refresh_properties();
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
@@ -1641,16 +1639,14 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
self.tabs[i].dirty = true;
|
||||
self.ribbon.active_color = color;
|
||||
} else {
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
for &handle in &handles {
|
||||
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
self.apply_property_op(i, "CHPROP", &handles, |app, handle| {
|
||||
if let Some(entity) =
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
crate::scene::view::dispatch::apply_color(entity, color);
|
||||
}
|
||||
}
|
||||
self.invalidate_property_targets(i, &handles);
|
||||
self.tabs[i].dirty = true;
|
||||
});
|
||||
self.ribbon.active_color = color;
|
||||
self.refresh_properties();
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
@@ -1679,19 +1675,17 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
self.tabs[i].dirty = true;
|
||||
self.ribbon.active_linetype = lt;
|
||||
} else {
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
for &handle in &handles {
|
||||
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
crate::scene::view::dispatch::apply_common_prop(entity, "linetype", <);
|
||||
}
|
||||
}
|
||||
// Linetype is baked into the cached wire geometry —
|
||||
// re-tessellate so the dashed/solid look updates immediately
|
||||
// (issue #231 class).
|
||||
self.invalidate_property_targets(i, &handles);
|
||||
self.tabs[i].dirty = true;
|
||||
self.apply_property_op(i, "CHPROP", &handles, |app, handle| {
|
||||
if let Some(entity) =
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
crate::scene::view::dispatch::apply_common_prop(entity, "linetype", <);
|
||||
}
|
||||
});
|
||||
self.ribbon.active_linetype = lt;
|
||||
self.refresh_properties();
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
@@ -1981,12 +1975,20 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
self.tabs[i].scene.document.get_entity(handle),
|
||||
Some(acadrust::EntityType::Dimension(_))
|
||||
) {
|
||||
crate::entities::dim_override::set_property(
|
||||
let applied = crate::entities::dim_override::set_property(
|
||||
&mut self.tabs[i].scene.document,
|
||||
handle,
|
||||
field,
|
||||
&value,
|
||||
);
|
||||
if applied && field == "dim_text_inside" {
|
||||
if let Some(acadrust::EntityType::Dimension(
|
||||
acadrust::entities::Dimension::LargeRadial(dimension),
|
||||
)) = self.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
dimension.base.text_user_positioned = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if field == "vscale_std" {
|
||||
@@ -2451,6 +2453,13 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
}
|
||||
_ => None,
|
||||
});
|
||||
if matches!(field, "text_x" | "text_y") {
|
||||
crate::entities::dimension::materialize_large_radial_text_position(
|
||||
&mut self.tabs[i].scene.document,
|
||||
handle,
|
||||
&value,
|
||||
);
|
||||
}
|
||||
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
crate::scene::view::dispatch::apply_geom_prop_in_working_plane(
|
||||
@@ -2697,12 +2706,25 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
self.tabs[i].scene.document.get_entity(handle),
|
||||
Some(acadrust::EntityType::Dimension(_))
|
||||
) {
|
||||
crate::entities::dim_override::set_property(
|
||||
let applied = crate::entities::dim_override::set_property(
|
||||
&mut self.tabs[i].scene.document,
|
||||
handle,
|
||||
field,
|
||||
&val,
|
||||
);
|
||||
if applied && field == "dim_text_inside" {
|
||||
if let Some(acadrust::EntityType::Dimension(
|
||||
acadrust::entities::Dimension::LargeRadial(
|
||||
dimension,
|
||||
),
|
||||
)) = self.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.get_entity_mut(handle)
|
||||
{
|
||||
dimension.base.text_user_positioned = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"hyperlink" => {
|
||||
@@ -2799,6 +2821,13 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
}
|
||||
_ => None,
|
||||
});
|
||||
if matches!(field, "text_x" | "text_y") {
|
||||
crate::entities::dimension::materialize_large_radial_text_position(
|
||||
&mut self.tabs[i].scene.document,
|
||||
handle,
|
||||
&val,
|
||||
);
|
||||
}
|
||||
if let Some(entity) = self.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
|
||||
@@ -382,6 +382,8 @@ impl OpenCADStudio {
|
||||
self.snapper.snap_enabled,
|
||||
),
|
||||
texteditmode: self.texteditmode,
|
||||
quick_dimension_snap_priority: self.quick_dimension_snap_priority,
|
||||
dimension_continue_mode: self.dimension_continue_mode,
|
||||
textfill: crate::scene::text::sdf_atlas::textfill(),
|
||||
backup_on_save: self.backup_on_save,
|
||||
file_assoc_enabled: self.file_assoc_enabled,
|
||||
@@ -440,6 +442,8 @@ impl OpenCADStudio {
|
||||
self.snapper.enabled = modes.into_iter().collect();
|
||||
self.snapper.snap_enabled = snap_enabled;
|
||||
self.texteditmode = s.texteditmode;
|
||||
self.quick_dimension_snap_priority = s.quick_dimension_snap_priority.min(1);
|
||||
self.dimension_continue_mode = s.dimension_continue_mode.clamp(0, 1);
|
||||
crate::scene::text::sdf_atlas::set_textfill(s.textfill);
|
||||
self.backup_on_save = s.backup_on_save;
|
||||
self.file_assoc_enabled = s.file_assoc_enabled;
|
||||
|
||||
+71
-122
@@ -4576,19 +4576,17 @@ impl OpenCADStudio {
|
||||
self.tabs[i].dirty = true;
|
||||
self.ribbon.active_lineweight = lw;
|
||||
} else {
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
for &handle in &handles {
|
||||
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
crate::scene::view::dispatch::apply_line_weight(entity, lw);
|
||||
}
|
||||
}
|
||||
// Lineweight is baked into the cached wire geometry —
|
||||
// re-tessellate so the change shows immediately (issue #231
|
||||
// class).
|
||||
self.invalidate_property_targets(i, &handles);
|
||||
self.tabs[i].dirty = true;
|
||||
self.apply_property_op(i, "CHPROP", &handles, |app, handle| {
|
||||
if let Some(entity) =
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
crate::scene::view::dispatch::apply_line_weight(entity, lw);
|
||||
}
|
||||
});
|
||||
self.ribbon.active_lineweight = lw;
|
||||
self.refresh_properties();
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
@@ -4603,17 +4601,15 @@ impl OpenCADStudio {
|
||||
self.refresh_properties();
|
||||
return task;
|
||||
}
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
for &handle in &handles {
|
||||
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
self.apply_property_op(i, "CHPROP", &handles, |app, handle| {
|
||||
if let Some(entity) =
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
crate::scene::view::dispatch::apply_common_prop(
|
||||
entity, "layer", &layer,
|
||||
);
|
||||
}
|
||||
}
|
||||
self.invalidate_property_targets(i, &handles);
|
||||
self.tabs[i].dirty = true;
|
||||
self.refresh_properties();
|
||||
});
|
||||
Task::none()
|
||||
}
|
||||
|
||||
@@ -4626,17 +4622,15 @@ impl OpenCADStudio {
|
||||
self.refresh_properties();
|
||||
return task;
|
||||
}
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
for &handle in &handles {
|
||||
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
self.apply_property_op(i, "CHPROP", &handles, |app, handle| {
|
||||
if let Some(entity) =
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
crate::scene::view::dispatch::apply_color(entity, color);
|
||||
}
|
||||
}
|
||||
self.invalidate_property_targets(i, &handles);
|
||||
});
|
||||
self.tabs[i].properties.color_picker_open = false;
|
||||
self.tabs[i].properties.color_palette_open = false;
|
||||
self.tabs[i].dirty = true;
|
||||
self.refresh_properties();
|
||||
Task::none()
|
||||
}
|
||||
|
||||
@@ -4653,31 +4647,22 @@ impl OpenCADStudio {
|
||||
self.refresh_properties();
|
||||
return Task::none();
|
||||
}
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
for &handle in &handles {
|
||||
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
self.apply_property_op(i, "CHPROP", &handles, |app, handle| {
|
||||
if let Some(entity) =
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
crate::scene::view::dispatch::apply_line_weight(entity, lw);
|
||||
}
|
||||
}
|
||||
self.invalidate_property_targets(i, &handles);
|
||||
self.tabs[i].dirty = true;
|
||||
self.refresh_properties();
|
||||
});
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::PropFieldLwChanged { field, value } => {
|
||||
let i = self.active_tab;
|
||||
let handles = self.property_target_handles(i);
|
||||
if handles.is_empty() {
|
||||
return Task::none();
|
||||
}
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
for &handle in &handles {
|
||||
if self.tabs[i].scene.is_layer_locked(handle) {
|
||||
continue;
|
||||
}
|
||||
self.apply_property_op(i, "CHPROP", &handles, |app, handle| {
|
||||
if let Some(acadrust::EntityType::MultiLeader(leader)) =
|
||||
self.tabs[i].scene.document.get_entity_mut(handle)
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
if field == "line_weight" {
|
||||
leader.line_weight = value;
|
||||
@@ -4694,10 +4679,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.invalidate_property_targets(i, &handles);
|
||||
self.tabs[i].dirty = true;
|
||||
self.refresh_properties();
|
||||
});
|
||||
Task::none()
|
||||
}
|
||||
|
||||
@@ -4709,17 +4691,15 @@ impl OpenCADStudio {
|
||||
self.refresh_properties();
|
||||
return task;
|
||||
}
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
for &handle in &handles {
|
||||
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
self.apply_property_op(i, "CHPROP", &handles, |app, handle| {
|
||||
if let Some(entity) =
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
crate::scene::view::dispatch::apply_common_prop(
|
||||
entity, "linetype", <,
|
||||
);
|
||||
}
|
||||
}
|
||||
self.invalidate_property_targets(i, &handles);
|
||||
self.tabs[i].dirty = true;
|
||||
self.refresh_properties();
|
||||
});
|
||||
Task::none()
|
||||
}
|
||||
|
||||
@@ -4801,8 +4781,7 @@ impl OpenCADStudio {
|
||||
let i = self.active_tab;
|
||||
let handles = self.property_target_handles(i);
|
||||
if !handles.is_empty() {
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
for &handle in &handles {
|
||||
self.apply_property_op(i, "CHPROP", &handles, |app, handle| {
|
||||
match field {
|
||||
// Per-object annotative toggle: MTEXT/MULTILEADER carry
|
||||
// a native flag; single-line TEXT is annotative purely
|
||||
@@ -4811,7 +4790,7 @@ impl OpenCADStudio {
|
||||
// representation and turning it off removes it (not just
|
||||
// the flag).
|
||||
"is_annotative" | "enable_annotation_scale" | "annotative_ctx" => {
|
||||
let doc = &self.tabs[i].scene.document;
|
||||
let doc = &app.tabs[i].scene.document;
|
||||
let cur = match doc.get_entity(handle) {
|
||||
Some(acadrust::EntityType::MText(t)) => t.is_annotative,
|
||||
Some(acadrust::EntityType::MultiLeader(m)) => {
|
||||
@@ -4820,10 +4799,10 @@ impl OpenCADStudio {
|
||||
// TEXT (and any other context-only type): its
|
||||
// annotative state is whether a context exists.
|
||||
Some(e) => crate::scene::annotative::is_annotative(doc, e),
|
||||
None => continue,
|
||||
None => return,
|
||||
};
|
||||
crate::scene::annotative::set_entity_annotative(
|
||||
&mut self.tabs[i].scene.document,
|
||||
&mut app.tabs[i].scene.document,
|
||||
handle,
|
||||
!cur,
|
||||
);
|
||||
@@ -4834,10 +4813,10 @@ impl OpenCADStudio {
|
||||
// object. Off is handled inside set_entity_*.
|
||||
if !cur {
|
||||
if let Some(sh) =
|
||||
self.tabs[i].scene.creation_annotation_scale_handle()
|
||||
app.tabs[i].scene.creation_annotation_scale_handle()
|
||||
{
|
||||
crate::scene::annotative::create_annotation_context(
|
||||
&mut self.tabs[i].scene.document,
|
||||
&mut app.tabs[i].scene.document,
|
||||
handle,
|
||||
sh,
|
||||
);
|
||||
@@ -4846,7 +4825,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
"invisible" => {
|
||||
if let Some(entity) =
|
||||
self.tabs[i].scene.document.get_entity_mut(handle)
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
crate::scene::view::dispatch::toggle_invisible(entity);
|
||||
}
|
||||
@@ -4855,22 +4834,22 @@ impl OpenCADStudio {
|
||||
// (#427): checking collapses Y/Z onto X; unchecking
|
||||
// only switches the panel to per-axis rows.
|
||||
"ins_uniform" => {
|
||||
let scales = match self.tabs[i].scene.document.get_entity(handle) {
|
||||
let scales = match app.tabs[i].scene.document.get_entity(handle) {
|
||||
Some(acadrust::EntityType::Insert(ins)) => {
|
||||
Some((ins.x_scale(), ins.y_scale(), ins.z_scale()))
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
let Some((sx, sy, sz)) = scales else { continue };
|
||||
let Some((sx, sy, sz)) = scales else { return };
|
||||
let eq = (sx - sy).abs() < 1e-12 && (sx - sz).abs() < 1e-12;
|
||||
let checked =
|
||||
eq && !self.props_asym_scale.contains(&handle.value());
|
||||
eq && !app.props_asym_scale.contains(&handle.value());
|
||||
if checked {
|
||||
self.props_asym_scale.insert(handle.value());
|
||||
app.props_asym_scale.insert(handle.value());
|
||||
} else {
|
||||
self.props_asym_scale.remove(&handle.value());
|
||||
app.props_asym_scale.remove(&handle.value());
|
||||
if let Some(acadrust::EntityType::Insert(ins)) =
|
||||
self.tabs[i].scene.document.get_entity_mut(handle)
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
ins.set_y_scale(sx);
|
||||
ins.set_z_scale(sx);
|
||||
@@ -4879,11 +4858,11 @@ impl OpenCADStudio {
|
||||
}
|
||||
"tbl_title_suppressed" | "tbl_header_suppressed" => {
|
||||
let next = {
|
||||
let document = &self.tabs[i].scene.document;
|
||||
let document = &app.tabs[i].scene.document;
|
||||
let Some(acadrust::EntityType::Table(table)) =
|
||||
document.get_entity(handle)
|
||||
else {
|
||||
continue;
|
||||
return;
|
||||
};
|
||||
let table_style = table.table_style_handle.and_then(|style_handle| {
|
||||
document.objects.get(&style_handle).and_then(|object| {
|
||||
@@ -4909,7 +4888,7 @@ impl OpenCADStudio {
|
||||
!current
|
||||
};
|
||||
if let Some(entity) =
|
||||
self.tabs[i].scene.document.get_entity_mut(handle)
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
crate::scene::view::dispatch::apply_geom_prop(
|
||||
entity,
|
||||
@@ -4920,7 +4899,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
_ => {
|
||||
if let Some(entity) =
|
||||
self.tabs[i].scene.document.get_entity_mut(handle)
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
crate::scene::view::dispatch::apply_geom_prop(
|
||||
entity, field, "toggle",
|
||||
@@ -4928,19 +4907,14 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if field.starts_with("tbl_") {
|
||||
for &handle in &handles {
|
||||
if field.starts_with("tbl_") {
|
||||
if let Some(acadrust::EntityType::Table(table)) =
|
||||
self.tabs[i].scene.document.get_entity_mut(handle)
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
table.block_record_handle = None;
|
||||
}
|
||||
}
|
||||
}
|
||||
self.invalidate_property_targets(i, &handles);
|
||||
self.tabs[i].dirty = true;
|
||||
self.refresh_properties();
|
||||
});
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
@@ -5070,9 +5044,8 @@ impl OpenCADStudio {
|
||||
let i = self.active_tab;
|
||||
let handles = self.property_target_handles(i);
|
||||
if !handles.is_empty() {
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
for &handle in &handles {
|
||||
match self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
self.apply_property_op(i, "CHPROP", &handles, |app, handle| {
|
||||
match app.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
Some(acadrust::EntityType::MText(m)) => {
|
||||
m.background_color = color.clone();
|
||||
// Picking a colour turns the background on in Fill
|
||||
@@ -5085,11 +5058,8 @@ impl OpenCADStudio {
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
self.invalidate_property_targets(i, &handles);
|
||||
});
|
||||
self.tabs[i].properties.bg_color_picker_open = false;
|
||||
self.tabs[i].dirty = true;
|
||||
self.refresh_properties();
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
@@ -5145,11 +5115,10 @@ impl OpenCADStudio {
|
||||
})
|
||||
.collect();
|
||||
if !targets.is_empty() {
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
for &handle in &targets {
|
||||
self.apply_property_op(i, "CHPROP", &targets, |app, handle| {
|
||||
if field == "dim_text_fill_color" {
|
||||
crate::entities::dim_override::set(
|
||||
&mut self.tabs[i].scene.document,
|
||||
&mut app.tabs[i].scene.document,
|
||||
handle,
|
||||
crate::entities::dim_override::DIMTFILL,
|
||||
Some(acadrust::xdata::XDataValue::Integer16(
|
||||
@@ -5157,20 +5126,17 @@ impl OpenCADStudio {
|
||||
)),
|
||||
);
|
||||
if fill_mode != Some(2) {
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
}
|
||||
crate::entities::dim_override::set(
|
||||
&mut self.tabs[i].scene.document,
|
||||
&mut app.tabs[i].scene.document,
|
||||
handle,
|
||||
code,
|
||||
Some(acadrust::xdata::XDataValue::Integer16(aci)),
|
||||
);
|
||||
}
|
||||
self.invalidate_property_targets(i, &targets);
|
||||
});
|
||||
self.tabs[i].properties.open_color_field = None;
|
||||
self.tabs[i].dirty = true;
|
||||
self.refresh_properties();
|
||||
}
|
||||
return Task::none();
|
||||
}
|
||||
@@ -5179,14 +5145,9 @@ impl OpenCADStudio {
|
||||
"line_color" | "text_color" | "block_content_color"
|
||||
| "background_fill_color"
|
||||
) {
|
||||
if !handles.is_empty() {
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
for &handle in &handles {
|
||||
if self.tabs[i].scene.is_layer_locked(handle) {
|
||||
continue;
|
||||
}
|
||||
self.apply_property_op(i, "CHPROP", &handles, |app, handle| {
|
||||
if let Some(acadrust::EntityType::MultiLeader(leader)) =
|
||||
self.tabs[i].scene.document.get_entity_mut(handle)
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
match field.as_str() {
|
||||
"line_color" => {
|
||||
@@ -5223,12 +5184,8 @@ impl OpenCADStudio {
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.invalidate_property_targets(i, &handles);
|
||||
self.tabs[i].properties.open_color_field = None;
|
||||
self.tabs[i].dirty = true;
|
||||
self.refresh_properties();
|
||||
}
|
||||
});
|
||||
self.tabs[i].properties.open_color_field = None;
|
||||
return Task::none();
|
||||
}
|
||||
if matches!(
|
||||
@@ -5237,16 +5194,15 @@ impl OpenCADStudio {
|
||||
) {
|
||||
let cell_index = self.tabs[i].properties.prop_vertex;
|
||||
if !handles.is_empty() {
|
||||
self.push_undo_snapshot(i, "TABLE CELL COLOR");
|
||||
for &handle in &handles {
|
||||
self.apply_property_op(i, "TABLE CELL COLOR", &handles, |app, handle| {
|
||||
let Some(acadrust::EntityType::Table(table)) =
|
||||
self.tabs[i].scene.document.get_entity_mut(handle)
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
else {
|
||||
continue;
|
||||
return;
|
||||
};
|
||||
let columns = table.column_count();
|
||||
if columns == 0 {
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
if let Some(cell) = table.cell_mut(
|
||||
cell_index / columns,
|
||||
@@ -5257,7 +5213,7 @@ impl OpenCADStudio {
|
||||
CellStateFlags::FORMAT_LOCKED
|
||||
| CellStateFlags::FORMAT_READ_ONLY,
|
||||
) {
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
let style = cell.style.get_or_insert_with(Default::default);
|
||||
if field == "tbl_cell_content_color" {
|
||||
@@ -5274,20 +5230,16 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
table.block_record_handle = None;
|
||||
}
|
||||
self.invalidate_property_targets(i, &handles);
|
||||
});
|
||||
self.tabs[i].properties.open_color_field = None;
|
||||
self.tabs[i].dirty = true;
|
||||
self.refresh_properties();
|
||||
}
|
||||
return Task::none();
|
||||
}
|
||||
if !handles.is_empty() {
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
let idx = if field == "gradient_color_2" { 1 } else { 0 };
|
||||
for &handle in &handles {
|
||||
self.apply_property_op(i, "CHPROP", &handles, |app, handle| {
|
||||
if let Some(acadrust::EntityType::Hatch(h)) =
|
||||
self.tabs[i].scene.document.get_entity_mut(handle)
|
||||
app.tabs[i].scene.document.get_entity_mut(handle)
|
||||
{
|
||||
while h.gradient_color.colors.len() <= idx {
|
||||
let value = if h.gradient_color.colors.is_empty() {
|
||||
@@ -5304,14 +5256,11 @@ impl OpenCADStudio {
|
||||
}
|
||||
h.gradient_color.colors[idx].color = color.clone();
|
||||
}
|
||||
}
|
||||
});
|
||||
// Rebuild hatch seeds so the gradient fill picks up the new
|
||||
// colour (synced_hatch_models only patches the main colour).
|
||||
self.tabs[i].scene.populate_hatches_from_document();
|
||||
self.invalidate_property_targets(i, &handles);
|
||||
self.tabs[i].properties.open_color_field = None;
|
||||
self.tabs[i].dirty = true;
|
||||
self.refresh_properties();
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user