diff --git a/src/scene/mod.rs b/src/scene/mod.rs index baa73e4bb..1d670cbfd 100644 --- a/src/scene/mod.rs +++ b/src/scene/mod.rs @@ -209,20 +209,15 @@ impl Scene { if vp.id == 1 { return false; } if vp.id > 1 { return true; } // id ≤ 0: DWG files never write group-code 69 (viewport id), so all - // viewports arrive with id=0. Distinguish the sheet viewport by scale: - // the sheet ("overall") viewport has view_height ≈ vp.height → scale ≈ 1. - // True content viewports have deliberate drawing scales (1:50, 1:100 …) - // whose scale value is far from 1.0. The old check also required the - // center to be at the origin, but the sheet viewport center is the - // paper centre (e.g. 105, 148.5 for A4), so that condition failed for - // DWG files and incorrectly classified the sheet viewport as a content - // viewport — making it tessellated and enterable via double-click. - let scale = if vp.view_height.abs() > 1e-9 { - vp.height / vp.view_height - } else { - 1.0 - }; - (scale - 1.0).abs() >= 0.02 + // viewports arrive with id=0. + // + // In DWG format the sheet ("overall") viewport always has its center at + // the paper-space origin (0, 0). Content viewports are placed at their + // actual position on the paper and therefore have a non-zero center. + // Using center position is more reliable than a scale heuristic because + // the sheet viewport's scale is not always exactly 1:1 (observed: 0.8965 + // in real-world files, which the old 0.02 tolerance missed entirely). + vp.center.x.abs() >= 0.5 || vp.center.y.abs() >= 0.5 }