From d1395e8f3df98851a1cda1ae9f4c8ff2f06f4cf7 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Sun, 21 Jun 2026 07:15:03 +0300 Subject: [PATCH] fix(solid): refresh a DXF SOLID's fill after move/copy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/scene/mod.rs | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/scene/mod.rs b/src/scene/mod.rs index 5a82349c6..0274df1fb 100644 --- a/src/scene/mod.rs +++ b/src/scene/mod.rs @@ -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);