diff --git a/apps/editor/components/ui/panels/slab-panel.tsx b/apps/editor/components/ui/panels/slab-panel.tsx index d2ec2cd0..e5490d8e 100644 --- a/apps/editor/components/ui/panels/slab-panel.tsx +++ b/apps/editor/components/ui/panels/slab-panel.tsx @@ -93,7 +93,7 @@ export function SlabPanel() { setEditingHoleIndex(null) } }, - [node?.holes, handleUpdate, editingHoleIndex], + [node?.holes, handleUpdate, editingHoleIndex, setEditingHoleIndex], ) // Only show if exactly one slab is selected diff --git a/apps/editor/components/ui/sidebar/panels/settings-panel/audio-settings-dialog.tsx b/apps/editor/components/ui/sidebar/panels/settings-panel/audio-settings-dialog.tsx index 62bd94d6..3808727f 100644 --- a/apps/editor/components/ui/sidebar/panels/settings-panel/audio-settings-dialog.tsx +++ b/apps/editor/components/ui/sidebar/panels/settings-panel/audio-settings-dialog.tsx @@ -34,7 +34,7 @@ export function AudioSettingsDialog() { setMasterVolume(value[0])} + onValueChange={(value) => value[0] !== undefined && setMasterVolume(value[0])} max={100} step={1} disabled={muted} @@ -49,7 +49,7 @@ export function AudioSettingsDialog() { setRadioVolume(value[0])} + onValueChange={(value) => value[0] !== undefined && setRadioVolume(value[0])} max={100} step={1} disabled={muted} @@ -64,7 +64,7 @@ export function AudioSettingsDialog() { setSfxVolume(value[0])} + onValueChange={(value) => value[0] !== undefined && setSfxVolume(value[0])} max={100} step={1} disabled={muted} diff --git a/packages/core/src/hooks/spatial-grid/spatial-grid-manager.ts b/packages/core/src/hooks/spatial-grid/spatial-grid-manager.ts index 721f2625..695b46e2 100644 --- a/packages/core/src/hooks/spatial-grid/spatial-grid-manager.ts +++ b/packages/core/src/hooks/spatial-grid/spatial-grid-manager.ts @@ -468,12 +468,10 @@ export class SpatialGridManager { if (slab.polygon.length >= 3 && pointInPolygon(x, z, slab.polygon)) { // Check if point is in any hole let inHole = false - if (slab.holes && slab.holes.length > 0) { - for (const hole of slab.holes) { - if (hole.length >= 3 && pointInPolygon(x, z, hole)) { - inHole = true - break - } + for (const hole of slab.holes) { + if (hole.length >= 3 && pointInPolygon(x, z, hole)) { + inHole = true + break } } @@ -508,13 +506,11 @@ export class SpatialGridManager { // 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 let inHole = false - if (slab.holes && slab.holes.length > 0) { - const [cx, , cz] = position - for (const hole of slab.holes) { - if (hole.length >= 3 && pointInPolygon(cx, cz, hole)) { - inHole = true - break - } + const [cx, , cz] = position + for (const hole of slab.holes) { + if (hole.length >= 3 && pointInPolygon(cx, cz, hole)) { + inHole = true + break } } @@ -548,14 +544,12 @@ export class SpatialGridManager { if (wallOverlapsPolygon(start, end, slab.polygon)) { // Check if wall midpoint is in a hole (if so, ignore this slab) let inHole = false - if (slab.holes && slab.holes.length > 0) { - const midX = (start[0] + end[0]) / 2 - const midZ = (start[1] + end[1]) / 2 - for (const hole of slab.holes) { - if (hole.length >= 3 && pointInPolygon(midX, midZ, hole)) { - inHole = true - break - } + const midX = (start[0] + end[0]) / 2 + const midZ = (start[1] + end[1]) / 2 + for (const hole of slab.holes) { + if (hole.length >= 3 && pointInPolygon(midX, midZ, hole)) { + inHole = true + break } } diff --git a/packages/core/src/systems/slab/slab-system.tsx b/packages/core/src/systems/slab/slab-system.tsx index a9cc1e6d..945e80c3 100644 --- a/packages/core/src/systems/slab/slab-system.tsx +++ b/packages/core/src/systems/slab/slab-system.tsx @@ -124,22 +124,20 @@ export function generateSlabGeometry(slabNode: SlabNode): THREE.BufferGeometry { shape.closePath() // Add holes to the shape - if (slabNode.holes && slabNode.holes.length > 0) { - for (const holePolygon of slabNode.holes) { - if (holePolygon.length < 3) continue + for (const holePolygon of slabNode.holes) { + if (holePolygon.length < 3) continue - const holePath = new THREE.Path() - const holeFirstPt = holePolygon[0]! - holePath.moveTo(holeFirstPt[0], -holeFirstPt[1]) + const holePath = new THREE.Path() + const holeFirstPt = holePolygon[0]! + holePath.moveTo(holeFirstPt[0], -holeFirstPt[1]) - for (let i = 1; i < holePolygon.length; i++) { - const pt = holePolygon[i]! - holePath.lineTo(pt[0], -pt[1]) - } - holePath.closePath() - - shape.holes.push(holePath) + for (let i = 1; i < holePolygon.length; i++) { + const pt = holePolygon[i]! + holePath.lineTo(pt[0], -pt[1]) } + holePath.closePath() + + shape.holes.push(holePath) } // Extrude the shape by elevation