fix extra rebuild

This commit is contained in:
wass08
2026-02-10 14:07:56 +09:00
parent 80cb039f86
commit b4375792ab
7 changed files with 28 additions and 8 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ export default function Editor() {
<ActionMenu />
<PanelManager />
<SidebarProvider className="fixed z-100">
<SidebarProvider className="fixed z-20">
<AppSidebar />
</SidebarProvider>
<Viewer selectionManager="custom">
@@ -29,7 +29,9 @@ export function ItemPanel() {
// Mark parent wall as dirty if item is attached to wall
if (node.asset.attachTo === 'wall' && node.parentId) {
useScene.getState().dirtyNodes.add(node.parentId as AnyNode['id'])
requestAnimationFrame(() => {
useScene.getState().dirtyNodes.add(node.parentId as AnyNode['id'])
})
}
},
[selectedId, node, updateNode],
@@ -64,8 +64,13 @@ export function NumberInput({
const deltaValue = deltaX * step
const newValue = clamp(startValueRef.current + deltaValue)
finalValue = Number.parseFloat(newValue.toFixed(precision))
onChange(finalValue)
const newFinalValue = Number.parseFloat(newValue.toFixed(precision))
// Only call onChange if value actually changed (avoid extra processing on tiny moves)
if (newFinalValue !== finalValue) {
finalValue = newFinalValue
onChange(finalValue)
}
}
const handleMouseUp = () => {
@@ -345,6 +345,7 @@ function LevelsSection() {
const nodes = useScene((state) => state.nodes);
const createNode = useScene((state) => state.createNode);
const updateNode = useScene((state) => state.updateNode);
const deleteNode = useScene((state) => state.deleteNode);
const selectedBuildingId = useViewer((state) => state.selection.buildingId);
const selectedLevelId = useViewer((state) => state.selection.levelId);
const setSelection = useViewer((state) => state.setSelection);
@@ -493,6 +494,15 @@ function LevelsSection() {
>
References
</button>
{level.level !== 0 && (
<button
className="flex items-center gap-2 w-full px-3 py-1.5 rounded text-sm hover:bg-accent hover:text-red-600 cursor-pointer"
onClick={() => deleteNode(level.id)}
>
<Trash2 className="w-3.5 h-3.5" />
Delete
</button>
)}
</PopoverContent>
</Popover>
</div>