Unify presets and objects into one Objects list; every object card has an amount field
This commit is contained in:
+4
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user