fix extra rebuild
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"lockfileVersion": 1,
|
||||
"configVersion": 0,
|
||||
"workspaces": {
|
||||
"": {
|
||||
"name": "editor",
|
||||
@@ -63,13 +62,14 @@
|
||||
},
|
||||
"packages/core": {
|
||||
"name": "@pascal-app/core",
|
||||
"version": "0.1.10",
|
||||
"version": "0.1.11",
|
||||
"dependencies": {
|
||||
"dedent": "^1.7.1",
|
||||
"idb-keyval": "^6.2.2",
|
||||
"mitt": "^3.0.1",
|
||||
"nanoid": "^5.1.6",
|
||||
"three-bvh-csg": "^0.0.17",
|
||||
"three-mesh-bvh": "^0.9.8",
|
||||
"zod": "^4.3.5",
|
||||
"zundo": "^2.3.0",
|
||||
"zustand": "^5",
|
||||
@@ -127,7 +127,7 @@
|
||||
},
|
||||
"packages/viewer": {
|
||||
"name": "@pascal-app/viewer",
|
||||
"version": "0.1.10",
|
||||
"version": "0.1.11",
|
||||
"dependencies": {
|
||||
"zustand": "^5",
|
||||
},
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
"mitt": "^3.0.1",
|
||||
"nanoid": "^5.1.6",
|
||||
"three-bvh-csg": "^0.0.17",
|
||||
"three-mesh-bvh": "^0.9.8",
|
||||
"zod": "^4.3.5",
|
||||
"zundo": "^2.3.0",
|
||||
"zustand": "^5"
|
||||
|
||||
@@ -21,6 +21,7 @@ const csgEvaluator = new Evaluator()
|
||||
// WALL SYSTEM
|
||||
// ============================================================================
|
||||
|
||||
let useFrameNb = 0;
|
||||
export const WallSystem = () => {
|
||||
const dirtyNodes = useScene((state) => state.dirtyNodes)
|
||||
const clearDirty = useScene((state) => state.clearDirty)
|
||||
@@ -33,7 +34,7 @@ export const WallSystem = () => {
|
||||
// Collect dirty walls and their levels
|
||||
const dirtyWallsByLevel = new Map<string, Set<string>>()
|
||||
|
||||
|
||||
useFrameNb += 1;
|
||||
dirtyNodes.forEach((id) => {
|
||||
const node = nodes[id]
|
||||
if (!node || node.type !== 'wall') return
|
||||
@@ -106,6 +107,7 @@ function updateWallGeometry(wallId: string, miterData: WallMiterData) {
|
||||
const node = nodes[wallId as WallNode['id']]
|
||||
if (!node || node.type !== 'wall') return
|
||||
|
||||
|
||||
const mesh = sceneRegistry.nodes.get(wallId) as THREE.Mesh
|
||||
if (!mesh) return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user