fix(viewport): adapt entity colours to visible bg

`model_wires_for_viewport` was tessellating with `self.bg_color` (the
model bg), so model content rendered inside a paper-layout viewport
adapted to a dark bg even though the transparent shader now reveals
the PaperCanvas sheet behind it — white wires stayed white on a light
sheet. Pass the paper bg in a paper layout.

Wire cache also needed an explicit invalidation when the bg or the
active layout changes; otherwise the cached, already-adapted wires
were returned against the new bg unchanged.

- BACKGROUND command bumps `geometry_epoch` after both branches
- new `Scene::set_current_layout` setter bumps on actual change; layout
  switch + history restore use it
This commit is contained in:
Hakan Seven 2026-05-28 18:28:18 +03:00
commit e3c962bdd1
4 changed files with 36 additions and 3 deletions

View file

@ -32,7 +32,11 @@ impl OpenCADStudio {
pub(super) fn restore_history_snapshot(&mut self, i: usize, snapshot: HistorySnapshot) {
self.tabs[i].scene.document = snapshot.document;
self.tabs[i].scene.current_layout = snapshot.current_layout;
self.tabs[i].scene.set_current_layout(snapshot.current_layout);
// Force a re-tessellation: the cached wires were keyed against the
// outgoing document / layout and would be returned unchanged
// otherwise (`set_current_layout` only bumps on actual change).
self.tabs[i].scene.bump_geometry();
self.tabs[i].scene.selected = snapshot
.selected
.into_iter()