@pascal-app/editor 0.8.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -9
- package/src/components/editor/alignment-3d-guide-layer.tsx +160 -0
- package/src/components/editor/custom-camera-controls.tsx +754 -25
- package/src/components/editor/editor-layout-mobile.tsx +3 -3
- package/src/components/editor/editor-layout-v2.tsx +58 -51
- package/src/components/editor/export-manager.tsx +32 -3
- package/src/components/editor/first-person/build-collider-world.test.ts +149 -0
- package/src/components/editor/first-person/build-collider-world.ts +201 -83
- package/src/components/editor/first-person/bvh-ecctrl.tsx +8 -8
- package/src/components/editor/first-person-controls.tsx +825 -20
- package/src/components/editor/floating-action-menu.tsx +287 -196
- package/src/components/editor/floating-building-action-menu.tsx +1 -1
- package/src/components/editor/floorplan-panel.tsx +5829 -12005
- package/src/components/editor/grid.tsx +51 -17
- package/src/components/editor/group-move-handle.tsx +316 -0
- package/src/components/editor/group-rotate-handle.tsx +382 -0
- package/src/components/editor/group-transform-shared.test.ts +205 -0
- package/src/components/editor/group-transform-shared.ts +256 -0
- package/src/components/editor/handles/handle-arrow.tsx +523 -0
- package/src/components/editor/handles/use-handle-drag.ts +213 -0
- package/src/components/editor/index.tsx +178 -149
- package/src/components/editor/measurement-pill.tsx +75 -0
- package/src/components/editor/node-arrow-handles.tsx +1453 -0
- package/src/components/editor/selection-manager.tsx +433 -156
- package/src/components/editor/site-edge-labels.tsx +44 -20
- package/src/components/editor/slab-hole-highlights.tsx +466 -0
- package/src/components/editor/snapshot-capture-overlay.tsx +136 -62
- package/src/components/editor/thumbnail-generator.tsx +9 -3
- package/src/components/editor/use-floorplan-background-placement.ts +119 -32
- package/src/components/editor/use-floorplan-hit-testing.ts +24 -0
- package/src/components/editor/use-floorplan-scene-data.ts +14 -2
- package/src/components/editor/wall-measurement-label.tsx +11 -6
- package/src/components/editor/wall-move-side-handles.tsx +855 -0
- package/src/components/editor/wall-opening-highlights.tsx +181 -0
- package/src/components/editor/wall-snap-beacon-layer.tsx +150 -0
- package/src/components/editor-2d/floorplan-action-menu-layer.tsx +6 -1
- package/src/components/editor-2d/floorplan-alignment-guide-layer.tsx +142 -0
- package/src/components/editor-2d/floorplan-cursor-indicator-overlay.tsx +5 -3
- package/src/components/editor-2d/floorplan-registry-action-menu.tsx +227 -0
- package/src/components/editor-2d/floorplan-registry-move-overlay.tsx +616 -0
- package/src/components/editor-2d/floorplan-render-context.tsx +62 -0
- package/src/components/editor-2d/floorplan-snap-beacon-layer.tsx +75 -0
- package/src/components/editor-2d/floorplan-wall-move-ghost-layer.tsx +47 -0
- package/src/components/editor-2d/renderers/floorplan-geometry-renderer.tsx +266 -0
- package/src/components/editor-2d/renderers/floorplan-measurements-layer.tsx +108 -66
- package/src/components/editor-2d/renderers/floorplan-placement-preview-layer.tsx +59 -0
- package/src/components/editor-2d/renderers/floorplan-registry-layer.tsx +1963 -0
- package/src/components/editor-2d/renderers/floorplan-stair-layer.tsx +24 -9
- package/src/components/editor-2d/svg-paths.ts +10 -2
- package/src/components/systems/ceiling/ceiling-selection-affordance-system.tsx +26 -3
- package/src/components/systems/ceiling/ceiling-system.tsx +12 -8
- package/src/components/systems/roof/roof-edit-system.tsx +86 -12
- package/src/components/systems/stair/stair-edit-system.tsx +1 -1
- package/src/components/tools/elevator/elevator-defaults.ts +8 -0
- package/src/components/tools/elevator/elevator-tool.tsx +349 -0
- package/src/components/tools/elevator/move-elevator-tool.tsx +252 -0
- package/src/components/tools/fence/fence-drafting.ts +64 -22
- package/src/components/tools/item/move-tool.tsx +41 -105
- package/src/components/tools/item/placement-math.test.ts +10 -0
- package/src/components/tools/item/placement-math.ts +31 -5
- package/src/components/tools/item/placement-strategies.ts +190 -15
- package/src/components/tools/item/placement-types.ts +10 -1
- package/src/components/tools/item/use-draft-node.ts +20 -1
- package/src/components/tools/item/use-placement-coordinator.tsx +694 -191
- package/src/components/tools/registry/move-registry-node-tool.tsx +602 -0
- package/src/components/tools/roof/roof-tool.tsx +108 -12
- package/src/components/tools/select/box-select-state.ts +77 -0
- package/src/components/tools/select/box-select-tool.tsx +324 -538
- package/src/components/tools/select/plane-box-select-tool.tsx +577 -0
- package/src/components/tools/select/screen-rectangle-selection.ts +84 -0
- package/src/components/tools/select/select-candidates.test.ts +109 -0
- package/src/components/tools/select/select-candidates.ts +85 -0
- package/src/components/tools/shared/affordance-dispatch.ts +30 -0
- package/src/components/tools/shared/drag-bounding-box.tsx +171 -0
- package/src/components/tools/shared/floor-stack-preview.ts +25 -0
- package/src/components/tools/shared/fresh-placement-visibility.ts +61 -0
- package/src/components/tools/shared/placement-box-geometry.ts +123 -0
- package/src/components/tools/shared/placement-box.tsx +123 -0
- package/src/components/tools/shared/polygon-editor.tsx +617 -167
- package/src/components/tools/shared/segment-angle.ts +56 -0
- package/src/components/tools/site/site-boundary-editor.tsx +464 -12
- package/src/components/tools/site/site-flag-model.ts +18 -0
- package/src/components/tools/stair/stair-defaults.ts +1 -1
- package/src/components/tools/stair/stair-tool.tsx +269 -35
- package/src/components/tools/tool-manager.tsx +172 -56
- package/src/components/tools/wall/wall-drafting.ts +98 -98
- package/src/components/tools/wall/wall-snap-geometry.test.ts +79 -0
- package/src/components/tools/wall/wall-snap-geometry.ts +270 -0
- package/src/components/tools/zone/zone-tool.tsx +16 -6
- package/src/components/ui/action-menu/action-button.tsx +21 -1
- package/src/components/ui/action-menu/control-modes.tsx +5 -82
- package/src/components/ui/action-menu/index.tsx +1 -113
- package/src/components/ui/action-menu/structure-tools.tsx +13 -88
- package/src/components/ui/action-menu/view-toggles.tsx +243 -6
- package/src/components/ui/command-palette/editor-commands.tsx +18 -13
- package/src/components/ui/command-palette/index.tsx +2 -1
- package/src/components/ui/controls/material-paint-panel.tsx +83 -0
- package/src/components/ui/controls/material-picker.tsx +11 -32
- package/src/components/ui/controls/metric-control.tsx +33 -11
- package/src/components/ui/floating-level-selector.tsx +47 -10
- package/src/components/ui/helpers/helper-manager.tsx +16 -17
- package/src/components/ui/helpers/registered-tool-helper.tsx +25 -0
- package/src/components/ui/item-catalog/catalog-items.tsx +1 -0
- package/src/components/ui/item-catalog/item-catalog.tsx +3 -0
- package/src/components/ui/level-duplicate-dialog.tsx +2 -1
- package/src/components/ui/panels/node-display.ts +1 -0
- package/src/components/ui/panels/panel-manager.tsx +35 -47
- package/src/components/ui/panels/panel-wrapper.tsx +217 -12
- package/src/components/ui/panels/parametric-inspector.tsx +469 -0
- package/src/components/ui/primitives/dropdown-menu.tsx +12 -8
- package/src/components/ui/scene-loader.tsx +1 -3
- package/src/components/ui/sidebar/panels/items-panel/function-tree-panel.tsx +263 -0
- package/src/components/ui/sidebar/panels/items-panel/index.tsx +82 -8
- package/src/components/ui/sidebar/panels/settings-panel/index.tsx +59 -9
- package/src/components/ui/sidebar/panels/settings-panel/keyboard-shortcuts-dialog.tsx +6 -1
- package/src/components/ui/sidebar/panels/settings-panel/load-build-dialog.tsx +259 -0
- package/src/components/ui/sidebar/panels/site-panel/building-tree-node.tsx +3 -1
- package/src/components/ui/sidebar/panels/site-panel/ceiling-tree-node.tsx +5 -2
- package/src/components/ui/sidebar/panels/site-panel/chimney-tree-node.tsx +83 -0
- package/src/components/ui/sidebar/panels/site-panel/dormer-tree-node.tsx +89 -0
- package/src/components/ui/sidebar/panels/site-panel/elevator-tree-node.tsx +75 -0
- package/src/components/ui/sidebar/panels/site-panel/fence-tree-node.tsx +2 -2
- package/src/components/ui/sidebar/panels/site-panel/gutter-tree-node.tsx +83 -0
- package/src/components/ui/sidebar/panels/site-panel/index.tsx +4 -6
- package/src/components/ui/sidebar/panels/site-panel/level-tree-node.tsx +2 -1
- package/src/components/ui/sidebar/panels/site-panel/registry-tree-node.tsx +93 -0
- package/src/components/ui/sidebar/panels/site-panel/roof-tree-node.tsx +41 -5
- package/src/components/ui/sidebar/panels/site-panel/shelf-tree-node.tsx +128 -0
- package/src/components/ui/sidebar/panels/site-panel/slab-tree-node.tsx +5 -2
- package/src/components/ui/sidebar/panels/site-panel/solar-panel-tree-node.tsx +83 -0
- package/src/components/ui/sidebar/panels/site-panel/spawn-tree-node.tsx +7 -1
- package/src/components/ui/sidebar/panels/site-panel/tree-node.tsx +68 -36
- package/src/components/ui/sidebar/panels/zone-panel/index.tsx +51 -2
- package/src/components/ui/sidebar/tab-bar.tsx +61 -1
- package/src/components/viewer-overlay.tsx +169 -52
- package/src/components/viewer-zone-system.tsx +1 -1
- package/src/hooks/use-auto-save.ts +10 -3
- package/src/hooks/use-ceiling-events.ts +175 -0
- package/src/hooks/use-drag-action.ts +124 -0
- package/src/hooks/use-keyboard.ts +115 -62
- package/src/hooks/use-selection.ts +64 -0
- package/src/index.tsx +237 -5
- package/src/lib/constants.ts +6 -2
- package/src/lib/editor-api.ts +62 -0
- package/src/lib/elevator-support.ts +96 -0
- package/src/lib/floorplan/apply-alignment.ts +111 -0
- package/src/lib/floorplan/index.ts +7 -0
- package/src/lib/floorplan/selection-tool.ts +40 -0
- package/src/lib/floorplan/stairs.ts +12 -1
- package/src/lib/fresh-planar-placement.test.ts +102 -0
- package/src/lib/fresh-planar-placement.ts +63 -0
- package/src/lib/history.ts +2 -1
- package/src/lib/level-duplication.ts +54 -42
- package/src/lib/level-name.ts +11 -0
- package/src/lib/material-paint.ts +211 -19
- package/src/lib/placement-metadata.ts +29 -0
- package/src/lib/planar-cursor-placement.test.ts +43 -0
- package/src/lib/planar-cursor-placement.ts +42 -0
- package/src/lib/roof-duplication.ts +1 -1
- package/src/lib/scene-clipboard.ts +267 -0
- package/src/lib/scene.ts +13 -4
- package/src/lib/sfx-bus.ts +23 -1
- package/src/lib/sfx-player.ts +70 -22
- package/src/lib/site-boundary.ts +1 -0
- package/src/lib/stair-levels.test.ts +146 -0
- package/src/lib/stair-levels.ts +177 -0
- package/src/lib/world-grid-snap.ts +199 -0
- package/src/lib/zone-content.ts +130 -0
- package/src/store/use-alignment-guides.ts +21 -0
- package/src/store/use-editor.tsx +320 -37
- package/src/store/use-placement-preview.ts +31 -0
- package/src/store/use-wall-move-ghosts.ts +36 -0
- package/src/store/use-wall-snap-indicator.ts +32 -0
- package/src/components/editor/preset-thumbnail-generator.tsx +0 -125
- package/src/components/editor-2d/renderers/floorplan-roof-layer.tsx +0 -113
- package/src/components/tools/building/move-building-tool.tsx +0 -157
- package/src/components/tools/ceiling/ceiling-boundary-editor.tsx +0 -43
- package/src/components/tools/ceiling/ceiling-hole-editor.tsx +0 -49
- package/src/components/tools/ceiling/ceiling-tool.tsx +0 -465
- package/src/components/tools/ceiling/move-ceiling-tool.tsx +0 -264
- package/src/components/tools/column/column-tool.tsx +0 -97
- package/src/components/tools/column/move-column-tool.tsx +0 -105
- package/src/components/tools/door/door-math.ts +0 -110
- package/src/components/tools/door/door-tool.tsx +0 -324
- package/src/components/tools/door/move-door-tool.tsx +0 -412
- package/src/components/tools/fence/curve-fence-tool.tsx +0 -178
- package/src/components/tools/fence/fence-tool.tsx +0 -346
- package/src/components/tools/fence/move-fence-endpoint-tool.tsx +0 -441
- package/src/components/tools/fence/move-fence-tool.tsx +0 -302
- package/src/components/tools/item/item-tool.tsx +0 -26
- package/src/components/tools/roof/move-roof-tool.tsx +0 -364
- package/src/components/tools/slab/move-slab-tool.tsx +0 -182
- package/src/components/tools/slab/slab-boundary-editor.tsx +0 -43
- package/src/components/tools/slab/slab-hole-editor.tsx +0 -49
- package/src/components/tools/slab/slab-tool.tsx +0 -322
- package/src/components/tools/spawn/move-spawn-tool.tsx +0 -101
- package/src/components/tools/spawn/spawn-tool.tsx +0 -130
- package/src/components/tools/wall/curve-wall-tool.tsx +0 -178
- package/src/components/tools/wall/move-wall-endpoint-tool.tsx +0 -426
- package/src/components/tools/wall/move-wall-tool.tsx +0 -358
- package/src/components/tools/wall/wall-tool.tsx +0 -332
- package/src/components/tools/window/move-window-tool.tsx +0 -447
- package/src/components/tools/window/window-math.ts +0 -117
- package/src/components/tools/window/window-tool.tsx +0 -332
- package/src/components/ui/helpers/ceiling-helper.tsx +0 -20
- package/src/components/ui/helpers/slab-helper.tsx +0 -20
- package/src/components/ui/helpers/wall-helper.tsx +0 -20
- package/src/components/ui/panels/ceiling-panel.tsx +0 -249
- package/src/components/ui/panels/column-panel.tsx +0 -759
- package/src/components/ui/panels/door-panel.tsx +0 -1299
- package/src/components/ui/panels/fence-panel.tsx +0 -222
- package/src/components/ui/panels/item-panel.tsx +0 -306
- package/src/components/ui/panels/presets/presets-popover.tsx +0 -511
- package/src/components/ui/panels/roof-panel.tsx +0 -280
- package/src/components/ui/panels/roof-segment-panel.tsx +0 -311
- package/src/components/ui/panels/slab-panel.tsx +0 -250
- package/src/components/ui/panels/spawn-panel.tsx +0 -161
- package/src/components/ui/panels/stair-panel.tsx +0 -577
- package/src/components/ui/panels/stair-segment-panel.tsx +0 -325
- package/src/components/ui/panels/wall-panel.tsx +0 -273
- package/src/components/ui/panels/window-panel.tsx +0 -968
- package/src/contexts/presets-context.tsx +0 -121
- package/src/hooks/use-contextual-tools.ts +0 -61
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
import type {
|
|
4
4
|
AnyNode,
|
|
5
5
|
CeilingNode,
|
|
6
|
+
ColumnNode,
|
|
6
7
|
DoorNode,
|
|
8
|
+
ElevatorNode,
|
|
7
9
|
ItemNode,
|
|
8
10
|
Point2D,
|
|
9
11
|
RoofNode,
|
|
@@ -46,6 +48,16 @@ type CeilingPolygonEntry = {
|
|
|
46
48
|
holes: Point2D[][]
|
|
47
49
|
}
|
|
48
50
|
|
|
51
|
+
type ColumnPolygonEntry = {
|
|
52
|
+
column: ColumnNode
|
|
53
|
+
polygon: Point2D[]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
type ElevatorPolygonEntry = {
|
|
57
|
+
elevator: ElevatorNode
|
|
58
|
+
polygon: Point2D[]
|
|
59
|
+
}
|
|
60
|
+
|
|
49
61
|
type FloorplanRoofEntry = {
|
|
50
62
|
roof: RoofNode
|
|
51
63
|
segments: Array<{
|
|
@@ -72,8 +84,10 @@ type FloorplanStairEntry = {
|
|
|
72
84
|
|
|
73
85
|
type UseFloorplanHitTestingArgs = {
|
|
74
86
|
ceilingPolygons: CeilingPolygonEntry[]
|
|
87
|
+
columnPolygons: ColumnPolygonEntry[]
|
|
75
88
|
displaySlabPolygons: SlabPolygonEntry[]
|
|
76
89
|
displayWallPolygons: WallPolygonEntry[]
|
|
90
|
+
floorplanElevatorEntries: ElevatorPolygonEntry[]
|
|
77
91
|
floorplanItemEntries: FloorplanItemEntry[]
|
|
78
92
|
floorplanOpeningHitTolerance: number
|
|
79
93
|
floorplanRoofEntries: FloorplanRoofEntry[]
|
|
@@ -88,8 +102,10 @@ type UseFloorplanHitTestingArgs = {
|
|
|
88
102
|
|
|
89
103
|
export function useFloorplanHitTesting({
|
|
90
104
|
ceilingPolygons,
|
|
105
|
+
columnPolygons,
|
|
91
106
|
displaySlabPolygons,
|
|
92
107
|
displayWallPolygons,
|
|
108
|
+
floorplanElevatorEntries,
|
|
93
109
|
floorplanItemEntries,
|
|
94
110
|
floorplanOpeningHitTolerance,
|
|
95
111
|
floorplanRoofEntries,
|
|
@@ -113,18 +129,22 @@ export function useFloorplanHitTesting({
|
|
|
113
129
|
openings: openingsPolygons,
|
|
114
130
|
roofs: floorplanRoofEntries,
|
|
115
131
|
stairs: floorplanStairEntries,
|
|
132
|
+
elevators: floorplanElevatorEntries,
|
|
116
133
|
walls: displayWallPolygons,
|
|
117
134
|
slabs: displaySlabPolygons,
|
|
118
135
|
openingHitTolerance: floorplanOpeningHitTolerance,
|
|
119
136
|
wallHitTolerance: floorplanWallHitTolerance,
|
|
137
|
+
columns: columnPolygons,
|
|
120
138
|
getOpeningCenterLine,
|
|
121
139
|
})
|
|
122
140
|
},
|
|
123
141
|
[
|
|
124
142
|
ceilingPolygons,
|
|
143
|
+
columnPolygons,
|
|
125
144
|
displaySlabPolygons,
|
|
126
145
|
displayWallPolygons,
|
|
127
146
|
floorplanItemEntries,
|
|
147
|
+
floorplanElevatorEntries,
|
|
128
148
|
floorplanOpeningHitTolerance,
|
|
129
149
|
floorplanRoofEntries,
|
|
130
150
|
floorplanStairEntries,
|
|
@@ -149,13 +169,17 @@ export function useFloorplanHitTesting({
|
|
|
149
169
|
openings: openingsPolygons,
|
|
150
170
|
roofs: floorplanRoofEntries,
|
|
151
171
|
slabs: displaySlabPolygons,
|
|
172
|
+
columns: columnPolygons,
|
|
173
|
+
elevators: floorplanElevatorEntries,
|
|
152
174
|
stairs: floorplanStairEntries,
|
|
153
175
|
}),
|
|
154
176
|
[
|
|
155
177
|
ceilingPolygons,
|
|
178
|
+
columnPolygons,
|
|
156
179
|
displaySlabPolygons,
|
|
157
180
|
displayWallPolygons,
|
|
158
181
|
floorplanItemEntries,
|
|
182
|
+
floorplanElevatorEntries,
|
|
159
183
|
floorplanRoofEntries,
|
|
160
184
|
floorplanStairEntries,
|
|
161
185
|
isFloorplanItemContextActive,
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
type SiteNode,
|
|
13
13
|
type SlabNode,
|
|
14
14
|
type SpawnNode,
|
|
15
|
+
useLiveTransforms,
|
|
15
16
|
useScene,
|
|
16
17
|
type WallNode,
|
|
17
18
|
type WindowNode,
|
|
@@ -59,13 +60,22 @@ export function useFloorplanSceneData({
|
|
|
59
60
|
? (levelNode.parentId as BuildingNode['id'])
|
|
60
61
|
: buildingId
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
// Live transform override — when the building is mid-drag (the move
|
|
64
|
+
// tool publishes per-frame pose to useLiveTransforms), the floor-plan
|
|
65
|
+
// follows that pose so the dimmed reference floor tracks the cursor
|
|
66
|
+
// instead of snapping only on commit.
|
|
67
|
+
const buildingLiveTransform = useLiveTransforms((state) =>
|
|
68
|
+
currentBuildingId ? state.transforms.get(currentBuildingId) : undefined,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
const committedBuildingRotationY = useScene((state) => {
|
|
63
72
|
if (!currentBuildingId) return 0
|
|
64
73
|
const node = state.nodes[currentBuildingId]
|
|
65
74
|
return node?.type === 'building' ? (node.rotation[1] ?? 0) : 0
|
|
66
75
|
})
|
|
76
|
+
const buildingRotationY = buildingLiveTransform?.rotation ?? committedBuildingRotationY
|
|
67
77
|
|
|
68
|
-
const
|
|
78
|
+
const committedBuildingPosition = useScene((state) => {
|
|
69
79
|
if (!currentBuildingId) {
|
|
70
80
|
return DEFAULT_BUILDING_POSITION
|
|
71
81
|
}
|
|
@@ -75,6 +85,7 @@ export function useFloorplanSceneData({
|
|
|
75
85
|
? (node.position as [number, number, number])
|
|
76
86
|
: DEFAULT_BUILDING_POSITION
|
|
77
87
|
})
|
|
88
|
+
const buildingPosition = buildingLiveTransform?.position ?? committedBuildingPosition
|
|
78
89
|
|
|
79
90
|
const site = useScene((state) => {
|
|
80
91
|
for (const rootNodeId of state.rootNodeIds) {
|
|
@@ -170,6 +181,7 @@ export function useFloorplanSceneData({
|
|
|
170
181
|
|
|
171
182
|
return {
|
|
172
183
|
buildingPosition,
|
|
184
|
+
committedBuildingPosition,
|
|
173
185
|
buildingRotationY,
|
|
174
186
|
currentBuildingId,
|
|
175
187
|
ceilings,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
type WallMiterData,
|
|
19
19
|
type WallNode,
|
|
20
20
|
} from '@pascal-app/core'
|
|
21
|
-
import { useViewer } from '@pascal-app/viewer'
|
|
21
|
+
import { getSceneTheme, useViewer } from '@pascal-app/viewer'
|
|
22
22
|
import { Html } from '@react-three/drei'
|
|
23
23
|
import { createPortal, useFrame } from '@react-three/fiber'
|
|
24
24
|
import { useMemo, useState } from 'react'
|
|
@@ -32,6 +32,12 @@ const HEIGHT_TICK_HALF_LENGTH = 0.14
|
|
|
32
32
|
const HEIGHT_GUIDE_OUTSIDE_OFFSET = 0.16
|
|
33
33
|
|
|
34
34
|
const BAR_AXIS = new THREE.Vector3(0, 1, 0)
|
|
35
|
+
// Shared unit cube — each MeasurementBar scales it to BAR_THICKNESS × length
|
|
36
|
+
// × BAR_THICKNESS instead of constructing a fresh BoxGeometry every frame.
|
|
37
|
+
// Per-frame `<boxGeometry args={[..., length, ...]}/>` triggers R3F to
|
|
38
|
+
// rebuild the geometry whenever the wall moves, and the WebGPU backend
|
|
39
|
+
// flags the in-flight buffer churn as "Vertex buffer slot N ... was not set".
|
|
40
|
+
const SHARED_BAR_GEOMETRY = new THREE.BoxGeometry(1, 1, 1)
|
|
35
41
|
|
|
36
42
|
type Vec3 = [number, number, number]
|
|
37
43
|
|
|
@@ -73,8 +79,7 @@ export function WallMeasurementLabel() {
|
|
|
73
79
|
|
|
74
80
|
const selectedId = selectedIds.length === 1 ? selectedIds[0] : null
|
|
75
81
|
const selectedNode = selectedId ? nodes[selectedId as AnyNodeId] : null
|
|
76
|
-
const measurableNode =
|
|
77
|
-
selectedNode?.type === 'wall' || selectedNode?.type === 'item' ? selectedNode : null
|
|
82
|
+
const measurableNode = selectedNode?.type === 'item' ? selectedNode : null
|
|
78
83
|
|
|
79
84
|
const [objectState, setObjectState] = useState<{
|
|
80
85
|
id: AnyNodeId
|
|
@@ -447,11 +452,12 @@ function MeasurementBar({ start, end, color }: { start: Vec3; end: Vec3; color:
|
|
|
447
452
|
|
|
448
453
|
return (
|
|
449
454
|
<mesh
|
|
455
|
+
geometry={SHARED_BAR_GEOMETRY}
|
|
450
456
|
position={[segment.position.x, segment.position.y, segment.position.z]}
|
|
451
457
|
quaternion={segment.quaternion}
|
|
452
458
|
renderOrder={1000}
|
|
459
|
+
scale={[BAR_THICKNESS, segment.length, BAR_THICKNESS]}
|
|
453
460
|
>
|
|
454
|
-
<boxGeometry args={[BAR_THICKNESS, segment.length, BAR_THICKNESS]} />
|
|
455
461
|
<meshBasicMaterial
|
|
456
462
|
color={color}
|
|
457
463
|
depthTest={false}
|
|
@@ -515,9 +521,8 @@ function SelectedMeasurementAnnotation({ node }: { node: WallNode | ItemNode })
|
|
|
515
521
|
|
|
516
522
|
function WallMeasurementAnnotation({ wall }: { wall: WallNode }) {
|
|
517
523
|
const nodes = useScene((state) => state.nodes)
|
|
518
|
-
const theme = useViewer((state) => state.theme)
|
|
519
524
|
const unit = useViewer((state) => state.unit)
|
|
520
|
-
const isNight =
|
|
525
|
+
const isNight = useViewer((state) => getSceneTheme(state.sceneTheme).appearance === 'dark')
|
|
521
526
|
const color = isNight ? '#ffffff' : '#111111'
|
|
522
527
|
const shadowColor = isNight ? '#111111' : '#ffffff'
|
|
523
528
|
|