Address Gadfly review: gofmt, memoize bed grid, unify clamp
Build image / build-and-push (push) Successful in 15s

- gofmt domain.go struct alignment.
- Memoize the bed grid line arrays so a high-frequency plop drag doesn't
  rebuild them each pointermove.
- Route the non-snapping placement/move paths through snapLocalToBedGrid
  with step 0 (pure clamp), removing the duplicated inline clamps in
  GardenCanvas.onPlace and PlopOverlay (drop the dead clampLocal helper).
- Factor snapLocalToBedGrid's per-axis snap-and-clamp into one local fn.
- Correct the gardenFromInput doc: grid size is defaulted from 0 on update.
- Fix inconsistent indentation of the Inspector Notes field.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdQpdYYsTgtkJBxbcpAszi
This commit is contained in:
2026-07-19 03:06:42 -04:00
co-authored by Claude Opus 4.8
parent 3f4d5627d8
commit 677dbf0756
6 changed files with 51 additions and 47 deletions
+10 -10
View File
@@ -120,13 +120,13 @@ type Session struct {
// Garden is a planning surface owned by one user, at real-world scale (cm).
type Garden struct {
ID int64 `json:"id"`
OwnerID int64 `json:"ownerId"`
Name string `json:"name"`
WidthCM float64 `json:"widthCm"`
HeightCM float64 `json:"heightCm"`
UnitPref string `json:"unitPref"`
Notes string `json:"notes"`
ID int64 `json:"id"`
OwnerID int64 `json:"ownerId"`
Name string `json:"name"`
WidthCM float64 `json:"widthCm"`
HeightCM float64 `json:"heightCm"`
UnitPref string `json:"unitPref"`
Notes string `json:"notes"`
// GridSizeCM is the garden-scale grid spacing (cm) the editor draws its grid
// from; SnapToGrid, when true, snaps objects to that grid on place/move/resize.
GridSizeCM float64 `json:"gridSizeCm"`
@@ -183,9 +183,9 @@ type GardenObject struct {
GridSizeCM float64 `json:"gridSizeCm"`
SnapToGrid bool `json:"snapToGrid"`
Notes string `json:"notes"`
Version int64 `json:"version"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
Version int64 `json:"version"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
// Plant is a catalog entry. OwnerID nil means a read-only seeded built-in.