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:
Karim Jerbi committed 2026-09-17 13:52:37 +01:00
1 parent bb29b987c2
commit 05f462f294
7 files changed
+246 -73

No files matched your search

+8 -6
View File
@@ -1185,10 +1185,10 @@ fn bench_ui_grid_geometry(runner: &mut BenchmarkRunner) {
if runner.should_run("ui_grid_geometry_uncached") {
for _ in 0..10 {
let _ = black_box(grid_segments(
view_rot1, eye1, bounds1, step1, origin1, axes1, limits1,
view_rot1, eye1, bounds1, step1, step1, origin1, axes1, limits1,
));
let _ = black_box(grid_segments(
view_rot2, eye2, bounds2, step2, origin2, axes2, limits2,
view_rot2, eye2, bounds2, step2, step2, origin2, axes2, limits2,
));
}
@@ -1199,8 +1199,8 @@ fn bench_ui_grid_geometry(runner: &mut BenchmarkRunner) {
for _ in 0..runs {
let t0 = Instant::now();
for _ in 0..n {
let g1 = grid_segments(view_rot1, eye1, bounds1, step1, origin1, axes1, limits1);
let g2 = grid_segments(view_rot2, eye2, bounds2, step2, origin2, axes2, limits2);
let g1 = grid_segments(view_rot1, eye1, bounds1, step1, step1, origin1, axes1, limits1);
let g2 = grid_segments(view_rot2, eye2, bounds2, step2, step2, origin2, axes2, limits2);
black_box(g1);
black_box(g2);
}
@@ -1225,7 +1225,8 @@ fn bench_ui_grid_geometry(runner: &mut BenchmarkRunner) {
view_rot: view_rot1,
eye: eye1,
bounds: bounds1,
step: step1,
step_x: step1,
step_y: step1,
origin: origin1,
axes: axes1,
limits: limits1,
@@ -1234,7 +1235,8 @@ fn bench_ui_grid_geometry(runner: &mut BenchmarkRunner) {
view_rot: view_rot2,
eye: eye2,
bounds: bounds2,
step: step2,
step_x: step2,
step_y: step2,
origin: origin2,
axes: axes2,
limits: limits2,