Files
qlcplus/stage/map.canvas.tsx
T

386 lines
13 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import {
Card,
CardBody,
CardHeader,
H1,
H2,
Stack,
Table,
Text,
useHostTheme,
} from "cursor/canvas";
/** Y=0 = row of 4; +Y toward audience. Side cans on walls at ±3.5 m. */
const WALL = 3.5;
const BEAM = 0.3;
const FAR = -8.0;
const FIXTURES: {
key: string;
label: string;
kind: "can" | "mover";
x: number;
y: number;
dmx: number;
channels: number;
}[] = [
{ key: "c3", label: "#3", kind: "can", x: -1.8, y: 0.0, dmx: 103, channels: 8 },
{ key: "c4", label: "#4", kind: "can", x: -0.6, y: 0.0, dmx: 111, channels: 8 },
{ key: "c5", label: "#5", kind: "can", x: 0.6, y: 0.0, dmx: 119, channels: 8 },
{ key: "c6", label: "#6", kind: "can", x: 1.8, y: 0.0, dmx: 127, channels: 8 },
{ key: "c2", label: "#2", kind: "can", x: -WALL, y: 1.2, dmx: 95, channels: 8 },
{ key: "c7", label: "#7", kind: "can", x: WALL, y: 1.2, dmx: 135, channels: 8 },
{ key: "m1", label: "M1", kind: "mover", x: -0.3, y: 1.1, dmx: 0, channels: 43 },
{ key: "m2", label: "M2", kind: "mover", x: 0.3, y: 1.1, dmx: 44, channels: 43 },
{ key: "c1", label: "#1", kind: "can", x: -WALL, y: 2.4, dmx: 87, channels: 8 },
{ key: "c8", label: "#8", kind: "can", x: WALL, y: 2.4, dmx: 143, channels: 8 },
{ key: "c9", label: "#9", kind: "can", x: -WALL, y: -0.8, dmx: 151, channels: 8 },
{ key: "c10", label: "#10", kind: "can", x: WALL, y: -0.8, dmx: 159, channels: 8 },
{ key: "c11", label: "#11", kind: "can", x: -WALL, y: -6.8, dmx: 167, channels: 8 },
{ key: "c12", label: "#12", kind: "can", x: WALL, y: -6.8, dmx: 175, channels: 8 },
{ key: "c13", label: "#13", kind: "can", x: -WALL, y: -7.65, dmx: 183, channels: 8 },
{ key: "c14", label: "#14", kind: "can", x: 0, y: -7.65, dmx: 191, channels: 8 },
{ key: "c15", label: "#15", kind: "can", x: WALL, y: -7.65, dmx: 199, channels: 8 },
{ key: "m3", label: "M3", kind: "mover", x: -1.75, y: -7.65, dmx: 257, channels: 43 },
{ key: "m4", label: "M4", kind: "mover", x: 1.75, y: -7.65, dmx: 300, channels: 43 },
];
const BUILDING_W = 7;
const DEPTH = 2.4;
export default function StageMap() {
const theme = useHostTheme();
const pad = 0.55;
const x0 = -BUILDING_W / 2 - pad;
const x1 = BUILDING_W / 2 + pad;
const y0 = FAR - 0.55;
const y1 = DEPTH + 0.55;
const vbW = x1 - x0;
const vbH = y1 - y0;
const px = 88;
const svgW = vbW * px;
const svgH = vbH * px;
const sx = (x: number) => ((x - x0) / vbW) * svgW;
const sy = (y: number) => ((y1 - y) / vbH) * svgH;
const dim = theme.text.tertiary;
const ink = theme.text.primary;
const accent = theme.accent.primary;
const canFill = theme.fill.tertiary;
const stroke = theme.stroke.primary;
const onAccent = theme.text.onAccent;
function DimH(
xA: number,
xB: number,
y: number,
label: string,
side: "above" | "below" = "above",
) {
const ya = sy(y);
const x1p = sx(Math.min(xA, xB));
const x2p = sx(Math.max(xA, xB));
const mid = (x1p + x2p) / 2;
const ty = side === "above" ? ya - 8 : ya + 14;
return (
<g stroke={dim} fill={dim} strokeWidth={1}>
<line x1={x1p} y1={ya} x2={x2p} y2={ya} />
<line x1={x1p} y1={ya - 4} x2={x1p} y2={ya + 4} />
<line x1={x2p} y1={ya - 4} x2={x2p} y2={ya + 4} />
<text x={mid} y={ty} textAnchor="middle" fontSize={11} fill={dim} stroke="none">
{label}
</text>
</g>
);
}
function DimV(
yA: number,
yB: number,
x: number,
label: string,
side: "left" | "right" = "right",
) {
const xa = sx(x);
const y1p = sy(Math.max(yA, yB));
const y2p = sy(Math.min(yA, yB));
const mid = (y1p + y2p) / 2;
const tx = side === "right" ? xa + 8 : xa - 8;
return (
<g stroke={dim} fill={dim} strokeWidth={1}>
<line x1={xa} y1={y1p} x2={xa} y2={y2p} />
<line x1={xa - 4} y1={y1p} x2={xa + 4} y2={y1p} />
<line x1={xa - 4} y1={y2p} x2={xa + 4} y2={y2p} />
<text
x={tx}
y={mid + 4}
textAnchor={side === "right" ? "start" : "end"}
fontSize={11}
fill={dim}
stroke="none"
>
{label}
</text>
</g>
);
}
return (
<Stack gap={20} style={{ padding: 20, maxWidth: 960 }}>
<Stack gap={6}>
<H1>xchc</H1>
<Text tone="secondary">
Building {BUILDING_W} m wide · walls at ±{WALL} m · Y = 0 at row of 4 ·
+Y toward audience
</Text>
</Stack>
<Card>
<CardHeader>Plan (audience at bottom)</CardHeader>
<CardBody>
<svg
width="100%"
viewBox={`0 0 ${svgW} ${svgH}`}
style={{ display: "block", maxWidth: svgW, background: theme.bg.editor }}
>
<rect
x={sx(-BUILDING_W / 2)}
y={sy(DEPTH)}
width={BUILDING_W * px}
height={(DEPTH - FAR) * px}
fill="none"
stroke={stroke}
strokeWidth={2}
/>
{/* Wall labels */}
<text
x={sx(-WALL) + 4}
y={sy(1.8)}
fontSize={10}
fill={dim}
stroke="none"
transform={`rotate(-90 ${sx(-WALL) + 4} ${sy(1.8)})`}
>
3.5 m from centre
</text>
<text
x={sx(WALL) - 4}
y={sy(1.8)}
fontSize={10}
fill={dim}
stroke="none"
textAnchor="end"
transform={`rotate(90 ${sx(WALL) - 4} ${sy(1.8)})`}
>
3.5 m from centre
</text>
{DimH(0, -WALL, 1.8, "3.5 m", "above")}
{DimH(0, WALL, 1.8, "3.5 m", "below")}
<line
x1={sx(0)}
y1={sy(FAR - 0.15)}
x2={sx(0)}
y2={sy(DEPTH + 0.2)}
stroke={dim}
strokeWidth={1}
strokeDasharray="3 5"
/>
<text x={sx(0) + 6} y={sy(-0.05)} fontSize={10} fill={dim} stroke="none">
centre
</text>
<text
x={sx(0)}
y={sy(DEPTH + 0.38)}
textAnchor="middle"
fontSize={12}
fill={ink}
fontWeight={600}
stroke="none"
>
AUDIENCE
</text>
<text
x={sx(0)}
y={sy(-0.62)}
textAnchor="middle"
fontSize={11}
fill={dim}
stroke="none"
>
row of 4
</text>
{DimH(-3.5, 3.5, DEPTH + 0.32, "7.0 m building", "below")}
{DimH(0, 0.6, 0, "0.6", "above")}
{DimH(0, 1.8, 0, "1.8", "above")}
{DimH(0, -0.6, 0, "0.6", "below")}
{DimH(0, -1.8, 0, "1.8", "below")}
{DimH(0, 0.3, 1.1, "0.3", "above")}
{DimV(0, 1.1, 2.4, "1.1 m movers")}
{DimV(0, 1.2, 2.4, "1.2 m")}
{DimV(0, 2.4, -2.4, "2.4 m", "left")}
{DimV(-0.8, -6.8, -3.95, "6 m", "right")}
<rect
x={sx(-WALL)}
y={sy(-0.2)}
width={BUILDING_W * px}
height={BEAM * px}
fill={theme.fill.tertiary}
stroke={stroke}
/>
<rect
x={sx(-WALL)}
y={sy(-7.05)}
width={BUILDING_W * px}
height={BEAM * px}
fill={theme.fill.tertiary}
stroke={stroke}
/>
<text x={sx(-2.2)} y={sy(-0.32)} textAnchor="middle" fontSize={10} fill={dim} stroke="none">
beam
</text>
<text x={sx(-2.2)} y={sy(-7.17)} textAnchor="middle" fontSize={10} fill={dim} stroke="none">
beam
</text>
{FIXTURES.map((f) => {
const cx = sx(f.x);
const cy = sy(f.y);
const r = f.kind === "mover" ? 14 : 12;
return (
<g key={f.key}>
{f.kind === "mover" ? (
<rect
x={cx - r}
y={cy - r}
width={r * 2}
height={r * 2}
rx={3}
fill={accent}
stroke={stroke}
strokeWidth={1}
/>
) : (
<circle
cx={cx}
cy={cy}
r={r}
fill={canFill}
stroke={stroke}
strokeWidth={1.5}
/>
)}
<text
x={cx}
y={cy + 4}
textAnchor="middle"
fontSize={11}
fontWeight={600}
fill={f.kind === "mover" ? onAccent : ink}
stroke="none"
>
{f.label}
</text>
<text
x={f.x < -3 ? cx + 18 : f.x > 3 ? cx - 18 : cx}
y={f.x < -3 || f.x > 3 ? cy + 4 : cy + r + 14}
textAnchor={f.x < -3 ? "start" : f.x > 3 ? "end" : "middle"}
fontSize={10}
fill={dim}
stroke="none"
>
{f.dmx}–{f.dmx + f.channels - 1}
</text>
</g>
);
})}
</svg>
</CardBody>
</Card>
<Stack gap={12}>
<H2>Coordinates</H2>
<Table
headers={["Fixture", "Type", "Channels", "X (m)", "Y (m)", "Notes"]}
rows={[
["#3", "Can", "103–110", "−1.8", "0.0", "Row of 4"],
["#4", "Can", "111–118", "−0.6", "0.0", "Row of 4"],
["#5", "Can", "119–126", "+0.6", "0.0", "Row of 4"],
["#6", "Can", "127–134", "+1.8", "0.0", "Row of 4"],
["#2", "Can", "95–102", "−3.5", "1.2", "Side · 3.5 m from centre · 1.2 m in front of the 4"],
["#7", "Can", "135–142", "+3.5", "1.2", "Side · 3.5 m from centre · 1.2 m in front of the 4"],
["M1", "Mover", "0–42", "−0.3", "1.1", "Front left · 43ch"],
["M2", "Mover", "44–86", "+0.3", "1.1", "Front right · 43ch"],
["#1", "Can", "87–94", "−3.5", "2.4", "Side · 3.5 m from centre · front left · 2.4 m in front"],
["#8", "Can", "143–150", "+3.5", "2.4", "Side · 3.5 m from centre · front right · 2.4 m in front"],
["#9", "Can", "151–158", "−3.5", "−0.8", "Left corner · far side of the row-of-4 beam"],
["#10", "Can", "159–166", "+3.5", "−0.8", "Right corner · far side of the row-of-4 beam"],
["#11", "Can", "167–174", "−3.5", "−6.8", "6 m below #9 · audience side of the lower beam"],
["#12", "Can", "175–182", "+3.5", "−6.8", "6 m below #10 · audience side of the lower beam"],
["#13", "Can", "183–190", "−3.5", "−7.65", "Left corner · far side of the lower beam"],
["#14", "Can", "191–198", "0.0", "−7.65", "Halfway between #13 and #15"],
["#15", "Can", "199–206", "+3.5", "−7.65", "Right corner · far side of the lower beam"],
["M3", "Mover", "257–299", "−1.75", "−7.65", "Back left · between #13 and #14"],
["M4", "Mover", "300–342", "+1.75", "−7.65", "Back right · between #14 and #15"],
]}
/>
<Text tone="secondary" size="small">
Source: integrate_u_patterns.py LAYOUT_M
</Text>
</Stack>
<Stack gap={12}>
<H2>beamZ BCC145 · 8 Channel</H2>
<Text tone="secondary">Cans #1–#15. Channel 1 is the fixture’s start address.</Text>
<Table
headers={["Ch", "Name"]}
rows={[
["1", "Dimmer"],
["2", "Strobe"],
["3", "Red"],
["4", "Green"],
["5", "Blue"],
["6", "White"],
["7", "Macro"],
["8", "Speed"],
]}
/>
</Stack>
<Stack gap={12}>
<H2>Small Eye 7 Mover · 43 Channel</H2>
<Text tone="secondary">M1–M4. Channel 1 is the fixture’s start address.</Text>
<Table
headers={["Ch", "Name"]}
rows={[
["1", "Pan"],
["2", "Pan Fine"],
["3", "Tilt"],
["4", "Tilt Fine"],
["5", "Pan/Tilt Speed"],
["6", "Zoom"],
["7", "Lens Rotate"],
["8", "Focus"],
["9", "Center Brightness"],
["10", "Center Strobe"],
["11–14", "RGBW 1"],
["15–18", "RGBW 2"],
["19–22", "RGBW 3"],
["23–26", "RGBW 4"],
["27–30", "RGBW 5"],
["31–34", "RGBW 6"],
["35–38", "RGBW 7"],
["39", "Colour Temperature"],
["40", "Colour Macro"],
["41", "Static Effect"],
["42", "Dynamic Effect"],
["43", "Reset"],
]}
/>
</Stack>
</Stack>
);
}