Configurable grid + snap-to-grid in the layout system (#45)
Build image / build-and-push (push) Successful in 7s
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:
@@ -30,6 +30,8 @@ export const serverObjectSchema = z.object({
|
||||
plantable: z.boolean(),
|
||||
color: z.string().nullable().optional(),
|
||||
props: z.string().nullable().optional(),
|
||||
gridSizeCm: z.number(),
|
||||
snapToGrid: z.boolean(),
|
||||
notes: z.string(),
|
||||
version: z.number(),
|
||||
})
|
||||
@@ -59,6 +61,8 @@ export function toEditorObject(o: ServerObject): EditorObject {
|
||||
rotationDeg: o.rotationDeg,
|
||||
zIndex: o.zIndex,
|
||||
color: o.color ?? null,
|
||||
gridSizeCm: o.gridSizeCm,
|
||||
snapToGrid: o.snapToGrid,
|
||||
notes: o.notes,
|
||||
plantable: o.plantable,
|
||||
version: o.version,
|
||||
@@ -110,6 +114,8 @@ export interface ObjectCreate {
|
||||
zIndex?: number
|
||||
plantable?: boolean
|
||||
color?: string | null
|
||||
gridSizeCm?: number
|
||||
snapToGrid?: boolean
|
||||
}
|
||||
|
||||
export function useCreateObject(gardenId: number) {
|
||||
@@ -138,6 +144,8 @@ export interface ObjectPatch {
|
||||
zIndex?: number
|
||||
plantable?: boolean
|
||||
color?: string | null
|
||||
gridSizeCm?: number
|
||||
snapToGrid?: boolean
|
||||
notes?: string
|
||||
}
|
||||
|
||||
@@ -392,6 +400,8 @@ function applyServerPatch(o: ServerObject, patch: ObjectPatch): ServerObject {
|
||||
...(patch.zIndex !== undefined ? { zIndex: patch.zIndex } : {}),
|
||||
...(patch.plantable !== undefined ? { plantable: patch.plantable } : {}),
|
||||
...(patch.color !== undefined ? { color: patch.color } : {}),
|
||||
...(patch.gridSizeCm !== undefined ? { gridSizeCm: patch.gridSizeCm } : {}),
|
||||
...(patch.snapToGrid !== undefined ? { snapToGrid: patch.snapToGrid } : {}),
|
||||
...(patch.notes !== undefined ? { notes: patch.notes } : {}),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user