forked from 1b-agent/opencadstudio-upstream
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 <[email protected]>
This commit is contained in:
1 parent
ae9940929c
commit
d1395e8f3d
1 file changed
+20
-9
+20
-9
@@ -5470,10 +5470,16 @@ impl Scene {
|
||||
}
|
||||
if self.hatches.contains_key(&h) {
|
||||
let existing_color = self.hatches[&h].color;
|
||||
let new_model = if let Some(EntityType::Hatch(dxf)) = self.document.get_entity(h) {
|
||||
Self::hatch_model_from_dxf(dxf, existing_color, hatch_offset)
|
||||
} else {
|
||||
None
|
||||
let new_model = match self.document.get_entity(h) {
|
||||
Some(EntityType::Hatch(dxf)) => {
|
||||
Self::hatch_model_from_dxf(dxf, existing_color, hatch_offset)
|
||||
}
|
||||
// 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 {
|
||||
self.hatches.insert(h, model);
|
||||
@@ -5565,11 +5571,16 @@ impl Scene {
|
||||
entity.common_mut().handle = Handle::NULL;
|
||||
let h = self.document.add_entity(entity).unwrap_or(Handle::NULL);
|
||||
if !h.is_null() {
|
||||
let new_model = if let Some(EntityType::Hatch(dxf)) = self.document.get_entity(h) {
|
||||
let color = convert::tess_util::aci_to_rgba(&dxf.common.color);
|
||||
Self::hatch_model_from_dxf(dxf, color, hatch_offset)
|
||||
} else {
|
||||
None
|
||||
let new_model = match self.document.get_entity(h) {
|
||||
Some(EntityType::Hatch(dxf)) => {
|
||||
let color = convert::tess_util::aci_to_rgba(&dxf.common.color);
|
||||
Self::hatch_model_from_dxf(dxf, color, hatch_offset)
|
||||
}
|
||||
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 {
|
||||
self.hatches.insert(h, model);
|
||||
|
||||
Reference in new issue
Block a user