forked from 1b-agent/opencadstudio-upstream
fix(viewport): frame model-documentation drawing views correctly
A floating viewport with a real saved view — a non-zero view target, as a model documentation drawing view or a detail/section viewport carries — now uses that view directly instead of running the median-cluster overlap test. That test measured against the densest sub-cluster (a big symbol library beside the small view geometry) and wrongly auto-fit these viewports onto the library. A fully uninitialised view (target AND centre both zero) frames its saved origin and stays empty rather than auto-fitting the whole model in; the auto-fit rescue is kept only for a stale target=(0,0,0) paired with a non-zero pre-georeference centre. Also widen the restored-view ortho depth half-range (view_height ×4 → ×64): a thin projection such as a section/side view has content far deeper than its visible height (its cut plane sits ~half an object-depth from the view target), so the tighter range clipped the view outline behind the far plane. Orthographic depth precision is linear, so the wider range costs no z-fighting. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
b884e33f38
commit
251ad436d7
2 files changed
+52
-8
No files matched your search
@@ -242,10 +242,15 @@ impl Scene {
|
||||
projection: view::camera::Projection::Orthographic,
|
||||
yaw,
|
||||
pitch,
|
||||
// Sized from the saved view height rather than a zoom-scaled range,
|
||||
// so a restored view keeps stable depth precision. `view_height` is
|
||||
// the visible extent; a few multiples cover the drawing's depth.
|
||||
depth_half_range: (view_height as f32 * 4.0).max(1.0),
|
||||
// Sized from the saved view height (not a zoom-scaled range) so a
|
||||
// restored view keeps stable depth precision. A THIN projection —
|
||||
// e.g. a model-documentation section/side view whose cut plane sits
|
||||
// half an object-depth from the view target — has content much
|
||||
// deeper than its visible height, so the depth half-range must be a
|
||||
// generous multiple: `×4` clipped a section view's outline that was
|
||||
// ~6× the view height deep. Orthographic depth precision is linear,
|
||||
// so the wide range costs no z-fighting.
|
||||
depth_half_range: (view_height as f32 * 64.0).max(1.0),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user