fix: remove dead code warning and fix sheet viewport double-click in DWG files

Remove unused `screen_delta_to_world` camera method (superseded by the
corrected pan_active_viewport formula).

Fix `is_content_viewport`: the old geometry fallback required the viewport
center to be near the origin, but DWG files never write the viewport id
field (stays 0) and the sheet viewport center is the paper centre
(e.g. 105, 148.5 mm for A4) — not the origin. This caused the sheet
viewport to be classified as a content viewport in DWG files, making it
both tessellated (border visible) and enterable via double-click.

The new heuristic uses only the scale: a sheet viewport has scale ≈ 1:1
(view_height ≈ paper height); true content viewports have deliberate
drawing scales (1:50, 1:100, …) that are far from 1.0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Sonnet 4.6 committed 2026-05-02 14:55:12 +03:00
1 parent fbb6a20f10
commit b346eb4d6e
2 files changed
+10 -14

No files matched your search

-10
View File
@@ -242,16 +242,6 @@ impl Camera {
self.target += cam_up * delta_y * speed;
}
/// Returns the world-space translation that `pan(delta_x, delta_y)` would
/// apply to the camera target — without actually moving the camera.
/// Used by MSPACE to pan the viewport's model-space view independently.
pub fn screen_delta_to_world(&self, delta_x: f32, delta_y: f32, _bounds: Rectangle) -> Vec3 {
let speed = self.distance * 0.001;
let cam_right = self.rotation * Vec3::X;
let cam_up = self.rotation * Vec3::Y;
-(cam_right * delta_x * speed) + (cam_up * delta_y * speed)
}
pub fn fit_to_bounds(&mut self, min: Vec3, max: Vec3) {
self.target = (min + max) * 0.5;
let size = (max - min).length();