fix(solid): refresh a DXF SOLID's fill after move/copy
A DXF SOLID renders as a cached solid-fill hatch, but transform_entities and copy_entities only rebuilt that cache for true HATCH entities — a SOLID fell through and kept drawing at its old position (or a copy showed nothing). Rebuild the solid-fill hatch for EntityType::Solid in both paths, matching the existing grip/add/open handling. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ae9940929c
commit
d1395e8f3d
1 changed files with 20 additions and 9 deletions
|
|
@ -5470,10 +5470,16 @@ impl Scene {
|
||||||
}
|
}
|
||||||
if self.hatches.contains_key(&h) {
|
if self.hatches.contains_key(&h) {
|
||||||
let existing_color = self.hatches[&h].color;
|
let existing_color = self.hatches[&h].color;
|
||||||
let new_model = if let Some(EntityType::Hatch(dxf)) = self.document.get_entity(h) {
|
let new_model = match self.document.get_entity(h) {
|
||||||
Self::hatch_model_from_dxf(dxf, existing_color, hatch_offset)
|
Some(EntityType::Hatch(dxf)) => {
|
||||||
} else {
|
Self::hatch_model_from_dxf(dxf, existing_color, hatch_offset)
|
||||||
None
|
}
|
||||||
|
// A DXF SOLID renders as a solid-fill hatch; rebuild it from
|
||||||
|
// the moved corners so the fill follows the transform.
|
||||||
|
Some(EntityType::Solid(s)) => {
|
||||||
|
Some(Self::solid_hatch_model(s, existing_color, hatch_offset))
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
};
|
};
|
||||||
if let Some(model) = new_model {
|
if let Some(model) = new_model {
|
||||||
self.hatches.insert(h, model);
|
self.hatches.insert(h, model);
|
||||||
|
|
@ -5565,11 +5571,16 @@ impl Scene {
|
||||||
entity.common_mut().handle = Handle::NULL;
|
entity.common_mut().handle = Handle::NULL;
|
||||||
let h = self.document.add_entity(entity).unwrap_or(Handle::NULL);
|
let h = self.document.add_entity(entity).unwrap_or(Handle::NULL);
|
||||||
if !h.is_null() {
|
if !h.is_null() {
|
||||||
let new_model = if let Some(EntityType::Hatch(dxf)) = self.document.get_entity(h) {
|
let new_model = match self.document.get_entity(h) {
|
||||||
let color = convert::tess_util::aci_to_rgba(&dxf.common.color);
|
Some(EntityType::Hatch(dxf)) => {
|
||||||
Self::hatch_model_from_dxf(dxf, color, hatch_offset)
|
let color = convert::tess_util::aci_to_rgba(&dxf.common.color);
|
||||||
} else {
|
Self::hatch_model_from_dxf(dxf, color, hatch_offset)
|
||||||
None
|
}
|
||||||
|
Some(EntityType::Solid(s)) => {
|
||||||
|
let color = convert::tess_util::aci_to_rgba(&s.common.color);
|
||||||
|
Some(Self::solid_hatch_model(s, color, hatch_offset))
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
};
|
};
|
||||||
if let Some(model) = new_model {
|
if let Some(model) = new_model {
|
||||||
self.hatches.insert(h, model);
|
self.hatches.insert(h, model);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue