Phase 5 batch kind: ceiling migrates to registry (always-on)
Structurally identical to slab. Stage A migration: registers the kind, wraps the legacy renderer + system, applies the panel slider-drag fix recipe. Files added (packages/nodes/src/ceiling/): - schema.ts: re-exports CeilingNode from core. - parametrics.ts: height slider only. Polygon + holes via floor-plan editors. - definition.ts: capabilities (no `movable`, `surfaces.top` mapped to `height`), relations (hosts: ['item'] for ceiling-mounted lights / fans, cascadeDelete: 'descendants'), toolHints, parametrics. - renderer.tsx: wrap-export of legacy CeilingRenderer. The legacy renderer uses TSL shader code for grid-line patterns (~100 lines); not worth duplicating at Stage A. Per-stage migration plan in plans/editor-node-registry.md moves the renderer body into this folder at Stage B/F. - system.tsx: re-exports legacy CeilingSystem. - index.ts: barrel. Files changed: - packages/viewer/src/index.ts: new public exports for CeilingRenderer + CeilingSystem. - packages/nodes/src/index.ts: appends ceilingDefinition. - packages/editor/src/components/ui/panels/ceiling-panel.tsx: panel slider-drag fix recipe applied (nodeRef pattern, useScene.getState() inside handler, drop subscribed updateNode dep) so the height slider doesn't trigger the same cascade fence + wall + slab fixed. Phase 5 progress: shelf ✅, spawn ✅, wall ✅, fence ✅, slab ✅, ceiling ✅. Six kinds on the registry. Door / window / item / stair / roof / zone follow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
4891f681f3
commit
2dd50fa5be
@@ -0,0 +1,80 @@
|
||||
import type { NodeDefinition } from '@pascal-app/core'
|
||||
import { ceilingParametrics } from './parametrics'
|
||||
import { CeilingNode } from './schema'
|
||||
|
||||
/**
|
||||
* Ceiling — Phase 5 batch kind, polygon-based. Structurally identical
|
||||
* to slab but mounted at `height` rather than `elevation`.
|
||||
*
|
||||
* Capabilities:
|
||||
* - **No `movable`**: ceiling move is bespoke via legacy `MoveCeilingTool`
|
||||
* + the floor-plan boundary / hole editors. Capability-driven dispatch
|
||||
* keeps the legacy mover (preserves polygon-aware behavior).
|
||||
* - **`surfaces.top`**: items host on the ceiling at `height`.
|
||||
* - `selectable`, `duplicable`, `deletable` standard.
|
||||
*
|
||||
* Relations: `hosts: ['item']` for ceiling-mounted items (lights, fans).
|
||||
* `cascadeDelete: 'descendants'` removes hosted items on ceiling delete.
|
||||
*/
|
||||
export const ceilingDefinition: NodeDefinition<typeof CeilingNode> = {
|
||||
kind: 'ceiling',
|
||||
schemaVersion: 1,
|
||||
schema: CeilingNode,
|
||||
category: 'structure',
|
||||
|
||||
defaults: () => ({
|
||||
object: 'node',
|
||||
parentId: null,
|
||||
visible: true,
|
||||
metadata: {},
|
||||
children: [],
|
||||
polygon: [],
|
||||
holes: [],
|
||||
holeMetadata: [],
|
||||
height: 2.5,
|
||||
autoFromWalls: false,
|
||||
}),
|
||||
|
||||
capabilities: {
|
||||
selectable: { hitVolume: 'bbox' },
|
||||
surfaces: {
|
||||
top: { height: (n) => (n as CeilingNode).height },
|
||||
},
|
||||
duplicable: true,
|
||||
deletable: true,
|
||||
},
|
||||
|
||||
relations: {
|
||||
hosts: ['item'],
|
||||
cascadeDelete: 'descendants',
|
||||
},
|
||||
|
||||
parametrics: ceilingParametrics,
|
||||
|
||||
renderer: {
|
||||
kind: 'parametric',
|
||||
module: () => import('./renderer'),
|
||||
},
|
||||
system: {
|
||||
module: () => import('./system'),
|
||||
priority: 4,
|
||||
},
|
||||
|
||||
toolHints: [
|
||||
{ key: 'Left click', label: 'Trace ceiling outline' },
|
||||
{ key: 'Enter', label: 'Finish ceiling' },
|
||||
{ key: 'Esc', label: 'Cancel' },
|
||||
],
|
||||
|
||||
presentation: {
|
||||
label: 'Ceiling',
|
||||
description: 'A polygon-bounded ceiling surface that hosts ceiling-mounted items.',
|
||||
icon: { kind: 'iconify', name: 'lucide:square-dashed' },
|
||||
paletteSection: 'structure',
|
||||
paletteOrder: 40,
|
||||
},
|
||||
|
||||
mcp: {
|
||||
description: 'A polygon-bounded ceiling with optional cutout holes.',
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user