floorplan/zone: name label inside polygon + polygon editor on select
`buildZoneFloorplan` now emits a centered name label at the polygon's area-weighted centroid (Shoelace formula, with bbox-center fallback for degenerate rings). Label uses the legacy `FloorplanZoneLabel` styling: `fontSize: 0.2`, white fill, zone-color stroke, `paintOrder: 'stroke'` for the "outlined text" look that stays legible above any fill. When the zone is selected the builder also emits the polygon editor — edge-handle per edge, midpoint-handle per midpoint, endpoint-handle per vertex — driven by the shared `createPolygonVertexAffordance` / `createPolygonAddVertexAffordance` / `createPolygonMoveEdgeAffordance` factories slabs and ceilings already use. Zones have no `holes` field so the factory's optional `holeIndex` stays undefined and the operations target `node.polygon` directly. 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
3419cf8587
commit
0dee7747d2
@@ -0,0 +1,20 @@
|
||||
import type { ZoneNode } from '@pascal-app/core'
|
||||
import {
|
||||
createPolygonAddVertexAffordance,
|
||||
createPolygonMoveEdgeAffordance,
|
||||
createPolygonVertexAffordance,
|
||||
} from '../shared/polygon-vertex-affordance'
|
||||
|
||||
/**
|
||||
* 2D drag affordances for zone — same three polygon-editing operations
|
||||
* slabs and ceilings expose. Zones have no `holes` field, but the
|
||||
* shared factory accepts that case (holeIndex stays undefined and the
|
||||
* boundary polygon is the target).
|
||||
*
|
||||
* - `move-vertex` — drag an existing polygon vertex.
|
||||
* - `add-vertex` — insert a new vertex at an edge midpoint, then drag.
|
||||
* - `move-edge` — drag an entire edge perpendicular to itself.
|
||||
*/
|
||||
export const zoneMoveVertexAffordance = createPolygonVertexAffordance<ZoneNode>('zone')
|
||||
export const zoneAddVertexAffordance = createPolygonAddVertexAffordance<ZoneNode>('zone')
|
||||
export const zoneMoveEdgeAffordance = createPolygonMoveEdgeAffordance<ZoneNode>('zone')
|
||||
Reference in New Issue
Block a user