feat: editable grid spacing and major grid lines in Drafting Settings

The Snap and Grid tab showed static grid values with dead checkboxes, and every grid line stroked identically.

Grid X/Y spacing and Major-line-every are now editable inputs (validated 2-100 for majors, dirty-tracked, applied with an error message on bad input); Adaptive-grid and Display-beyond-Limits checkboxes are wired to live state. Every Nth line partitions into major_segments and strokes subtly brighter (1.5x alpha, 0.75px) for the reference hierarchy. GRIDMAJOR state persists to UserSettings. Covers partition, invalidation, and parse tests.
This commit is contained in:
Karim Jerbi committed 2026-09-17 13:52:37 +01:00
1 parent 05f462f294
commit 4aa699e08d
9 files changed
+249 -37

No files matched your search

+8
View File
@@ -545,6 +545,8 @@ pub(super) struct OpenCADStudio {
/// GRIDUNIT X/Y display spacing backing the DSettings grid-resize inputs.
pub grid_spacing_x: f32,
pub grid_spacing_y: f32,
/// GRIDMAJOR: every Nth line draws as a brighter major line.
pub grid_major_every: u32,
/// Adaptive grid: scale GRIDUNIT up by 5x steps to stay readable.
pub grid_adaptive: bool,
/// Display the grid beyond LIMITS (infinite) instead of clipping to them.
@@ -2767,6 +2769,11 @@ pub enum Message {
DraftingSettingsToggleSnap,
DraftingSettingsSnapXChanged(String),
DraftingSettingsSnapYChanged(String),
DraftingSettingsGridXChanged(String),
DraftingSettingsGridYChanged(String),
DraftingSettingsGridMajorChanged(String),
DraftingSettingsToggleAdaptiveGrid,
DraftingSettingsToggleBeyondLimits,
DraftingSettingsToggleEqualSnap,
DraftingSettingsToggleIsometric,
DraftingSettingsSetIsoPlane(crate::app::settings::IsoPlane),
@@ -3815,6 +3822,7 @@ impl OpenCADStudio {
show_grid: false,
grid_spacing_x: 10.0,
grid_spacing_y: 10.0,
grid_major_every: 5,
grid_adaptive: true,
grid_beyond_limits: true,
dyn_input: true,