From 7336202afbb2f40f40b7fe8fcfa51cb72d72efc2 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 30 Nov 2026 00:13:44 +0000 Subject: [PATCH] Canvas grid: production's faint ink, a line every spacing at any zoom The grid takes production's black at alpha 40 instead of the overlay grid grey, and GridCrowding::Dense, so it keeps the grid spacing zoomed out as production does instead of doubling it. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/canvas/guides.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/canvas/guides.rs b/crates/ui-egui/src/canvas/guides.rs index 216b5b6d4..c0630e74e 100644 --- a/crates/ui-egui/src/canvas/guides.rs +++ b/crates/ui-egui/src/canvas/guides.rs @@ -4,6 +4,7 @@ use craft::theme::Rgba; use craft::ui::canvas::{CanvasSpace, Guide, GuideKey, GuideLine}; use craft::ui::canvas_controls::{CanvasGrid, GridCrowding, GuideReadout, Guides}; use craft::ui::contract::{Bind, Show as _}; +use craft::ui::style::DataColor; use deckcraft_engine::ToolKind; use deckcraft_model::DrawGuide; use serde_json::json; @@ -13,6 +14,9 @@ use crate::SlideApp; /// The drawing guides' ink: one see-through mid grey in every theme, so a guide reads on any slide. const GUIDE_INK: Rgba = Rgba([120, 120, 120, 170]); +/// The grid's ink: a faint black in every theme, light over the slide's text and pictures. +const GRID_INK: Rgba = Rgba([0, 0, 0, 40]); + /// Selected guide indices and the document guide list they identify; never saved. #[derive(Clone, Debug, Default, PartialEq)] pub(crate) struct GuideSelection { @@ -23,7 +27,7 @@ pub(crate) struct GuideSelection { represented: Vec, } -/// Shows the document grid within the slide's bounds. +/// Shows the document grid within the slide's bounds: a line every grid spacing at any zoom, a faint wash zoomed out. pub(crate) fn show_grid(app: &mut SlideApp, ui: &mut egui::Ui, space: &CanvasSpace) { if !app.ui.gridlines { return; @@ -31,11 +35,13 @@ pub(crate) fn show_grid(app: &mut SlideApp, ui: &mut egui::Ui, space: &CanvasSpa let Some(st) = app.session.active() else { return }; let size = st.doc.slide_size; let spacing = app.session.prefs.grid_spacing; + let [r, g, b, a] = GRID_INK.0; let _ = CanvasGrid::new("Grid") .spacing(Vec2::new(spacing, spacing)) .origin(Point::ZERO) .bounds(Rect::new(0.0, 0.0, size.width, size.height)) - .crowding(GridCrowding::Thin) + .color(DataColor::new(egui::Color32::from_rgba_unmultiplied(r, g, b, a))) + .crowding(GridCrowding::Dense) .show_at(ui, space.view.rect); }