editor: improve floorplan modes and annotations (#549)
* Add roof surface placement support for items Items (e.g. solar panels) can now be placed on sloped roof surfaces. The placement system computes euler rotation from the roof surface normal so items sit flush on the slope instead of going inside. - Add roofStrategy to placement-strategies with enter/move/click/leave - Wire roof:enter/move/click/leave events in the placement coordinator - Add calculateRoofRotation in placement-math using surface normals - Support full 3D cursor rotation for sloped surfaces - Items on roofs are parented to the level with world-space rotation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fixed conflict * fix(editor): anchor floorplan cursor to snapped point * fix(nodes): preview floorplan edits through live overrides * feat(editor): add context-aware floorplan modes * fix(nodes): render crisp wall selection hatching * fix(editor): cap floorplan handles at extreme zoom * fix(editor): keep zone labels upright after rotation * refactor(editor): make referenced annotations registry-driven * refactor(nodes): colocate contextual dimension builders * fix(editor): use mode-driven angle snapping * fix(nodes): use mode-driven move snapping * chore(editor): update react scan tooling * refactor(floorplan): streamline construction documentation * refactor(floorplan): remove wall assembly roadmap * fix(floorplan): migrate retired scene data --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
daa1f3e99b
commit
ab76686b8b
@@ -5,7 +5,11 @@ import type {
|
||||
GeometryContext,
|
||||
WallNode,
|
||||
} from '@pascal-app/core'
|
||||
import { readFloorplanGeometryMetadata, withFloorplanGeometryMetadata } from '@pascal-app/editor'
|
||||
import {
|
||||
readFloorplanContext,
|
||||
readFloorplanGeometryMetadata,
|
||||
withFloorplanGeometryMetadata,
|
||||
} from '@pascal-app/editor'
|
||||
import {
|
||||
buildOpeningMarkAnnotation,
|
||||
type OpeningFloorplanLevelData,
|
||||
@@ -41,10 +45,9 @@ import { buildOpeningPlacementDimensions } from '../shared/opening-placement-dim
|
||||
* mounted on). Returns null when the parent isn't a wall (orphaned
|
||||
* doors during placement etc.).
|
||||
*
|
||||
* Skipped vs the full legacy for now: hinge / strike cubes (small
|
||||
* indicator squares at the rotation pivots), rounded-opening shape
|
||||
* variants, panic bar markers. Those are rare visual variations the
|
||||
* follow-up port can revisit.
|
||||
* Swing leaves include hinge / strike indicators and panic hardware
|
||||
* when present. Rounded and arched heads are shown as dashed overhead
|
||||
* lines because their geometry sits above the horizontal plan cut.
|
||||
*/
|
||||
export function buildDoorFloorplan(node: DoorNode, ctx: GeometryContext): FloorplanGeometry | null {
|
||||
const wall = ctx.parent as WallNode | null
|
||||
@@ -123,6 +126,27 @@ export function buildDoorFloorplan(node: DoorNode, ctx: GeometryContext): Floorp
|
||||
},
|
||||
]
|
||||
|
||||
if (node.openingShape !== 'rectangle') {
|
||||
const overheadRise =
|
||||
Math.min(width, node.openingShape === 'arch' ? node.archHeight : node.cornerRadius) * 0.2
|
||||
const overheadSide = swingDirection === 'inward' ? 1 : -1
|
||||
const startX = cx - dirX * halfWidth
|
||||
const startZ = cz - dirZ * halfWidth
|
||||
const endX = cx + dirX * halfWidth
|
||||
const endZ = cz + dirZ * halfWidth
|
||||
children.push({
|
||||
kind: 'path',
|
||||
d: `M ${startX} ${startZ} Q ${cx + perpX * overheadRise * overheadSide} ${cz + perpZ * overheadRise * overheadSide} ${endX} ${endZ}`,
|
||||
fill: 'none',
|
||||
stroke: accentColor,
|
||||
strokeWidth: showSelectedChrome ? 1.4 : 1,
|
||||
strokeOpacity: 0.8,
|
||||
strokeDasharray: '4 3',
|
||||
strokeLinecap: 'round',
|
||||
vectorEffect: 'non-scaling-stroke',
|
||||
})
|
||||
}
|
||||
|
||||
// Swing geometry. A leaf is drawn as a wedge fill + dashed swing arc +
|
||||
// solid leaf line. `drawSwingLeaf` emits one leaf given its hinge, the
|
||||
// closed-leaf vector (hinge → strike, whose length is the swing
|
||||
@@ -192,6 +216,47 @@ export function buildDoorFloorplan(node: DoorNode, ctx: GeometryContext): Floorp
|
||||
strokeLinecap: 'round',
|
||||
vectorEffect: 'non-scaling-stroke',
|
||||
})
|
||||
|
||||
const markerSize = Math.min(0.05, Math.max(0.025, radius * 0.05))
|
||||
const markerHalf = markerSize / 2
|
||||
const hardwareMarkers: Array<[number, number]> = [
|
||||
[hX, hZ],
|
||||
[closedTipX, closedTipZ],
|
||||
]
|
||||
for (const [markerX, markerZ] of hardwareMarkers) {
|
||||
children.push({
|
||||
kind: 'rect',
|
||||
x: markerX - markerHalf,
|
||||
y: markerZ - markerHalf,
|
||||
width: markerSize,
|
||||
height: markerSize,
|
||||
fill: fillColor,
|
||||
stroke: accentColor,
|
||||
strokeWidth: showSelectedChrome ? 1.4 : 1,
|
||||
vectorEffect: 'non-scaling-stroke',
|
||||
})
|
||||
}
|
||||
|
||||
if (node.panicBar) {
|
||||
const leafX = (tipX - hX) / radius
|
||||
const leafZ = (tipZ - hZ) / radius
|
||||
const barCenterX = hX + leafX * radius * 0.7
|
||||
const barCenterZ = hZ + leafZ * radius * 0.7
|
||||
const barHalfLength = Math.min(0.12, Math.max(0.06, depth * 0.75))
|
||||
const barX = -leafZ * barHalfLength
|
||||
const barZ = leafX * barHalfLength
|
||||
children.push({
|
||||
kind: 'line',
|
||||
x1: barCenterX - barX,
|
||||
y1: barCenterZ - barZ,
|
||||
x2: barCenterX + barX,
|
||||
y2: barCenterZ + barZ,
|
||||
stroke: accentColor,
|
||||
strokeWidth: showSelectedChrome ? 2.6 : 2.2,
|
||||
strokeLinecap: 'square',
|
||||
vectorEffect: 'non-scaling-stroke',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const isDoubleLeaf = node.doorType === 'double' || node.doorType === 'french'
|
||||
@@ -721,7 +786,7 @@ export function buildDoorFloorplan(node: DoorNode, ctx: GeometryContext): Floorp
|
||||
// Placement-measurement dimensions — distances to adjacent openings
|
||||
// (or wall ends) on each side. Only visible while actively moving
|
||||
// (the user clicked Move or grabbed the orange dot).
|
||||
if (view?.moving) {
|
||||
if (view?.moving && readFloorplanContext(ctx).automaticDimensions) {
|
||||
for (const dim of buildOpeningPlacementDimensions(node, ctx)) {
|
||||
children.push(dim)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user