forked from 1b-agent/opencadstudio-upstream
fix(grid): independent, clipped grid per viewport
Grid (and grid-snap) state was shared through the global show_grid flag, so toggling it in model space also turned it on in paper space, and a floating viewport's grid painted across the whole paper — and beyond the 3-D view when zoomed in. - Store grid/snap per view: a model tile in model space, the active floating viewport or the layout's sheet viewport in paper space, round-tripped via the viewport status flags. - adopt_view_display on layout switch and viewport enter/exit so the live toggle follows the view you are in. - Render one grid per view (paper_viewport_grid_views): the sheet over the paper, each floating viewport clipped to its screen rectangle. - Clamp the grid clip to the widget so an overflowing viewport rectangle never paints grid outside the 3-D view. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
ba834fb166
commit
26479b6faa
4 files changed
+122
-35
No files matched your search
+9
-1
@@ -5589,6 +5589,10 @@ impl OpenCADStudio {
|
||||
self.tabs[i].scene.deselect_all();
|
||||
self.tabs[i].scene.restore_saved_camera();
|
||||
self.tabs[i].last_synced_camera_gen = self.tabs[i].scene.camera_generation;
|
||||
// Grid/snap are per-view: load the layout we just entered (its
|
||||
// sheet viewport in paper space, the model tile in model space)
|
||||
// so model and each layout keep independent grid state.
|
||||
self.adopt_view_display(i);
|
||||
// Paper-space tools live in the right-edge side toolbar now, so
|
||||
// entering/leaving a layout no longer hijacks the ribbon tab.
|
||||
let _ = going_to_paper;
|
||||
@@ -6101,6 +6105,8 @@ impl OpenCADStudio {
|
||||
// Clear paper-space selection before entering model space.
|
||||
self.tabs[i].scene.deselect_all();
|
||||
self.tabs[i].scene.active_viewport = Some(handle);
|
||||
// Grid/snap follow the entered viewport.
|
||||
self.adopt_view_display(i);
|
||||
self.refresh_properties();
|
||||
self.command_line.push_output("MSPACE");
|
||||
Task::none()
|
||||
@@ -6110,8 +6116,10 @@ impl OpenCADStudio {
|
||||
let i = self.active_tab;
|
||||
// Clear model-space selection before returning to paper space.
|
||||
self.tabs[i].scene.deselect_all();
|
||||
self.refresh_properties();
|
||||
self.tabs[i].scene.active_viewport = None;
|
||||
// Grid/snap return to the paper sheet's own state.
|
||||
self.adopt_view_display(i);
|
||||
self.refresh_properties();
|
||||
self.command_line.push_output("PSPACE");
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user