From 928e7df274edfb1f6350f21b1fdaa261ba8ad5a1 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Fri, 1 May 2026 21:19:09 +0300 Subject: [PATCH] fix: don't add model-space world_offset to paper-space grip absolute positions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GripApply::Absolute adds world_offset to convert local-space coordinates back to DXF space for model-space entities. Paper-space entities (viewports, etc.) use sheet mm coordinates with no world_offset, but the grip drag code was unconditionally adding scene.world_offset — causing grips to jump by the full model-space centroid offset (potentially hundreds of km for UTM drawings). Now world_offset is only applied when current_layout == "Model". Co-Authored-By: Claude Sonnet 4.6 --- src/app/update.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/update.rs b/src/app/update.rs index 3cbd34dff..6e23d7f37 100644 --- a/src/app/update.rs +++ b/src/app/update.rs @@ -1228,8 +1228,14 @@ impl H7CAD { } } - let wo = self.tabs[i].scene.world_offset; - let wo_vec = glam::Vec3::new(wo[0] as f32, wo[1] as f32, wo[2] as f32); + // Paper-space entities use sheet coordinates (no world_offset). + // Only add world_offset when converting local → DXF space in model space. + let wo_vec = if self.tabs[i].scene.current_layout == "Model" { + let wo = self.tabs[i].scene.world_offset; + glam::Vec3::new(wo[0] as f32, wo[1] as f32, wo[2] as f32) + } else { + glam::Vec3::ZERO + }; let apply = if grip.is_translate { GripApply::Translate(snapped - grip.last_world) } else {