forked from 1b-agent/opencadstudio-upstream
fix: honor GRIDUNIT X/Y spacing and LIMITS option in grid display
The viewport grid ignored the configured spacing and forced square grids: compute_grid_step hardcoded a 1.0 base, a single shared step drove both line families (including the tangent derivative used for gap measurement), and the display always clipped to LIMITS despite the beyond-Limits option. Grid spacing now scales per-axis from GRIDUNIT via compute_grid_steps (adaptive 5x growth, fixed passthrough), GridParams carries step_x/step_y, snap tolerances follow the visible steps, and the LIMITS clip is skipped when beyond-Limits is set. Also fixes a per-axis overflow fallback that returned the X base for Y. Spacing state (X/Y, adaptive, beyond-Limits) is stored on the app and persisted to UserSettings at defaults; dialog wiring follows separately.
This commit is contained in:
1 parent
bb29b987c2
commit
05f462f294
7 files changed
+246
-73
No files matched your search
@@ -531,6 +531,10 @@ impl OpenCADStudio {
|
||||
),
|
||||
snap_spacing_x: self.snapper.snap_spacing_x,
|
||||
snap_spacing_y: self.snapper.snap_spacing_y,
|
||||
grid_spacing_x: self.grid_spacing_x,
|
||||
grid_spacing_y: self.grid_spacing_y,
|
||||
grid_adaptive: self.grid_adaptive,
|
||||
grid_beyond_limits: self.grid_beyond_limits,
|
||||
block_mru: self.block_mru.clone(),
|
||||
block_freq: self.block_freq.clone(),
|
||||
}
|
||||
@@ -635,6 +639,10 @@ impl OpenCADStudio {
|
||||
crate::app::settings::sanitize_snap_spacing(s.snap_spacing_x);
|
||||
self.snapper.snap_spacing_y =
|
||||
crate::app::settings::sanitize_snap_spacing(s.snap_spacing_y);
|
||||
self.grid_spacing_x = crate::app::settings::sanitize_snap_spacing(s.grid_spacing_x);
|
||||
self.grid_spacing_y = crate::app::settings::sanitize_snap_spacing(s.grid_spacing_y);
|
||||
self.grid_adaptive = s.grid_adaptive;
|
||||
self.grid_beyond_limits = s.grid_beyond_limits;
|
||||
// Block usage: clone but cap to sane sizes (MRU 20, freq map 200)
|
||||
self.block_mru = s.block_mru.iter().take(20).cloned().collect();
|
||||
self.block_freq = s
|
||||
|
||||
Reference in new issue
Block a user