task(E7): event elements polish - curtain (wavy polyline), spotlight (cone polygon with angle/color), barrier (chain circles), stage height attribute
This commit is contained in:
@@ -236,6 +236,66 @@ export function elementToPrimitives(el: CADElement): ShapePrimitive[] {
|
||||
}];
|
||||
}
|
||||
|
||||
case 'curtain': {
|
||||
// Vorhang (Task E7): wellige Polyline entlang der Breite.
|
||||
const pts = Array.isArray(props.points)
|
||||
? (props.points as unknown[]).map(asPoint)
|
||||
: [];
|
||||
if (pts.length >= 2) {
|
||||
return [{ kind: 'polyline', points: pts, close: false, stroke, strokeWidth: sw }];
|
||||
}
|
||||
return [{
|
||||
kind: 'line',
|
||||
from: { x: el.x - el.width / 2, y: el.y },
|
||||
to: { x: el.x + el.width / 2, y: el.y },
|
||||
stroke,
|
||||
strokeWidth: sw,
|
||||
}];
|
||||
}
|
||||
|
||||
case 'spotlight': {
|
||||
// Scheinwerfer (Task E7): Kegel-Polygon in properties.color.
|
||||
const pts = Array.isArray(props.points)
|
||||
? (props.points as unknown[]).map(asPoint)
|
||||
: [];
|
||||
if (pts.length >= 3) {
|
||||
const col = (props.color as string | undefined) ?? '#ffcc00';
|
||||
return [{ kind: 'polyline', points: pts, close: true, stroke: col, strokeWidth: sw }];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
case 'barrier': {
|
||||
// Absperrung (Task E7): Kette aus Kreis-Paaren (properties.circles).
|
||||
const circles = Array.isArray(props.circles)
|
||||
? (props.circles as Array<{ x: number; y: number; r: number }>)
|
||||
: [];
|
||||
const col = (props.color as string | undefined) ?? '#c0392b';
|
||||
if (circles.length > 0) {
|
||||
return circles.map((c) => ({
|
||||
kind: 'circle' as const,
|
||||
center: { x: c.x, y: c.y },
|
||||
radius: c.r,
|
||||
fill: null,
|
||||
stroke: col,
|
||||
strokeWidth: 1,
|
||||
}));
|
||||
}
|
||||
const out: ShapePrimitive[] = [];
|
||||
const N = 5;
|
||||
for (let i = 0; i < N; i++) {
|
||||
out.push({
|
||||
kind: 'circle',
|
||||
center: { x: el.x - el.width / 2 + (el.width * (i + 0.5)) / N, y: el.y },
|
||||
radius: Math.min(6, el.width / (N * 2.5)),
|
||||
fill: null,
|
||||
stroke: col,
|
||||
strokeWidth: 1,
|
||||
});
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user