Refine wall chaining and door arch clipping

This commit is contained in:
sudhir
2026-05-20 00:51:01 +00:00
committed by open-pascal
parent 023cd511e9
commit 5d53be26e5
2 changed files with 25 additions and 12 deletions
+24 -5
View File
@@ -396,6 +396,12 @@ export const WallTool: React.FC = () => {
let gridPosition: WallPlanPoint = [0, 0]
let previousWallEnd: [number, number] | null = null
const stopDrafting = () => {
buildingState.current = 0
wallPreviewRef.current.visible = false
setDraftMeasurement(null)
}
const onGridMove = (event: GridEvent) => {
if (!(cursorRef.current && wallPreviewRef.current)) return
@@ -439,6 +445,11 @@ export const WallTool: React.FC = () => {
}
const onGridClick = (event: GridEvent) => {
if (buildingState.current === 1 && event.nativeEvent.detail >= 2) {
stopDrafting()
return
}
const walls = getCurrentLevelWalls()
const localClick: WallPlanPoint = [event.localPosition[0], event.localPosition[2]]
@@ -460,9 +471,19 @@ export const WallTool: React.FC = () => {
const dx = snappedEnd[0] - startingPoint.current.x
const dz = snappedEnd[1] - startingPoint.current.z
if (dx * dx + dz * dz < 0.01 * 0.01) return
createWallOnCurrentLevel([startingPoint.current.x, startingPoint.current.z], snappedEnd)
// Both start and end are building-local ✓
const createdWall = createWallOnCurrentLevel(
[startingPoint.current.x, startingPoint.current.z],
snappedEnd,
)
if (!createdWall) return
const nextStart = createdWall.end
startingPoint.current.set(nextStart[0], event.localPosition[1], nextStart[1])
endingPoint.current.copy(startingPoint.current)
cursorRef.current.position.copy(startingPoint.current)
wallPreviewRef.current.visible = false
buildingState.current = 0
buildingState.current = 1
setDraftMeasurement(null)
}
}
@@ -478,9 +499,7 @@ export const WallTool: React.FC = () => {
const onCancel = () => {
if (buildingState.current === 1) {
markToolCancelConsumed()
buildingState.current = 0
wallPreviewRef.current.visible = false
setDraftMeasurement(null)
stopDrafting()
}
}
@@ -438,8 +438,6 @@ function createRoundedClippedLeafFrameShape(
getRoundedBoundaryYAtX(x, fullLeft, fullRight, top, {
topLeft: outerRadii.topLeft,
topRight: outerRadii.topRight,
bottomLeft: 0,
bottomRight: 0,
}),
)
@@ -466,8 +464,6 @@ function createRoundedClippedLeafFrameShape(
getRoundedBoundaryYAtX(x, innerFullLeft, innerFullRight, innerTop, {
topLeft: innerRadii.topLeft,
topRight: innerRadii.topRight,
bottomLeft: 0,
bottomRight: 0,
}),
)
@@ -730,8 +726,6 @@ function addLeafSegmentContent({
return getRoundedBoundaryYAtX(x, leafLeft, leafRight, leafTop, {
topLeft: openingTopRadii.topLeft,
topRight: openingTopRadii.topRight,
bottomLeft: 0,
bottomRight: 0,
})
}
@@ -742,7 +736,7 @@ function addLeafSegmentContent({
leafLeft,
leafRight,
leafTop,
archHeight,
clampedLeafArchHeight,
archOuterSide,
)
}