Configurable grid + snap-to-grid in the layout system (#45)
Build image / build-and-push (push) Successful in 7s

Closes #44. Two independent grids (garden + per-bed), each with a size and a snap toggle; snapping defaults off. See PR #45 for details.

Co-authored-by: Steve Dudenhoeffer <[email protected]>
This commit was merged in pull request #45.
This commit is contained in:
2026-07-19 07:07:14 +00:00
committed by steve
parent 9968c06243
commit e74fb308c1
23 changed files with 581 additions and 88 deletions
+8 -2
View File
@@ -27,6 +27,8 @@ type objectCreateRequest struct {
Plantable *bool `json:"plantable"`
Color *string `json:"color"`
Props json.RawMessage `json:"props"`
GridSizeCM float64 `json:"gridSizeCm"`
SnapToGrid bool `json:"snapToGrid"`
Notes string `json:"notes"`
}
@@ -35,7 +37,8 @@ func (r objectCreateRequest) toInput() service.ObjectInput {
Kind: r.Kind, Name: r.Name, Shape: r.Shape,
XCM: r.XCM, YCM: r.YCM, WidthCM: r.WidthCM, HeightCM: r.HeightCM,
RotationDeg: r.RotationDeg, ZIndex: r.ZIndex, Plantable: r.Plantable,
Color: r.Color, Props: propsFromRaw(r.Props), Notes: r.Notes,
Color: r.Color, Props: propsFromRaw(r.Props),
GridSizeCM: r.GridSizeCM, SnapToGrid: r.SnapToGrid, Notes: r.Notes,
}
}
@@ -54,6 +57,8 @@ type objectUpdateRequest struct {
Plantable *bool `json:"plantable"`
Color json.RawMessage `json:"color"`
Props json.RawMessage `json:"props"`
GridSizeCM *float64 `json:"gridSizeCm"`
SnapToGrid *bool `json:"snapToGrid"`
Notes *string `json:"notes"`
Version int64 `json:"version" binding:"required,min=1"`
}
@@ -67,7 +72,8 @@ func (r objectUpdateRequest) toPatch() (service.ObjectPatch, error) {
return service.ObjectPatch{
Name: r.Name, XCM: r.XCM, YCM: r.YCM, WidthCM: r.WidthCM, HeightCM: r.HeightCM,
RotationDeg: r.RotationDeg, ZIndex: r.ZIndex, Plantable: r.Plantable,
SetColor: setColor, Color: color, SetProps: setProps, Props: props, Notes: r.Notes,
SetColor: setColor, Color: color, SetProps: setProps, Props: props,
GridSizeCM: r.GridSizeCM, SnapToGrid: r.SnapToGrid, Notes: r.Notes,
}, nil
}