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:
Hakan SevenandClaude Opus 4.8 committed 2026-07-10 14:58:48 +03:00
1 parent 07eb9dcb9a
commit 7cba5c8679
5 files changed
+128 -27

No files matched your search

+12 -6
View File
@@ -69,12 +69,18 @@ impl<'a, Msg: std::fmt::Debug + Clone> shader::Program<Msg> for ViewportPane<'a>
bounds: Rectangle,
) -> Self::Primitive {
match self.pane {
Some(idx) => self
.scene
.build_viewport_for_pane(bounds, idx, self.render_mode),
None => self
.scene
.build_viewports(bounds, self.render_mode, state.hover_region),
Some(idx) => self.scene.build_viewport_for_pane(
bounds,
idx,
self.render_mode,
self.show_viewcube,
),
None => self.scene.build_viewports(
bounds,
self.render_mode,
state.hover_region,
self.show_viewcube,
),
}
}