From 21d0db0c25364b97dd46bdb6dbdb577bc77b0022 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Fri, 26 Jun 2026 09:31:59 +0300 Subject: [PATCH] fix(hatch): show fill on creation, not only after a boundary edit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `add_hatch` let `add_entity` build the render model from the new DXF entity (via `hatch_model_from_dxf`, AABB-centred `world_origin`) and insert it — then overwrote it with the command-built model, whose `world_origin` is [0, 0]. After the world_offset removal the fill is drawn relative-to-eye from `world_origin`, so a [0, 0] origin with a full-WCS boundary cancels to garbage in f32 and the fill renders off-screen — invisible until a later edit rebuilt it from the DXF. Drop the overwrite so creation keeps the correct seed; it now matches what an edit or reload produces. Fixes the regression for hatches drawn away from the origin. Co-Authored-By: Claude Opus 4.8 --- src/scene/mod.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/scene/mod.rs b/src/scene/mod.rs index 5502f2dfc..6133ae6ec 100644 --- a/src/scene/mod.rs +++ b/src/scene/mod.rs @@ -5441,11 +5441,13 @@ impl Scene { 1.0 }; - let handle = self.add_entity(EntityType::Hatch(dxf)); - if !handle.is_null() { - self.hatches.insert(handle, model); - } - handle + // `add_entity` already builds the render model from the DXF entity via + // `hatch_model_from_dxf` and inserts it with a correct `world_origin` + // (AABB-centred) for the relative-to-eye fill. The command-built `model` + // carries `world_origin: [0, 0]`, which after the world_offset removal + // leaves the fill mis-placed and effectively invisible until a later + // edit rebuilds it from the DXF — so keep the seed, don't overwrite it. + self.add_entity(EntityType::Hatch(dxf)) } pub fn clear(&mut self) {