ceiling holes

This commit is contained in:
wass08
2026-02-16 08:59:28 +09:00
parent 6f4ba92862
commit 13070a5630
9 changed files with 410 additions and 33 deletions
@@ -566,7 +566,7 @@ export class SpatialGridManager {
/**
* Check if an item can be placed on a ceiling.
* Validates that the footprint is within the ceiling polygon and doesn't overlap other ceiling items.
* Validates that the footprint is within the ceiling polygon (but not in any holes) and doesn't overlap other ceiling items.
*/
canPlaceOnCeiling(
ceilingId: string,
@@ -588,6 +588,15 @@ export class SpatialGridManager {
}
}
// Check if item center is in any hole (if so, it cannot be placed)
const [centerX, , centerZ] = position
const holes = ceiling.holes || []
for (const hole of holes) {
if (hole.length >= 3 && pointInPolygon(centerX, centerZ, hole)) {
return { valid: false, conflictIds: [] }
}
}
// Check for overlaps with other ceiling items
return this.getCeilingGrid(ceilingId).canPlace(position, dimensions, rotation, ignoreIds)
}