mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 03:48:11 +08:00
Fix grid overlay color showing as none
This commit is contained in:
@@ -11,7 +11,7 @@ use graphene_std::vector::style::FillChoice;
|
||||
|
||||
fn grid_overlay_rectangular(document: &DocumentMessageHandler, overlay_context: &mut OverlayContext, spacing: DVec2) {
|
||||
let origin = document.snapping_state.grid.origin;
|
||||
let grid_color: Color = document.snapping_state.grid.grid_color;
|
||||
let grid_color = document.snapping_state.grid.grid_color;
|
||||
let Some(spacing) = GridSnapping::compute_rectangle_spacing(spacing, &document.document_ptz) else {
|
||||
return;
|
||||
};
|
||||
@@ -51,7 +51,7 @@ fn grid_overlay_rectangular(document: &DocumentMessageHandler, overlay_context:
|
||||
// The draw dashed line method will also be not grid aligned for tilted grids.
|
||||
// TODO: Potentially create an image and render the image onto the canvas a single time.
|
||||
// TODO: Implement this with a dashed line (`set_line_dash`), with integer spacing which is continuously adjusted to correct the accumulated error.
|
||||
fn grid_overlay_dot(document: &DocumentMessageHandler, overlay_context: &mut OverlayContext, spacing: DVec2) {
|
||||
fn grid_overlay_rectangular_dot(document: &DocumentMessageHandler, overlay_context: &mut OverlayContext, spacing: DVec2) {
|
||||
let origin = document.snapping_state.grid.origin;
|
||||
let grid_color = document.snapping_state.grid.grid_color;
|
||||
let Some(spacing) = GridSnapping::compute_rectangle_spacing(spacing, &document.document_ptz) else {
|
||||
@@ -188,7 +188,7 @@ pub fn grid_overlay(document: &DocumentMessageHandler, overlay_context: &mut Ove
|
||||
match document.snapping_state.grid.grid_type {
|
||||
GridType::Rectangle { spacing } => {
|
||||
if document.snapping_state.grid.dot_display {
|
||||
grid_overlay_dot(document, overlay_context, spacing)
|
||||
grid_overlay_rectangular_dot(document, overlay_context, spacing)
|
||||
} else {
|
||||
grid_overlay_rectangular(document, overlay_context, spacing)
|
||||
}
|
||||
@@ -276,6 +276,7 @@ pub fn overlay_options(grid: &GridSnapping) -> Vec<LayoutGroup> {
|
||||
color_widgets.push(
|
||||
ColorButton::new(FillChoice::Solid(grid.grid_color))
|
||||
.tooltip("Grid display color")
|
||||
.allow_none(false)
|
||||
.on_update(update_color(grid, |grid| Some(&mut grid.grid_color)))
|
||||
.widget_holder(),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user