Refine roof edit selection behavior and panel actions
This commit is contained in:
@@ -6,7 +6,7 @@ import { useEffect, useRef } from 'react'
|
|||||||
* Imperatively toggles the Three.js visibility of roof objects based on the
|
* Imperatively toggles the Three.js visibility of roof objects based on the
|
||||||
* editor selection — without causing React re-renders in RoofRenderer.
|
* editor selection — without causing React re-renders in RoofRenderer.
|
||||||
*
|
*
|
||||||
* When a roof (or one of its segments) is selected:
|
* When a roof-segment is selected:
|
||||||
* - merged-roof mesh is hidden
|
* - merged-roof mesh is hidden
|
||||||
* - segments-wrapper group is shown (individual segments visible for editing)
|
* - segments-wrapper group is shown (individual segments visible for editing)
|
||||||
* - all children are marked dirty so RoofSystem rebuilds their geometry
|
* - all children are marked dirty so RoofSystem rebuilds their geometry
|
||||||
@@ -22,14 +22,14 @@ export const RoofEditSystem = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const nodes = useScene.getState().nodes
|
const nodes = useScene.getState().nodes
|
||||||
|
|
||||||
// Collect which roof nodes should be in "edit mode"
|
// Collect which roof nodes should be in "edit mode".
|
||||||
|
// Selecting the roof itself should keep the merged visual intact so
|
||||||
|
// material appearance does not jump between merged and per-segment meshes.
|
||||||
const activeRoofIds = new Set<string>()
|
const activeRoofIds = new Set<string>()
|
||||||
for (const id of selectedIds) {
|
for (const id of selectedIds) {
|
||||||
const node = nodes[id as AnyNodeId]
|
const node = nodes[id as AnyNodeId]
|
||||||
if (!node) continue
|
if (!node) continue
|
||||||
if (node.type === 'roof') {
|
if (node.type === 'roof-segment' && node.parentId) {
|
||||||
activeRoofIds.add(id)
|
|
||||||
} else if (node.type === 'roof-segment' && node.parentId) {
|
|
||||||
activeRoofIds.add(node.parentId)
|
activeRoofIds.add(node.parentId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,11 +208,13 @@ export function RoofPanel() {
|
|||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<ActionButton
|
<ActionGroup>
|
||||||
icon={<Plus className="h-3.5 w-3.5" />}
|
<ActionButton
|
||||||
label="Add Segment"
|
icon={<Plus className="h-3.5 w-3.5" />}
|
||||||
onClick={handleAddSegment}
|
label="Add Segment"
|
||||||
/>
|
onClick={handleAddSegment}
|
||||||
|
/>
|
||||||
|
</ActionGroup>
|
||||||
</PanelSection>
|
</PanelSection>
|
||||||
|
|
||||||
<PanelSection title="Position">
|
<PanelSection title="Position">
|
||||||
|
|||||||
Reference in New Issue
Block a user