Adds a `horizontal` fence style that builds composite-cladding panels — horizontal boards stacked between square intermediate posts — instead of the vertical pickets that slat/rail/privacy all produce today. - New `style: 'horizontal'` (core schema + inspector Style control). - Posts march along the whole span at `postSpacing`, each with a cap. - New `postCap` control (none/flat/pyramid, default pyramid); pyramid caps render as a 4-sided cone fence part. - New `slatGap` control for the board reveal — 0 collapses to one flush panel so the stacked-board seams don't read as lines. - `postCap` + `slatGap` are horizontal-only (visibleIf); postCap uses a labelled dropdown so its options aren't a context-free switch. - Lower the `postSpacing` inspector minimum from 0.2 to 0.05 m. - 2D floor plan reuses the solid-panel marker for horizontal. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
77 lines
2.8 KiB
TypeScript
77 lines
2.8 KiB
TypeScript
import type { ParametricDescriptor } from '@pascal-app/core'
|
|
import { FenceCurveEditor, FenceLengthEditor } from './inspector-editors'
|
|
import type { FenceNode } from './schema'
|
|
|
|
/**
|
|
* Inspector descriptor for fence. Mirrors the legacy `FencePanel`
|
|
* layout 1:1:
|
|
* - **Style** (segmented controls): style, baseStyle, showInfill toggle.
|
|
* - **Dimensions**: Length (derived from start/end), Curve (sagitta
|
|
* with dynamic bounds), Height, Thickness.
|
|
* - **Structure**: Base Height, Top Rail, Post Spacing, Post Size,
|
|
* Post Cap + Slat Gap (horizontal-only), Ground Clear, Edge Inset.
|
|
*
|
|
* Length + Curve use the `custom` field kind because they don't map
|
|
* to single number fields with static bounds — see `inspector-editors.tsx`.
|
|
*/
|
|
export const fenceParametrics: ParametricDescriptor<FenceNode> = {
|
|
groups: [
|
|
{
|
|
label: 'Style',
|
|
fields: [
|
|
{
|
|
key: 'style',
|
|
kind: 'enum',
|
|
options: ['slat', 'rail', 'privacy', 'horizontal'],
|
|
display: 'segmented',
|
|
},
|
|
{
|
|
key: 'baseStyle',
|
|
kind: 'enum',
|
|
options: ['grounded', 'floating'],
|
|
display: 'segmented',
|
|
},
|
|
{ key: 'showInfill', kind: 'boolean' },
|
|
],
|
|
},
|
|
{
|
|
label: 'Dimensions',
|
|
fields: [
|
|
{ key: 'length', kind: 'custom', component: FenceLengthEditor },
|
|
{ key: 'curve', kind: 'custom', component: FenceCurveEditor },
|
|
{ key: 'height', kind: 'number', unit: 'm', min: 0.4, max: 4, step: 0.05 },
|
|
{ key: 'thickness', kind: 'number', unit: 'm', min: 0.03, max: 0.5, step: 0.005 },
|
|
],
|
|
},
|
|
{
|
|
label: 'Structure',
|
|
fields: [
|
|
{ key: 'baseHeight', kind: 'number', unit: 'm', min: 0.04, max: 1, step: 0.01 },
|
|
{ key: 'topRailHeight', kind: 'number', unit: 'm', min: 0.01, max: 0.25, step: 0.005 },
|
|
{ key: 'postSpacing', kind: 'number', unit: 'm', min: 0.05, max: 5, step: 0.01 },
|
|
{ key: 'postSize', kind: 'number', unit: 'm', min: 0.01, max: 0.4, step: 0.005 },
|
|
{
|
|
// Dropdown (not segmented) so the inspector renders its "Post Cap"
|
|
// label — a bare segmented `None / Flat / Pyramid` switch reads
|
|
// contextless.
|
|
key: 'postCap',
|
|
kind: 'enum',
|
|
options: ['none', 'flat', 'pyramid'],
|
|
visibleIf: (n) => n.style === 'horizontal',
|
|
},
|
|
{
|
|
key: 'slatGap',
|
|
kind: 'number',
|
|
unit: 'm',
|
|
min: 0,
|
|
max: 0.1,
|
|
step: 0.002,
|
|
visibleIf: (n) => n.style === 'horizontal',
|
|
},
|
|
{ key: 'groundClearance', kind: 'number', unit: 'm', min: 0, max: 0.6, step: 0.005 },
|
|
{ key: 'edgeInset', kind: 'number', unit: 'm', min: 0.005, max: 0.25, step: 0.005 },
|
|
],
|
|
},
|
|
],
|
|
}
|