forked from 1b-agent/opencadstudio-upstream
fix(view): keep named views of earlier versions at their place, in f64
A VIEW record's centre is an offset from its target in view coordinates. Views saved by earlier versions stored the target itself as the centre; treating that as an offset put them (and VIEW plots) at about twice the coordinates. One shared `named_view_center` now resolves the centre in f64 (DVec3/DQuat), taking a centre equal to a non-zero target as the old convention; VIEW RESTORE, the view plot window and Place on Sheet use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
76f4bb97dc
commit
8b9049c604
4 files changed
+24
-9
No files matched your search
@@ -5519,8 +5519,8 @@ impl OpenCADStudio {
|
||||
let half_w = view.width.abs() * 0.5;
|
||||
let half_h = view.height.abs() * 0.5;
|
||||
(half_w > 1e-9 && half_h > 1e-9).then_some(())?;
|
||||
// The view centre is relative to its target (plan views).
|
||||
let (cx, cy) = (view.target.x + view.center.x, view.target.y + view.center.y);
|
||||
let center = crate::scene::named_view_center(view);
|
||||
let (cx, cy) = (center.x, center.y);
|
||||
self.area_plot_job((cx - half_w, cy - half_h, cx + half_w, cy + half_h))
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user