forked from 1b-agent/opencadstudio-upstream
feat(viewport): hide ViewCube then render bar as the viewport narrows
When the viewport got too narrow the top-left render-mode bar and the top-right ViewCube overlapped. Hide them adaptively, measuring the render bar's real width rather than guessing: - Wrap the render bar in DensitySwap, which measures its natural width every frame and swaps it for an empty spacer once it no longer fits the tile. Add report_width0 so it publishes that measured width to render_bar_w. - Compute viewcube_visible from that measured width: the cube shows only while bar_w + gap + cube region fits. This one flag drives the ViewCube nav/UCS widgets, the hover hit-test, and — threaded through build_viewports / build_viewport_for_pane / viewport_data_for — the GPU cube itself, which previously ignored the pane flag (show_viewcube was inst.active only), so the cube stayed while its surrounding widgets vanished. Result: the ViewCube gives way first, then the render bar once it too has no room — no overlap, sized to the bar's real width (which varies with the render-mode label, split buttons and tile count). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
07eb9dcb9a
commit
7cba5c8679
5 files changed
+128
-27
No files matched your search
@@ -398,6 +398,11 @@ pub(super) struct OpenCADStudio {
|
||||
ucs_icon_at_origin: bool,
|
||||
/// Whether the ViewCube 3D gizmo is visible in model space (NAVVCUBE).
|
||||
show_viewcube: bool,
|
||||
/// Measured natural width (px, as `f32` bits) of the active viewport's
|
||||
/// render-mode control bar, written each frame by its `DensitySwap` and read
|
||||
/// next frame to decide whether the ViewCube still has room beside it — so
|
||||
/// the two corner widgets adapt to the bar's real width, not an estimate.
|
||||
render_bar_w: std::sync::Arc<std::sync::atomic::AtomicU32>,
|
||||
/// Whether the Properties panel is shown on the left (PROPERTIES).
|
||||
show_properties: bool,
|
||||
/// Whether the document file tabs are shown at the top (FILETAB).
|
||||
@@ -2145,6 +2150,7 @@ impl OpenCADStudio {
|
||||
show_ucs_icon: true,
|
||||
ucs_icon_at_origin: true,
|
||||
show_viewcube: true,
|
||||
render_bar_w: std::sync::Arc::new(std::sync::atomic::AtomicU32::new(0)),
|
||||
show_properties: true,
|
||||
show_file_tabs: true,
|
||||
show_layout_tabs: true,
|
||||
|
||||
Reference in new issue
Block a user