fix build issues

This commit is contained in:
wass08
2026-02-12 10:56:56 +09:00
parent 83cd28b01b
commit 0797a828f8
4 changed files with 30 additions and 38 deletions
@@ -93,7 +93,7 @@ export function SlabPanel() {
setEditingHoleIndex(null) setEditingHoleIndex(null)
} }
}, },
[node?.holes, handleUpdate, editingHoleIndex], [node?.holes, handleUpdate, editingHoleIndex, setEditingHoleIndex],
) )
// Only show if exactly one slab is selected // Only show if exactly one slab is selected
@@ -34,7 +34,7 @@ export function AudioSettingsDialog() {
</div> </div>
<Slider <Slider
value={[masterVolume]} value={[masterVolume]}
onValueChange={(value) => setMasterVolume(value[0])} onValueChange={(value) => value[0] !== undefined && setMasterVolume(value[0])}
max={100} max={100}
step={1} step={1}
disabled={muted} disabled={muted}
@@ -49,7 +49,7 @@ export function AudioSettingsDialog() {
</div> </div>
<Slider <Slider
value={[radioVolume]} value={[radioVolume]}
onValueChange={(value) => setRadioVolume(value[0])} onValueChange={(value) => value[0] !== undefined && setRadioVolume(value[0])}
max={100} max={100}
step={1} step={1}
disabled={muted} disabled={muted}
@@ -64,7 +64,7 @@ export function AudioSettingsDialog() {
</div> </div>
<Slider <Slider
value={[sfxVolume]} value={[sfxVolume]}
onValueChange={(value) => setSfxVolume(value[0])} onValueChange={(value) => value[0] !== undefined && setSfxVolume(value[0])}
max={100} max={100}
step={1} step={1}
disabled={muted} disabled={muted}
@@ -468,12 +468,10 @@ export class SpatialGridManager {
if (slab.polygon.length >= 3 && pointInPolygon(x, z, slab.polygon)) { if (slab.polygon.length >= 3 && pointInPolygon(x, z, slab.polygon)) {
// Check if point is in any hole // Check if point is in any hole
let inHole = false let inHole = false
if (slab.holes && slab.holes.length > 0) { for (const hole of slab.holes) {
for (const hole of slab.holes) { if (hole.length >= 3 && pointInPolygon(x, z, hole)) {
if (hole.length >= 3 && pointInPolygon(x, z, hole)) { inHole = true
inHole = true break
break
}
} }
} }
@@ -508,13 +506,11 @@ export class SpatialGridManager {
// Check if item is entirely within a hole (if so, ignore this slab) // Check if item is entirely within a hole (if so, ignore this slab)
// We consider it entirely in a hole if the item center is in the hole // We consider it entirely in a hole if the item center is in the hole
let inHole = false let inHole = false
if (slab.holes && slab.holes.length > 0) { const [cx, , cz] = position
const [cx, , cz] = position for (const hole of slab.holes) {
for (const hole of slab.holes) { if (hole.length >= 3 && pointInPolygon(cx, cz, hole)) {
if (hole.length >= 3 && pointInPolygon(cx, cz, hole)) { inHole = true
inHole = true break
break
}
} }
} }
@@ -548,14 +544,12 @@ export class SpatialGridManager {
if (wallOverlapsPolygon(start, end, slab.polygon)) { if (wallOverlapsPolygon(start, end, slab.polygon)) {
// Check if wall midpoint is in a hole (if so, ignore this slab) // Check if wall midpoint is in a hole (if so, ignore this slab)
let inHole = false let inHole = false
if (slab.holes && slab.holes.length > 0) { const midX = (start[0] + end[0]) / 2
const midX = (start[0] + end[0]) / 2 const midZ = (start[1] + end[1]) / 2
const midZ = (start[1] + end[1]) / 2 for (const hole of slab.holes) {
for (const hole of slab.holes) { if (hole.length >= 3 && pointInPolygon(midX, midZ, hole)) {
if (hole.length >= 3 && pointInPolygon(midX, midZ, hole)) { inHole = true
inHole = true break
break
}
} }
} }
+11 -13
View File
@@ -124,22 +124,20 @@ export function generateSlabGeometry(slabNode: SlabNode): THREE.BufferGeometry {
shape.closePath() shape.closePath()
// Add holes to the shape // Add holes to the shape
if (slabNode.holes && slabNode.holes.length > 0) { for (const holePolygon of slabNode.holes) {
for (const holePolygon of slabNode.holes) { if (holePolygon.length < 3) continue
if (holePolygon.length < 3) continue
const holePath = new THREE.Path() const holePath = new THREE.Path()
const holeFirstPt = holePolygon[0]! const holeFirstPt = holePolygon[0]!
holePath.moveTo(holeFirstPt[0], -holeFirstPt[1]) holePath.moveTo(holeFirstPt[0], -holeFirstPt[1])
for (let i = 1; i < holePolygon.length; i++) { for (let i = 1; i < holePolygon.length; i++) {
const pt = holePolygon[i]! const pt = holePolygon[i]!
holePath.lineTo(pt[0], -pt[1]) holePath.lineTo(pt[0], -pt[1])
}
holePath.closePath()
shape.holes.push(holePath)
} }
holePath.closePath()
shape.holes.push(holePath)
} }
// Extrude the shape by elevation // Extrude the shape by elevation