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 <[email protected]>
This commit is contained in:
1 parent
091331f3bd
commit
977135fbbd
31 files changed
+58
-1
No files matched your search
+4
-1
@@ -316,6 +316,8 @@ pub struct CrosshairOptions {
|
||||
pub struct GridStyle {
|
||||
pub opacity: u8,
|
||||
pub bg_luminance: f32,
|
||||
/// Draw the coloured X/Y axis lines through the grid origin.
|
||||
pub axes: bool,
|
||||
}
|
||||
|
||||
impl Default for GridStyle {
|
||||
@@ -323,6 +325,7 @@ impl Default for GridStyle {
|
||||
Self {
|
||||
opacity: 18,
|
||||
bg_luminance: 0.15,
|
||||
axes: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2722,7 +2725,7 @@ fn draw_grid(
|
||||
});
|
||||
frame.stroke(&path, major_stroke);
|
||||
}
|
||||
if geometry.axis_extent > 0.0 {
|
||||
if style.axes && geometry.axis_extent > 0.0 {
|
||||
let (gx, gy, gz) = grid_axes;
|
||||
let extent = (geometry.axis_extent + step_x.max(step_y)) * 1.5;
|
||||
draw_axes(
|
||||
|
||||
@@ -35,6 +35,7 @@ pub struct DraftingSettingsState {
|
||||
pub grid_major_input: String,
|
||||
pub grid_adaptive: bool,
|
||||
pub grid_beyond_limits: bool,
|
||||
pub grid_axes: bool,
|
||||
pub isometric: bool,
|
||||
pub iso_plane: IsoPlane,
|
||||
pub snap_angle_deg: f32,
|
||||
@@ -72,6 +73,7 @@ impl DraftingSettingsState {
|
||||
|| self.grid_major_input != saved.grid_major_input
|
||||
|| self.grid_adaptive != saved.grid_adaptive
|
||||
|| self.grid_beyond_limits != saved.grid_beyond_limits
|
||||
|| self.grid_axes != saved.grid_axes
|
||||
|| self.isometric != saved.isometric
|
||||
|| self.iso_plane != saved.iso_plane
|
||||
|| (self.snap_angle_deg - saved.snap_angle_deg).abs() > 0.001
|
||||
@@ -387,6 +389,14 @@ pub fn view_window<'a>(
|
||||
]
|
||||
.spacing(6)
|
||||
.align_y(iced::Center),
|
||||
row![
|
||||
checkbox(state.grid_axes)
|
||||
.on_toggle(|_| Message::DraftingSettingsToggleGridAxes)
|
||||
.size(14),
|
||||
text(crate::t!("Display grid axis lines")).size(11),
|
||||
]
|
||||
.spacing(6)
|
||||
.align_y(iced::Center),
|
||||
]
|
||||
.spacing(6),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user