forked from 1b-agent/opencadstudio-upstream
feat(grid): the coloured grid axis lines can be turned off (#1815)
Drafting Settings > Snap and Grid gains "Display grid axis lines", kept with the other grid settings; the grid itself stays as it is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
091331f3bd
commit
977135fbbd
31 files changed
+58
-1
No files matched your search
@@ -25,6 +25,7 @@ impl DraftingSettingsState {
|
||||
grid_major_input: format!("{}", app.grid_major_every),
|
||||
grid_adaptive: app.grid_adaptive,
|
||||
grid_beyond_limits: app.grid_beyond_limits,
|
||||
grid_axes: app.grid_axes,
|
||||
isometric: app.isometric_drafting,
|
||||
iso_plane: app.iso_plane,
|
||||
snap_angle_deg: app.snap_angle_deg,
|
||||
@@ -99,6 +100,7 @@ impl OpenCADStudio {
|
||||
self.grid_major_every = gm;
|
||||
self.grid_adaptive = state.grid_adaptive;
|
||||
self.grid_beyond_limits = state.grid_beyond_limits;
|
||||
self.grid_axes = state.grid_axes;
|
||||
self.snapper.grid_snap_on = state.snap_on;
|
||||
self.snapper.snap_spacing_x = sx;
|
||||
self.snapper.snap_spacing_y = sy;
|
||||
@@ -151,6 +153,7 @@ mod tests {
|
||||
grid_major_input: "5".to_string(),
|
||||
grid_adaptive: true,
|
||||
grid_beyond_limits: true,
|
||||
grid_axes: true,
|
||||
isometric: false,
|
||||
iso_plane: crate::app::settings::IsoPlane::Left,
|
||||
snap_angle_deg: 0.0,
|
||||
@@ -193,6 +196,7 @@ mod tests {
|
||||
grid_major_input: "5".to_string(),
|
||||
grid_adaptive: true,
|
||||
grid_beyond_limits: true,
|
||||
grid_axes: true,
|
||||
isometric: false,
|
||||
iso_plane: crate::app::settings::IsoPlane::Left,
|
||||
snap_angle_deg: 0.0,
|
||||
|
||||
@@ -756,6 +756,8 @@ pub(super) struct OpenCADStudio {
|
||||
pub grid_adaptive: bool,
|
||||
/// Display the grid beyond LIMITS (infinite) instead of clipping to them.
|
||||
pub grid_beyond_limits: bool,
|
||||
/// Draw the coloured X/Y axis lines through the grid origin.
|
||||
pub grid_axes: bool,
|
||||
/// Dynamic input overlay (F12): show coordinate tooltip near cursor.
|
||||
dyn_input: bool,
|
||||
/// Dynamic input mode (DYNMODE): 0=off, 1=pointer, 2=dimensional, 3=both.
|
||||
@@ -3567,6 +3569,7 @@ pub enum Message {
|
||||
DraftingSettingsGridMajorChanged(String),
|
||||
DraftingSettingsToggleAdaptiveGrid,
|
||||
DraftingSettingsToggleBeyondLimits,
|
||||
DraftingSettingsToggleGridAxes,
|
||||
DraftingSettingsToggleEqualSnap,
|
||||
DraftingSettingsToggleIsometric,
|
||||
DraftingSettingsSetIsoPlane(crate::app::settings::IsoPlane),
|
||||
@@ -4754,6 +4757,7 @@ impl OpenCADStudio {
|
||||
grid_major_every: 5,
|
||||
grid_adaptive: true,
|
||||
grid_beyond_limits: true,
|
||||
grid_axes: true,
|
||||
dyn_input: true,
|
||||
dyn_mode: 3,
|
||||
options_tab: crate::ui::window::options::OptionsTab::General,
|
||||
|
||||
@@ -704,6 +704,9 @@ pub struct UserSettings {
|
||||
/// Display grid beyond LIMITS (default on, matches dialog).
|
||||
#[serde(default = "default_true")]
|
||||
pub grid_beyond_limits: bool,
|
||||
/// Draw the coloured X/Y axis lines through the grid origin.
|
||||
#[serde(default = "default_true")]
|
||||
pub grid_axes: bool,
|
||||
/// Most-recently-inserted block names, most recent first, capped to 20.
|
||||
/// Used to rank INSERT suggestions without touching the drawing file.
|
||||
#[serde(default)]
|
||||
@@ -1052,6 +1055,7 @@ impl Default for UserSettings {
|
||||
grid_major_every: 5,
|
||||
grid_adaptive: true,
|
||||
grid_beyond_limits: true,
|
||||
grid_axes: true,
|
||||
block_mru: Vec::new(),
|
||||
block_freq: std::collections::HashMap::new(),
|
||||
block_recent: Vec::new(),
|
||||
|
||||
@@ -925,6 +925,7 @@ impl OpenCADStudio {
|
||||
grid_major_every: self.grid_major_every,
|
||||
grid_adaptive: self.grid_adaptive,
|
||||
grid_beyond_limits: self.grid_beyond_limits,
|
||||
grid_axes: self.grid_axes,
|
||||
block_mru: self.block_mru.clone(),
|
||||
block_freq: self.block_freq.clone(),
|
||||
block_recent: self.block_palette.recent.clone(),
|
||||
@@ -1110,6 +1111,7 @@ impl OpenCADStudio {
|
||||
self.grid_major_every = crate::app::settings::sanitize_grid_major(s.grid_major_every);
|
||||
self.grid_adaptive = s.grid_adaptive;
|
||||
self.grid_beyond_limits = s.grid_beyond_limits;
|
||||
self.grid_axes = s.grid_axes;
|
||||
// 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
|
||||
|
||||
@@ -6401,6 +6401,12 @@ impl OpenCADStudio {
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
Message::DraftingSettingsToggleGridAxes => {
|
||||
if let Some(state) = &mut self.drafting_settings_state {
|
||||
state.grid_axes = !state.grid_axes;
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
Message::DraftingSettingsToggleEqualSnap => {
|
||||
if let Some(state) = &mut self.drafting_settings_state {
|
||||
state.snap_equal = !state.snap_equal;
|
||||
|
||||
@@ -627,6 +627,7 @@ bg={bg_ms:.1}ms n={view_count}"
|
||||
let grid_style = crate::ui::overlay::GridStyle {
|
||||
opacity: self.model_space.grid_opacity,
|
||||
bg_luminance: bg_lum,
|
||||
axes: self.grid_axes,
|
||||
};
|
||||
crate::ui::overlay::grid_overlay(grid, grid_style)
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user