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
@@ -0,0 +1,68 @@
|
||||
import { describe, expect, test } from 'bun:test'
|
||||
import { DoorNode, type FloorplanGeometry, type GeometryContext, WallNode } from '@pascal-app/core'
|
||||
import { buildDoorFloorplan } from './floorplan'
|
||||
|
||||
const wall = WallNode.parse({
|
||||
id: 'wall_door-plan',
|
||||
start: [0, 0],
|
||||
end: [4, 0],
|
||||
thickness: 0.2,
|
||||
})
|
||||
|
||||
function buildDoor(values: Partial<DoorNode> = {}): FloorplanGeometry[] {
|
||||
const door = DoorNode.parse({
|
||||
id: 'door_plan',
|
||||
parentId: wall.id,
|
||||
wallId: wall.id,
|
||||
position: [2, 1.05, 0],
|
||||
width: 1,
|
||||
...values,
|
||||
})
|
||||
const geometry = buildDoorFloorplan(door, {
|
||||
children: [],
|
||||
parent: wall,
|
||||
resolve: () => undefined,
|
||||
siblings: [],
|
||||
} as GeometryContext)
|
||||
expect(geometry?.kind).toBe('group')
|
||||
return geometry?.kind === 'group' ? geometry.children : []
|
||||
}
|
||||
|
||||
describe('buildDoorFloorplan documentation symbols', () => {
|
||||
test('shows hinge, strike, panic hardware, and an arched overhead line', () => {
|
||||
const geometry = buildDoor({
|
||||
doorType: 'hinged',
|
||||
openingShape: 'arch',
|
||||
archHeight: 0.45,
|
||||
panicBar: true,
|
||||
})
|
||||
|
||||
expect(geometry.filter((item) => item.kind === 'rect')).toHaveLength(2)
|
||||
expect(
|
||||
geometry.some(
|
||||
(item) =>
|
||||
item.kind === 'line' && item.strokeLinecap === 'square' && item.strokeWidth === 2.2,
|
||||
),
|
||||
).toBe(true)
|
||||
expect(geometry.some((item) => item.kind === 'path' && item.strokeDasharray === '4 3')).toBe(
|
||||
true,
|
||||
)
|
||||
})
|
||||
|
||||
test('documents a rounded frameless opening without swing hardware', () => {
|
||||
const geometry = buildDoor({
|
||||
openingKind: 'opening',
|
||||
openingShape: 'rounded',
|
||||
cornerRadius: 0.2,
|
||||
panicBar: true,
|
||||
})
|
||||
|
||||
expect(geometry.filter((item) => item.kind === 'rect')).toHaveLength(0)
|
||||
expect(geometry.some((item) => item.kind === 'line' && item.strokeLinecap === 'square')).toBe(
|
||||
false,
|
||||
)
|
||||
expect(geometry.some((item) => item.kind === 'path' && item.strokeDasharray === '4 3')).toBe(
|
||||
true,
|
||||
)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user