Unify presets and objects into one Objects list; every object card has an amount field

This commit is contained in:
2026-10-17 21:35:55 -04:00
parent 5b2bc25ef6
commit 1ecac34502
8 changed files with 213 additions and 260 deletions
+4 -1
View File
@@ -32,7 +32,10 @@ export function optimizeWithNN(state: LayoutState, options: NNOptions = {}): { b
targetY = entrance.y + (Math.random() - 0.5) * 40;
} else if (needsNearObj) {
const tid = (needsNearObj.params as any)?.targetId;
const t = tid ? candidate.furniture.find((x) => x.id === tid) : undefined;
const t = tid
? candidate.furniture.find((x) => x.id === tid) ||
candidate.furniture.find((x) => x.type === tid && x.id !== f.id)
: undefined;
if (t) {
targetX = t.shape.x + t.shape.width / 2 - f.shape.width / 2 + (Math.random() - 0.5) * 30;
targetY = t.shape.y + t.shape.height / 2 - f.shape.height / 2 + (Math.random() - 0.5) * 30;