flight-indicators 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -2
- package/dist/index.cjs +488 -254
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -1
- package/dist/index.d.ts +38 -1
- package/dist/index.js +487 -254
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
FlapIndicator: () => FlapIndicator,
|
|
35
35
|
FuelIndicator: () => FuelIndicator,
|
|
36
36
|
HeadingIndicator: () => HeadingIndicator,
|
|
37
|
+
HsiIndicator: () => HsiIndicator,
|
|
37
38
|
IlsIndicator: () => IlsIndicator,
|
|
38
39
|
MAX_BAR_GAUGES: () => MAX_BAR_GAUGES,
|
|
39
40
|
MAX_CYLINDERS: () => MAX_CYLINDERS,
|
|
@@ -110,6 +111,47 @@ function useSvgId(prefix) {
|
|
|
110
111
|
|
|
111
112
|
// src/components/Instrument.tsx
|
|
112
113
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
114
|
+
var KNOB_PLACES = {
|
|
115
|
+
"bottom-left": [46, 354, 30],
|
|
116
|
+
"bottom-right": [354, 354, 30],
|
|
117
|
+
bottom: [CENTER, 376, 17]
|
|
118
|
+
};
|
|
119
|
+
function Knob({ id, label: label2, position, angle = 0, animationDuration = DEFAULT_ANIMATION_MS }) {
|
|
120
|
+
const [cx, cy, r] = KNOB_PLACES[position];
|
|
121
|
+
const display2 = useContinuousAngle(angle);
|
|
122
|
+
const step = 360 / 28;
|
|
123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { "data-testid": `knob-${id}`, children: [
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx, cy: cy + 2, r: r + 2, fill: "#000", opacity: "0.55" }),
|
|
125
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { "data-testid": `knob-${id}-rim`, style: motionStyle(`rotate(${display2}deg)`, animationDuration, cx, cy), children: [
|
|
126
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx, cy, r, fill: "#2e2e2e", stroke: "#000", strokeWidth: "2" }),
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { stroke: "#111", strokeWidth: r > 20 ? 3 : 2, children: range(0, 360 - step, step).map((a) => {
|
|
128
|
+
const rad = a * Math.PI / 180;
|
|
129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
130
|
+
"path",
|
|
131
|
+
{
|
|
132
|
+
d: `M ${cx + (r - 5) * Math.sin(rad)} ${cy - (r - 5) * Math.cos(rad)} L ${cx + r * Math.sin(rad)} ${cy - r * Math.cos(rad)}`
|
|
133
|
+
},
|
|
134
|
+
a
|
|
135
|
+
);
|
|
136
|
+
}) }),
|
|
137
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: `M ${cx} ${cy - r + 1} v ${r * 0.22}`, stroke: "#ddd", strokeWidth: "2", strokeLinecap: "round" })
|
|
138
|
+
] }),
|
|
139
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx, cy, r: r * 0.72, fill: "#1f1f1f", stroke: "#cfcfcf", strokeWidth: r > 20 ? 2 : 1.5 }),
|
|
140
|
+
label2 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
141
|
+
"text",
|
|
142
|
+
{
|
|
143
|
+
x: cx,
|
|
144
|
+
y: cy,
|
|
145
|
+
fill: "#eee",
|
|
146
|
+
fontSize: Math.min(13, r * 1.15 / Math.max(1, label2.length * 0.6)),
|
|
147
|
+
fontWeight: "bold",
|
|
148
|
+
textAnchor: "middle",
|
|
149
|
+
dominantBaseline: "central",
|
|
150
|
+
children: label2
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
] });
|
|
154
|
+
}
|
|
113
155
|
var SCREWS = [
|
|
114
156
|
[32, 32],
|
|
115
157
|
[368, 32],
|
|
@@ -119,6 +161,9 @@ var SCREWS = [
|
|
|
119
161
|
function InstrumentFrame({
|
|
120
162
|
size = 200,
|
|
121
163
|
showBox = true,
|
|
164
|
+
showKnobs = true,
|
|
165
|
+
knobs,
|
|
166
|
+
animationDuration,
|
|
122
167
|
className,
|
|
123
168
|
style,
|
|
124
169
|
title,
|
|
@@ -154,7 +199,8 @@ function InstrumentFrame({
|
|
|
154
199
|
] }),
|
|
155
200
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: CENTER, cy: CENTER, r: "196", fill: `url(#${bezelId})` }),
|
|
156
201
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: CENTER, cy: CENTER, r: "182", fill: "#111", stroke: "#000", strokeWidth: "4" }),
|
|
157
|
-
children
|
|
202
|
+
children,
|
|
203
|
+
showKnobs && knobs?.map((k) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Knob, { ...k, animationDuration }, k.id))
|
|
158
204
|
]
|
|
159
205
|
}
|
|
160
206
|
);
|
|
@@ -187,6 +233,7 @@ function AttitudeIndicator({ roll = 0, pitch = 0, pitchLimit = 40, ...props }) {
|
|
|
187
233
|
{
|
|
188
234
|
...props,
|
|
189
235
|
label: `Attitude indicator: pitch ${Math.round(safePitch)}\xB0, roll ${Math.round(safeRoll)}\xB0`,
|
|
236
|
+
knobs: [{ id: "adjust", position: "bottom" }],
|
|
190
237
|
children: [
|
|
191
238
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: CENTER, cy: CENTER, r: FACE_R }) }) }),
|
|
192
239
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { clipPath: `url(#${clipId})`, children: [
|
|
@@ -239,41 +286,49 @@ function HeadingIndicator({ heading = 0, ...props }) {
|
|
|
239
286
|
const safeHeading = finite(heading);
|
|
240
287
|
const normalised = (Math.round(safeHeading) % 360 + 360) % 360;
|
|
241
288
|
const displayHeading = useContinuousAngle(safeHeading);
|
|
242
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
290
|
+
InstrumentFrame,
|
|
291
|
+
{
|
|
292
|
+
...props,
|
|
293
|
+
label: `Heading indicator: ${String(normalised).padStart(3, "0")}\xB0`,
|
|
294
|
+
knobs: [{ id: "set", label: "PUSH", position: "bottom-left", angle: safeHeading }],
|
|
295
|
+
children: [
|
|
296
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { "data-testid": "heading-card", style: motionStyle(`rotate(${-displayHeading}deg)`, duration), children: [
|
|
297
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
|
|
298
|
+
range(0, 330, 30).map((a) => {
|
|
299
|
+
const [x, y] = polar(132, a);
|
|
300
|
+
const label2 = CARDINALS[a] ?? String(a / 10);
|
|
301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
302
|
+
"text",
|
|
303
|
+
{
|
|
304
|
+
x,
|
|
305
|
+
y,
|
|
306
|
+
transform: `rotate(${a} ${x} ${y})`,
|
|
307
|
+
fill: a % 90 === 0 ? "#ffb000" : "#fff",
|
|
308
|
+
fontSize: a % 90 === 0 ? 30 : 26,
|
|
309
|
+
fontWeight: "bold",
|
|
310
|
+
textAnchor: "middle",
|
|
311
|
+
dominantBaseline: "central",
|
|
312
|
+
children: label2
|
|
313
|
+
},
|
|
314
|
+
a
|
|
315
|
+
);
|
|
316
|
+
})
|
|
317
|
+
] }),
|
|
318
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { stroke: "#ffb000", strokeWidth: "4", strokeLinecap: "round", children: [45, 135, 225, 315].map((a) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: tickPath(192, 178, a) }, a)) }),
|
|
319
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: `M ${CENTER} ${CENTER - 150} l -9 -26 h 18 z`, fill: "#ffb000" }),
|
|
320
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
321
|
+
"path",
|
|
250
322
|
{
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
},
|
|
261
|
-
a
|
|
262
|
-
);
|
|
263
|
-
})
|
|
264
|
-
] }),
|
|
265
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { stroke: "#ffb000", strokeWidth: "4", strokeLinecap: "round", children: [45, 135, 225, 315].map((a) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: tickPath(192, 178, a) }, a)) }),
|
|
266
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: `M ${CENTER} ${CENTER - 150} l -9 -26 h 18 z`, fill: "#ffb000" }),
|
|
267
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
268
|
-
"path",
|
|
269
|
-
{
|
|
270
|
-
d: "M200 135 c6 0 8 8 8 16 v30 l52 18 v12 l-52 -8 v34 l18 12 v10 l-26 -6 l-26 6 v-10 l18 -12 v-34 l-52 8 v-12 l52 -18 v-30 c0 -8 2 -16 8 -16 z",
|
|
271
|
-
fill: "#ffb000",
|
|
272
|
-
stroke: "#000",
|
|
273
|
-
strokeWidth: "2"
|
|
274
|
-
}
|
|
275
|
-
)
|
|
276
|
-
] });
|
|
323
|
+
d: "M200 135 c6 0 8 8 8 16 v30 l52 18 v12 l-52 -8 v34 l18 12 v10 l-26 -6 l-26 6 v-10 l18 -12 v-34 l-52 8 v-12 l52 -18 v-30 c0 -8 2 -16 8 -16 z",
|
|
324
|
+
fill: "#ffb000",
|
|
325
|
+
stroke: "#000",
|
|
326
|
+
strokeWidth: "2"
|
|
327
|
+
}
|
|
328
|
+
)
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
);
|
|
277
332
|
}
|
|
278
333
|
|
|
279
334
|
// src/components/Airspeed.tsx
|
|
@@ -322,25 +377,33 @@ function Altimeter({ altitude = 0, pressure, pressureUnit = "hPa", ...props }) {
|
|
|
322
377
|
const alt = finite(altitude);
|
|
323
378
|
const qnh = finite(pressure, STANDARD[pressureUnit]);
|
|
324
379
|
const qnhText = pressureUnit === "inHg" ? qnh.toFixed(2) : Math.round(qnh).toString();
|
|
325
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
381
|
+
InstrumentFrame,
|
|
382
|
+
{
|
|
383
|
+
...props,
|
|
384
|
+
label: `Altimeter: ${Math.round(alt)} feet, ${qnhText} ${pressureUnit}`,
|
|
385
|
+
knobs: [{ id: "baro", label: "BARO", position: "bottom-left", angle: Math.round((qnh - STANDARD[pressureUnit]) * (pressureUnit === "inHg" ? 3e4 : 1e3)) / 100 }],
|
|
386
|
+
children: [
|
|
387
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 49, 1).map((i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: tickPath(178, i % 5 === 0 ? 150 : 164, i * 7.2), strokeWidth: i % 5 === 0 ? 4 : 2 }, i)) }),
|
|
388
|
+
range(0, 9, 1).map((n) => {
|
|
389
|
+
const [x, y] = polar(126, n * 36);
|
|
390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x, y, fill: "#fff", fontSize: "32", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: n }, n);
|
|
391
|
+
}),
|
|
392
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x: CENTER, y: CENTER - 58, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: "ALT" }),
|
|
393
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x: CENTER, y: CENTER - 40, fill: "#ccc", fontSize: "12", textAnchor: "middle", children: "100 FEET" }),
|
|
394
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: CENTER + 30, y: CENTER - 16, width: "74", height: "32", rx: "4", fill: "#000", stroke: "#666", strokeWidth: "2" }),
|
|
395
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { "data-testid": "altimeter-pressure", x: CENTER + 67, y: CENTER + 1, fill: "#fff", fontSize: "20", fontFamily: "monospace", textAnchor: "middle", dominantBaseline: "central", children: qnhText }),
|
|
396
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x: CENTER + 67, y: CENTER + 30, fill: "#ccc", fontSize: "12", textAnchor: "middle", children: pressureUnit }),
|
|
397
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("g", { "data-testid": "altimeter-10000", style: motionStyle(`rotate(${alt / 1e5 * 360}deg)`, duration), children: [
|
|
398
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: `M ${CENTER} ${CENTER} L ${CENTER} ${CENTER - 150}`, stroke: "#fff", strokeWidth: "3" }),
|
|
399
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: `M ${CENTER} ${CENTER - 178} l -10 22 h 20 z`, fill: "#fff" })
|
|
400
|
+
] }),
|
|
401
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { "data-testid": "altimeter-1000", style: motionStyle(`rotate(${alt / 1e4 * 360}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: `M ${CENTER - 9} ${CENTER + 14} L ${CENTER - 12} ${CENTER - 70} L ${CENTER} ${CENTER - 100} L ${CENTER + 12} ${CENTER - 70} L ${CENTER + 9} ${CENTER + 14} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1.5" }) }),
|
|
402
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { "data-testid": "altimeter-100", style: motionStyle(`rotate(${alt / 1e3 * 360}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: `M ${CENTER - 5} ${CENTER + 30} L ${CENTER - 4} ${CENTER - 140} L ${CENTER} ${CENTER - 168} L ${CENTER + 4} ${CENTER - 140} L ${CENTER + 5} ${CENTER + 30} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1.5" }) }),
|
|
403
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hub, {})
|
|
404
|
+
]
|
|
405
|
+
}
|
|
406
|
+
);
|
|
344
407
|
}
|
|
345
408
|
|
|
346
409
|
// src/components/VerticalSpeed.tsx
|
|
@@ -668,7 +731,7 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ne
|
|
|
668
731
|
const needleAngle = -(dev / FULL_SCALE_DEG) * SWING_FULL_SCALE_DEG;
|
|
669
732
|
const devText = Math.abs(dev) < 0.05 ? "centred" : `${Math.abs(dev).toFixed(1)}\xB0 ${dev > 0 ? "right" : "left"}`;
|
|
670
733
|
const label2 = signal ? `VOR indicator: course ${courseText}\xB0, needle ${devText}, ${flag === "OFF" ? "no TO/FROM indication" : flag}` : `VOR indicator: course ${courseText}\xB0, no signal`;
|
|
671
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(InstrumentFrame, { ...props, label: label2, knobs: [{ id: "obs", label: "OBS", position: "bottom-left", angle: crs }], children: [
|
|
672
735
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { "data-testid": "vor-card", style: motionStyle(`rotate(${-displayCourse}deg)`, duration), children: [
|
|
673
736
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
|
|
674
737
|
range(0, 330, 30).map((a) => {
|
|
@@ -868,7 +931,7 @@ function IlsIndicator({
|
|
|
868
931
|
const label2 = signal ? `ILS indicator: course ${courseText}\xB0, course needle ${devText}, ${gsText}, ${flag === "OFF" ? "no TO/FROM indication" : flag}` : `ILS indicator: course ${courseText}\xB0, no NAV signal, ${gsText}`;
|
|
869
932
|
const clipId = useSvgId("fi-ils-clip");
|
|
870
933
|
const dots = range(1, 5, 1).flatMap((i) => [-i, i]);
|
|
871
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(InstrumentFrame, { ...props, label: label2, knobs: [{ id: "obs", label: "OBS", position: "bottom-left", angle: crs }], children: [
|
|
872
935
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { "data-testid": "ils-card", style: motionStyle(`rotate(${-displayCourse}deg)`, duration), children: [
|
|
873
936
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("g", { stroke: "#eee", strokeLinecap: "butt", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: tickPath(170, a % 10 === 0 ? 154 : 162, a), strokeWidth: a % 10 === 0 ? 4 : 2.5 }, a)) }),
|
|
874
937
|
range(0, 330, 30).map((a) => {
|
|
@@ -931,25 +994,195 @@ function IlsIndicator({
|
|
|
931
994
|
] }),
|
|
932
995
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FlagWindow, { x: CENTER, y: CENTER + FLAG_OFFSET, axis: "h", visible: !signal, testId: "ils-nav-flag" }),
|
|
933
996
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FlagWindow, { x: CENTER + FLAG_OFFSET, y: CENTER, axis: "v", visible: !hasGs, testId: "ils-gs-flag" }),
|
|
934
|
-
swing && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: GS_PIVOT_X, cy: CENTER, r: "7", fill: "#1a1a1a", stroke: "#555", strokeWidth: "2" })
|
|
935
|
-
props.showBox !== false && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { "data-testid": "ils-obs", children: [
|
|
936
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: 44, cy: 356, r: "30", fill: "#1a1a1a", stroke: "#000", strokeWidth: "2" }),
|
|
937
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: 44, cy: 356, r: "24", fill: "#2a2a2a", stroke: "#ddd", strokeWidth: "2" }),
|
|
938
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("text", { x: 44, y: 356, fill: "#eee", fontSize: "13", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "OBS" })
|
|
939
|
-
] })
|
|
997
|
+
swing && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: GS_PIVOT_X, cy: CENTER, r: "7", fill: "#1a1a1a", stroke: "#555", strokeWidth: "2" })
|
|
940
998
|
] });
|
|
941
999
|
}
|
|
942
1000
|
|
|
943
|
-
// src/components/
|
|
1001
|
+
// src/components/HsiIndicator.tsx
|
|
944
1002
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
945
1003
|
var CARDINALS5 = { 0: "N", 90: "E", 180: "S", 270: "W" };
|
|
946
1004
|
var AMBER3 = "#ffb000";
|
|
1005
|
+
var COURSE = "#e6d930";
|
|
1006
|
+
var BUG = "#ff7a1a";
|
|
1007
|
+
var FLAG2 = "#e0342a";
|
|
1008
|
+
var DOT_SPACING3 = 36;
|
|
1009
|
+
var FULL_SCALE_PX3 = DOT_SPACING3 * 2;
|
|
1010
|
+
var BAR_HALF = 58;
|
|
1011
|
+
var GS_X = 108;
|
|
1012
|
+
var GS_DOT_SPACING = 24;
|
|
1013
|
+
var GS_FULL_SCALE_PX = GS_DOT_SPACING * 2;
|
|
1014
|
+
var norm4 = (deg2) => (deg2 % 360 + 360) % 360;
|
|
1015
|
+
var round22 = (n) => Math.round(n * 100) / 100 + 0;
|
|
1016
|
+
var pad3 = (deg2) => String(Math.round(norm4(deg2)) % 360 || 360).padStart(3, "0");
|
|
1017
|
+
function WarningFlag({ x, y, text, visible, testId, vertical }) {
|
|
1018
|
+
const [w, h] = vertical ? [20, 46] : [44, 20];
|
|
1019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { "data-testid": testId, opacity: visible ? 1 : 0, style: { transition: "opacity 200ms ease-out" }, children: [
|
|
1020
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", { x: x - w / 2, y: y - h / 2, width: w, height: h, rx: "2", fill: FLAG2, stroke: "#000", strokeWidth: "1.5" }),
|
|
1021
|
+
vertical ? text.split("").map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x, y: y + (i - (text.length - 1) / 2) * 15, fill: "#111", fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: c }, i)) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x, y, fill: "#111", fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: text })
|
|
1022
|
+
] });
|
|
1023
|
+
}
|
|
1024
|
+
function GlideslopeScale({ side, y, visible, duration }) {
|
|
1025
|
+
const x = CENTER + side * GS_X;
|
|
1026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { children: [
|
|
1027
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { fill: "none", stroke: "#eee", strokeWidth: "2", children: [-2, -1, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: x, cy: CENTER + i * GS_DOT_SPACING, r: "4.5" }, i)) }),
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: `M ${x - 7} ${CENTER} h 14`, stroke: "#eee", strokeWidth: "3", strokeLinecap: "round" }),
|
|
1029
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1030
|
+
"g",
|
|
1031
|
+
{
|
|
1032
|
+
"data-testid": side > 0 ? "hsi-gs-pointer" : "hsi-gs-pointer-left",
|
|
1033
|
+
opacity: visible ? 1 : 0,
|
|
1034
|
+
style: { ...motionStyle(`translate(0px, ${y}px)`, duration), transition: duration > 0 ? `transform ${duration}ms ease-out, opacity 200ms ease-out` : "opacity 200ms ease-out" },
|
|
1035
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: `M ${x - side * 7} ${CENTER} l ${side * 15} -9 v 18 z`, fill: "#3ddc84", stroke: "#000", strokeWidth: "1.5", strokeLinejoin: "round" })
|
|
1036
|
+
}
|
|
1037
|
+
)
|
|
1038
|
+
] });
|
|
1039
|
+
}
|
|
1040
|
+
function HsiIndicator({
|
|
1041
|
+
heading = 0,
|
|
1042
|
+
headingBug,
|
|
1043
|
+
course = 0,
|
|
1044
|
+
radial,
|
|
1045
|
+
deviation,
|
|
1046
|
+
fullScale = 10,
|
|
1047
|
+
toFrom,
|
|
1048
|
+
signal = true,
|
|
1049
|
+
glideslope,
|
|
1050
|
+
glideslopeFullScale = 0.7,
|
|
1051
|
+
glideslopeSignal,
|
|
1052
|
+
...props
|
|
1053
|
+
}) {
|
|
1054
|
+
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
1055
|
+
const hdg = finite(heading);
|
|
1056
|
+
const crs = finite(course);
|
|
1057
|
+
const hasBug = typeof headingBug === "number" && Number.isFinite(headingBug);
|
|
1058
|
+
const bug = hasBug ? headingBug : 0;
|
|
1059
|
+
const computed = typeof radial === "number" && Number.isFinite(radial) ? vorDeviation(crs, radial) : void 0;
|
|
1060
|
+
const locScale = finite(fullScale, 10) > 0 ? finite(fullScale, 10) : 10;
|
|
1061
|
+
const gsScale = finite(glideslopeFullScale, 0.7) > 0 ? finite(glideslopeFullScale, 0.7) : 0.7;
|
|
1062
|
+
const dev = signal ? clamp(finite(deviation, computed?.deviation ?? 0), -locScale, locScale) : 0;
|
|
1063
|
+
const flag = !signal ? "OFF" : toFrom ?? computed?.toFrom ?? "OFF";
|
|
1064
|
+
const hasGs = glideslopeSignal ?? (typeof glideslope === "number" && Number.isFinite(glideslope));
|
|
1065
|
+
const gs = hasGs ? clamp(finite(glideslope), -gsScale, gsScale) : 0;
|
|
1066
|
+
const barX = round22(dev / locScale * FULL_SCALE_PX3);
|
|
1067
|
+
const gsY = round22(-(gs / gsScale) * GS_FULL_SCALE_PX);
|
|
1068
|
+
const displayHeading = useContinuousAngle(hdg);
|
|
1069
|
+
const displayCourse = useContinuousAngle(crs);
|
|
1070
|
+
const displayBug = useContinuousAngle(bug);
|
|
1071
|
+
const devText = Math.abs(dev) < 0.05 ? "centred" : `${Math.abs(dev).toFixed(1)}\xB0 ${dev > 0 ? "right" : "left"}`;
|
|
1072
|
+
const gsText = !hasGs ? "glideslope off" : Math.abs(gs) < 5e-3 ? "glideslope centred" : `glideslope ${Math.abs(gs).toFixed(2)}\xB0 ${gs > 0 ? "up" : "down"}`;
|
|
1073
|
+
const navText = signal ? `course bar ${devText}, ${flag === "OFF" ? "no TO/FROM indication" : flag}` : "no NAV signal";
|
|
1074
|
+
const label2 = `HSI: heading ${pad3(hdg)}\xB0, course ${pad3(crs)}\xB0, ${navText}, ${gsText}${hasBug ? `, heading bug ${pad3(bug)}\xB0` : ""}`;
|
|
1075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1076
|
+
InstrumentFrame,
|
|
1077
|
+
{
|
|
1078
|
+
...props,
|
|
1079
|
+
label: label2,
|
|
1080
|
+
knobs: [
|
|
1081
|
+
{ id: "crs", label: "CRS", position: "bottom-left", angle: crs },
|
|
1082
|
+
{ id: "hdg", label: "HDG", position: "bottom-right", angle: bug }
|
|
1083
|
+
],
|
|
1084
|
+
children: [
|
|
1085
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { "data-testid": "hsi-card", style: motionStyle(`rotate(${-displayHeading}deg)`, duration), children: [
|
|
1086
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { stroke: "#eee", strokeLinecap: "butt", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: tickPath(172, a % 10 === 0 ? 154 : 163, a), strokeWidth: a % 10 === 0 ? 3.5 : 2 }, a)) }),
|
|
1087
|
+
range(0, 330, 30).map((a) => {
|
|
1088
|
+
const [x, y] = polar(138, a);
|
|
1089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1090
|
+
"text",
|
|
1091
|
+
{
|
|
1092
|
+
x,
|
|
1093
|
+
y,
|
|
1094
|
+
transform: `rotate(${a} ${x} ${y})`,
|
|
1095
|
+
fill: "#eee",
|
|
1096
|
+
fontSize: a % 90 === 0 ? 24 : 21,
|
|
1097
|
+
fontWeight: "bold",
|
|
1098
|
+
textAnchor: "middle",
|
|
1099
|
+
dominantBaseline: "central",
|
|
1100
|
+
children: CARDINALS5[a] ?? String(a / 10)
|
|
1101
|
+
},
|
|
1102
|
+
a
|
|
1103
|
+
);
|
|
1104
|
+
}),
|
|
1105
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { "data-testid": "hsi-heading-bug", opacity: hasBug ? 1 : 0, style: motionStyle(`rotate(${displayBug}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1106
|
+
"path",
|
|
1107
|
+
{
|
|
1108
|
+
d: `M ${CENTER - 13} ${CENTER - 182} h 26 v 20 h -7 l -6 -8 l -6 8 h -7 z`,
|
|
1109
|
+
fill: BUG,
|
|
1110
|
+
stroke: "#000",
|
|
1111
|
+
strokeWidth: "1.5",
|
|
1112
|
+
strokeLinejoin: "round"
|
|
1113
|
+
}
|
|
1114
|
+
) }),
|
|
1115
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { "data-testid": "hsi-course", style: motionStyle(`rotate(${displayCourse}deg)`, duration), children: [
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { fill: "none", stroke: "#eee", strokeWidth: "2.5", children: [-2, -1, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: CENTER + i * DOT_SPACING3, cy: CENTER, r: "6" }, i)) }),
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1118
|
+
"path",
|
|
1119
|
+
{
|
|
1120
|
+
d: `M ${CENTER} ${CENTER - 126} l 13 24 h -8 v 40 h -10 v -40 h -8 z`,
|
|
1121
|
+
fill: COURSE,
|
|
1122
|
+
stroke: "#000",
|
|
1123
|
+
strokeWidth: "1.5",
|
|
1124
|
+
strokeLinejoin: "round"
|
|
1125
|
+
}
|
|
1126
|
+
),
|
|
1127
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", { x: CENTER - 5, y: CENTER + 62, width: "10", height: "58", fill: COURSE, stroke: "#000", strokeWidth: "1.5" }),
|
|
1128
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { "data-testid": "hsi-cdi", style: motionStyle(`translate(${barX}px, 0px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", { x: CENTER - 5, y: CENTER - BAR_HALF, width: "10", height: BAR_HALF * 2, fill: COURSE, stroke: "#000", strokeWidth: "1.5" }) }),
|
|
1129
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1130
|
+
"path",
|
|
1131
|
+
{
|
|
1132
|
+
"data-testid": "hsi-to",
|
|
1133
|
+
d: `M ${CENTER + 26} ${CENTER - 58} l 11 18 h -22 z`,
|
|
1134
|
+
fill: "#eee",
|
|
1135
|
+
stroke: "#000",
|
|
1136
|
+
strokeWidth: "1.5",
|
|
1137
|
+
opacity: flag === "TO" ? 1 : 0,
|
|
1138
|
+
style: { transition: "opacity 200ms ease-out" }
|
|
1139
|
+
}
|
|
1140
|
+
),
|
|
1141
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1142
|
+
"path",
|
|
1143
|
+
{
|
|
1144
|
+
"data-testid": "hsi-from",
|
|
1145
|
+
d: `M ${CENTER + 26} ${CENTER + 58} l 11 -18 h -22 z`,
|
|
1146
|
+
fill: "#eee",
|
|
1147
|
+
stroke: "#000",
|
|
1148
|
+
strokeWidth: "1.5",
|
|
1149
|
+
opacity: flag === "FROM" ? 1 : 0,
|
|
1150
|
+
style: { transition: "opacity 200ms ease-out" }
|
|
1151
|
+
}
|
|
1152
|
+
)
|
|
1153
|
+
] })
|
|
1154
|
+
] }),
|
|
1155
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { stroke: AMBER3, strokeWidth: "4", strokeLinecap: "round", children: [45, 135, 225, 315].map((a) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: tickPath(192, 180, a) }, a)) }),
|
|
1156
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: `M ${CENTER} ${CENTER - 156} l -9 -24 h 18 z`, fill: AMBER3, stroke: "#000", strokeWidth: "1" }),
|
|
1157
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1158
|
+
"path",
|
|
1159
|
+
{
|
|
1160
|
+
d: `M ${CENTER} ${CENTER - 30} c 4 0 5 5 5 10 v 14 l 25 9 v 7 l -25 -3 v 16 l 10 6 v 6 l -15 -3 l -15 3 v -6 l 10 -6 v -16 l -25 3 v -7 l 25 -9 v -14 c 0 -5 1 -10 5 -10 z`,
|
|
1161
|
+
fill: AMBER3,
|
|
1162
|
+
stroke: "#000",
|
|
1163
|
+
strokeWidth: "1.5",
|
|
1164
|
+
strokeLinejoin: "round"
|
|
1165
|
+
}
|
|
1166
|
+
),
|
|
1167
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GlideslopeScale, { side: -1, y: gsY, visible: hasGs, duration }),
|
|
1168
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GlideslopeScale, { side: 1, y: gsY, visible: hasGs, duration }),
|
|
1169
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(WarningFlag, { x: CENTER + GS_X, y: CENTER, text: "GS", visible: !hasGs, testId: "hsi-gs-flag", vertical: true }),
|
|
1170
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(WarningFlag, { x: CENTER - 62, y: CENTER - 84, text: "NAV", visible: !signal, testId: "hsi-nav-flag" })
|
|
1171
|
+
]
|
|
1172
|
+
}
|
|
1173
|
+
);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
// src/components/AdfIndicator.tsx
|
|
1177
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1178
|
+
var CARDINALS6 = { 0: "N", 90: "E", 180: "S", 270: "W" };
|
|
1179
|
+
var AMBER4 = "#ffb000";
|
|
947
1180
|
var NEEDLE = "#ffe14d";
|
|
948
1181
|
var PARKED_DEG = 90;
|
|
949
|
-
var
|
|
950
|
-
var
|
|
1182
|
+
var norm5 = (deg2) => (deg2 % 360 + 360) % 360;
|
|
1183
|
+
var pad32 = (deg2) => String(Math.round(norm5(deg2)) % 360).padStart(3, "0");
|
|
951
1184
|
function relativeBearing(heading, bearingToStation) {
|
|
952
|
-
return
|
|
1185
|
+
return norm5(finite(bearingToStation) - finite(heading));
|
|
953
1186
|
}
|
|
954
1187
|
function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
|
|
955
1188
|
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
@@ -957,41 +1190,41 @@ function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
|
|
|
957
1190
|
const hdg = finite(heading);
|
|
958
1191
|
const displayCard = useContinuousAngle(hdg);
|
|
959
1192
|
const displayNeedle = useContinuousAngle(signal ? rel : PARKED_DEG);
|
|
960
|
-
const label2 = signal ? `ADF indicator: station ${
|
|
961
|
-
return /* @__PURE__ */ (0,
|
|
962
|
-
/* @__PURE__ */ (0,
|
|
963
|
-
/* @__PURE__ */ (0,
|
|
1193
|
+
const label2 = signal ? `ADF indicator: station ${pad32(rel)}\xB0 relative, bearing ${pad32(rel + hdg)}\xB0 to station` : "ADF indicator: no signal";
|
|
1194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(InstrumentFrame, { ...props, label: label2, knobs: [{ id: "hdg", label: "HDG", position: "bottom-left", angle: hdg }], children: [
|
|
1195
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { "data-testid": "adf-card", style: motionStyle(`rotate(${-displayCard}deg)`, duration), children: [
|
|
1196
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
|
|
964
1197
|
range(0, 330, 30).map((a) => {
|
|
965
1198
|
const [x, y] = polar(132, a);
|
|
966
|
-
return /* @__PURE__ */ (0,
|
|
1199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
967
1200
|
"text",
|
|
968
1201
|
{
|
|
969
1202
|
x,
|
|
970
1203
|
y,
|
|
971
1204
|
transform: `rotate(${a} ${x} ${y})`,
|
|
972
|
-
fill: a % 90 === 0 ?
|
|
1205
|
+
fill: a % 90 === 0 ? AMBER4 : "#fff",
|
|
973
1206
|
fontSize: a % 90 === 0 ? 28 : 24,
|
|
974
1207
|
fontWeight: "bold",
|
|
975
1208
|
textAnchor: "middle",
|
|
976
1209
|
dominantBaseline: "central",
|
|
977
|
-
children:
|
|
1210
|
+
children: CARDINALS6[a] ?? String(a / 10)
|
|
978
1211
|
},
|
|
979
1212
|
a
|
|
980
1213
|
);
|
|
981
1214
|
})
|
|
982
1215
|
] }),
|
|
983
|
-
/* @__PURE__ */ (0,
|
|
984
|
-
/* @__PURE__ */ (0,
|
|
985
|
-
/* @__PURE__ */ (0,
|
|
986
|
-
/* @__PURE__ */ (0,
|
|
987
|
-
/* @__PURE__ */ (0,
|
|
1216
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: `M ${CENTER} ${CENTER - 150} l -10 -28 h 20 z`, fill: AMBER4, stroke: "#000", strokeWidth: "1.5" }),
|
|
1217
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("g", { stroke: AMBER4, strokeWidth: "4", strokeLinecap: "round", children: [45, 90, 135, 180, 225, 270, 315].map((a) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: tickPath(192, 178, a) }, a)) }),
|
|
1218
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { stroke: AMBER4, strokeWidth: "2", strokeLinecap: "round", opacity: "0.7", children: [
|
|
1219
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: `M ${CENTER - 26} ${CENTER} H ${CENTER + 26}` }),
|
|
1220
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: `M ${CENTER} ${CENTER - 26} V ${CENTER + 14}` })
|
|
988
1221
|
] }),
|
|
989
|
-
/* @__PURE__ */ (0,
|
|
990
|
-
/* @__PURE__ */ (0,
|
|
991
|
-
/* @__PURE__ */ (0,
|
|
992
|
-
/* @__PURE__ */ (0,
|
|
1222
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("text", { x: CENTER, y: CENTER + 62, fill: "#ccc", fontSize: "15", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: "ADF" }),
|
|
1223
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { "data-testid": "adf-flag", opacity: signal ? 0 : 1, style: { transition: "opacity 200ms ease-out" }, children: [
|
|
1224
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("rect", { x: CENTER - 28, y: CENTER - 76, width: "56", height: "24", rx: "3", fill: "#d42626", stroke: "#000", strokeWidth: "1.5" }),
|
|
1225
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("text", { x: CENTER, y: CENTER - 63, fill: "#fff", fontSize: "15", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "ADF" })
|
|
993
1226
|
] }),
|
|
994
|
-
/* @__PURE__ */ (0,
|
|
1227
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("g", { "data-testid": "adf-needle", style: motionStyle(`rotate(${displayNeedle}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
995
1228
|
"path",
|
|
996
1229
|
{
|
|
997
1230
|
d: `M ${CENTER} ${CENTER - 146} l -13 30 h 9 V ${CENTER + 140} h 8 V ${CENTER - 116} h 9 z`,
|
|
@@ -1001,12 +1234,12 @@ function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
|
|
|
1001
1234
|
strokeLinejoin: "round"
|
|
1002
1235
|
}
|
|
1003
1236
|
) }),
|
|
1004
|
-
/* @__PURE__ */ (0,
|
|
1237
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Hub, { r: 10 })
|
|
1005
1238
|
] });
|
|
1006
1239
|
}
|
|
1007
1240
|
|
|
1008
1241
|
// src/components/RadioPanel.tsx
|
|
1009
|
-
var
|
|
1242
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1010
1243
|
var SIDE = 252;
|
|
1011
1244
|
var ORIGIN = CENTER - SIDE / 2;
|
|
1012
1245
|
var ROW_H = 60;
|
|
@@ -1023,9 +1256,9 @@ var formatAdf = (khz) => usable(khz) ? Number.isInteger(khz) ? String(khz) : khz
|
|
|
1023
1256
|
var formatDme = (nm) => usable(nm) ? nm < 99.95 ? nm.toFixed(1) : nm.toFixed(0) : "--.-";
|
|
1024
1257
|
function Display({ x, y, width, value, color, testId, unit }) {
|
|
1025
1258
|
const h = ROW_H - 16;
|
|
1026
|
-
return /* @__PURE__ */ (0,
|
|
1027
|
-
/* @__PURE__ */ (0,
|
|
1028
|
-
/* @__PURE__ */ (0,
|
|
1259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { children: [
|
|
1260
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { x, y: y + 8, width, height: h, rx: "5", fill: "#1a0d00", stroke: "#3a2a14", strokeWidth: "1.5" }),
|
|
1261
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1029
1262
|
"text",
|
|
1030
1263
|
{
|
|
1031
1264
|
"data-testid": testId,
|
|
@@ -1040,18 +1273,18 @@ function Display({ x, y, width, value, color, testId, unit }) {
|
|
|
1040
1273
|
children: value
|
|
1041
1274
|
}
|
|
1042
1275
|
),
|
|
1043
|
-
unit && /* @__PURE__ */ (0,
|
|
1276
|
+
unit && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("text", { x: x + width - 10, y: y + ROW_H / 2 + 5, fill: "#9aa4b1", fontSize: "13", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: unit })
|
|
1044
1277
|
] });
|
|
1045
1278
|
}
|
|
1046
1279
|
function Swap({ y }) {
|
|
1047
1280
|
const cy = y + ROW_H / 2;
|
|
1048
|
-
return /* @__PURE__ */ (0,
|
|
1049
|
-
/* @__PURE__ */ (0,
|
|
1050
|
-
/* @__PURE__ */ (0,
|
|
1281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { stroke: "#9aa4b1", strokeWidth: "1.8", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1282
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: `M ${SWAP_X - 7} ${cy - 4} H ${SWAP_X + 7} m -4 -3 l 4 3 l -4 3` }),
|
|
1283
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: `M ${SWAP_X + 7} ${cy + 4} H ${SWAP_X - 7} m 4 -3 l -4 3 l 4 3` })
|
|
1051
1284
|
] });
|
|
1052
1285
|
}
|
|
1053
1286
|
function RowLabel({ y, children }) {
|
|
1054
|
-
return /* @__PURE__ */ (0,
|
|
1287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("text", { x: LABEL_X, y: y + ROW_H / 2 + 1, fill: "#ccc", fontSize: "14", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children });
|
|
1055
1288
|
}
|
|
1056
1289
|
function RadioPanel({ nav, adf, dme, color = "#ff9a2e", ...props }) {
|
|
1057
1290
|
const rows = [
|
|
@@ -1061,29 +1294,29 @@ function RadioPanel({ nav, adf, dme, color = "#ff9a2e", ...props }) {
|
|
|
1061
1294
|
const dmeText = formatDme(dme);
|
|
1062
1295
|
const dmeY = FIRST_ROW + 2 * (ROW_H + ROW_GAP);
|
|
1063
1296
|
const label2 = "Radio panel: " + rows.map((r) => `${r.name} ${r.tuned ? `${r.active} ${r.unit}` : "not tuned"}`).join(", ") + `, DME ${usable(dme) ? `${dmeText} NM` : "no distance"}`;
|
|
1064
|
-
return /* @__PURE__ */ (0,
|
|
1065
|
-
/* @__PURE__ */ (0,
|
|
1066
|
-
/* @__PURE__ */ (0,
|
|
1067
|
-
/* @__PURE__ */ (0,
|
|
1068
|
-
/* @__PURE__ */ (0,
|
|
1297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
1298
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { x: ORIGIN, y: ORIGIN, width: SIDE, height: SIDE, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
1299
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { fill: "#9aa4b1", fontSize: "11", fontWeight: "bold", letterSpacing: "1.5", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("text", { x: ACTIVE_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "ACTIVE" }),
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("text", { x: STANDBY_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "STBY" })
|
|
1069
1302
|
] }),
|
|
1070
1303
|
rows.map((r, i) => {
|
|
1071
1304
|
const y = FIRST_ROW + i * (ROW_H + ROW_GAP);
|
|
1072
|
-
return /* @__PURE__ */ (0,
|
|
1073
|
-
/* @__PURE__ */ (0,
|
|
1074
|
-
/* @__PURE__ */ (0,
|
|
1075
|
-
/* @__PURE__ */ (0,
|
|
1076
|
-
/* @__PURE__ */ (0,
|
|
1305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { children: [
|
|
1306
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RowLabel, { y, children: r.name }),
|
|
1307
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Display, { x: ACTIVE_X, y, width: DISPLAY_W, value: r.active, color, testId: `radio-${r.key}-active` }),
|
|
1308
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Swap, { y }),
|
|
1309
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Display, { x: STANDBY_X, y, width: DISPLAY_W, value: r.standby, color, testId: `radio-${r.key}-standby` })
|
|
1077
1310
|
] }, r.key);
|
|
1078
1311
|
}),
|
|
1079
|
-
/* @__PURE__ */ (0,
|
|
1080
|
-
/* @__PURE__ */ (0,
|
|
1312
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RowLabel, { y: dmeY, children: "DME" }),
|
|
1313
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Display, { x: ACTIVE_X, y: dmeY, width: STANDBY_X + DISPLAY_W - ACTIVE_X, value: dmeText, color, testId: "radio-dme", unit: "NM" })
|
|
1081
1314
|
] });
|
|
1082
1315
|
}
|
|
1083
1316
|
|
|
1084
1317
|
// src/components/RadioStack.tsx
|
|
1085
1318
|
var import_react2 = require("react");
|
|
1086
|
-
var
|
|
1319
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1087
1320
|
var parseNav = (text) => {
|
|
1088
1321
|
const mhz = Math.round(Number.parseFloat(text.replace(",", ".")) * 100) / 100;
|
|
1089
1322
|
return mhz >= 108 && mhz <= 117.95 ? mhz : void 0;
|
|
@@ -1116,9 +1349,9 @@ var display = {
|
|
|
1116
1349
|
var label = { display: "flex", flexDirection: "column", justifyContent: "center", color: LABEL, fontWeight: "bold", letterSpacing: "0.06em", lineHeight: 1.15 };
|
|
1117
1350
|
var ident = { color: "#3cc8ff", fontSize: "0.72em", fontFamily: MONO, minHeight: "1.15em" };
|
|
1118
1351
|
function SwapIcon() {
|
|
1119
|
-
return /* @__PURE__ */ (0,
|
|
1120
|
-
/* @__PURE__ */ (0,
|
|
1121
|
-
/* @__PURE__ */ (0,
|
|
1352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1353
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M2 5.5 H14 M11 2.5 l3 3 l-3 3" }),
|
|
1354
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M14 10.5 H2 M5 7.5 l-3 3 l3 3" })
|
|
1122
1355
|
] });
|
|
1123
1356
|
}
|
|
1124
1357
|
function Receiver({ name, unit, value, ident: station, color, format, parse, onChange }) {
|
|
@@ -1152,13 +1385,13 @@ function Receiver({ name, unit, value, ident: station, color, format, parse, onC
|
|
|
1152
1385
|
if (text && standby === void 0 || standby === value.standby) return;
|
|
1153
1386
|
onChange({ active: value.active, standby });
|
|
1154
1387
|
};
|
|
1155
|
-
return /* @__PURE__ */ (0,
|
|
1156
|
-
/* @__PURE__ */ (0,
|
|
1157
|
-
/* @__PURE__ */ (0,
|
|
1158
|
-
/* @__PURE__ */ (0,
|
|
1388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: label, children: [
|
|
1390
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: name }),
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "data-testid": `radio-stack-${key}-ident`, style: ident, children: station ?? "" })
|
|
1159
1392
|
] }),
|
|
1160
|
-
/* @__PURE__ */ (0,
|
|
1161
|
-
/* @__PURE__ */ (0,
|
|
1393
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { "data-testid": `radio-stack-${key}-active`, "aria-label": `${name} active frequency`, style: { ...display, color }, children: format(value.active) }),
|
|
1394
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1162
1395
|
"button",
|
|
1163
1396
|
{
|
|
1164
1397
|
type: "button",
|
|
@@ -1166,10 +1399,10 @@ function Receiver({ name, unit, value, ident: station, color, format, parse, onC
|
|
|
1166
1399
|
"aria-label": `Swap ${name} active and standby`,
|
|
1167
1400
|
title: "Swap active and standby",
|
|
1168
1401
|
style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "2em", padding: 0, margin: 0, border: "0.08em solid #555", borderRadius: "0.3em", background: "#3a3a3a", color: "#ddd", font: "inherit", fontSize: "1.2em", cursor: "pointer" },
|
|
1169
|
-
children: /* @__PURE__ */ (0,
|
|
1402
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SwapIcon, {})
|
|
1170
1403
|
}
|
|
1171
1404
|
),
|
|
1172
|
-
/* @__PURE__ */ (0,
|
|
1405
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1173
1406
|
"input",
|
|
1174
1407
|
{
|
|
1175
1408
|
type: "text",
|
|
@@ -1231,7 +1464,7 @@ function RadioStack({
|
|
|
1231
1464
|
const heading = { color: MUTED, fontSize: "0.72em", fontWeight: "bold", letterSpacing: "0.12em", textAlign: "center" };
|
|
1232
1465
|
return (
|
|
1233
1466
|
// The outer box is a size container so every inner measurement can follow the width.
|
|
1234
|
-
/* @__PURE__ */ (0,
|
|
1467
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className, style: { display: "inline-block", width, maxWidth: "100%", verticalAlign: "top", containerType: "inline-size", ...style }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1235
1468
|
"div",
|
|
1236
1469
|
{
|
|
1237
1470
|
role: "group",
|
|
@@ -1254,20 +1487,20 @@ function RadioStack({
|
|
|
1254
1487
|
userSelect: "none"
|
|
1255
1488
|
},
|
|
1256
1489
|
children: [
|
|
1257
|
-
SCREWS2.map((position, i) => /* @__PURE__ */ (0,
|
|
1258
|
-
/* @__PURE__ */ (0,
|
|
1259
|
-
/* @__PURE__ */ (0,
|
|
1490
|
+
SCREWS2.map((position, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { viewBox: "-14 -14 28 28", "aria-hidden": "true", style: { position: "absolute", width: "0.75em", height: "0.75em", ...position }, children: [
|
|
1491
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { r: "12", fill: "#3a3a3a", stroke: "#111", strokeWidth: "2" }),
|
|
1492
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M -8 3 L 8 -3", stroke: "#111", strokeWidth: "3" })
|
|
1260
1493
|
] }, i)),
|
|
1261
|
-
/* @__PURE__ */ (0,
|
|
1262
|
-
/* @__PURE__ */ (0,
|
|
1263
|
-
/* @__PURE__ */ (0,
|
|
1264
|
-
/* @__PURE__ */ (0,
|
|
1265
|
-
/* @__PURE__ */ (0,
|
|
1266
|
-
/* @__PURE__ */ (0,
|
|
1267
|
-
/* @__PURE__ */ (0,
|
|
1268
|
-
/* @__PURE__ */ (0,
|
|
1269
|
-
/* @__PURE__ */ (0,
|
|
1270
|
-
/* @__PURE__ */ (0,
|
|
1494
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", {}),
|
|
1495
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: heading, children: "ACTIVE" }),
|
|
1496
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", {}),
|
|
1497
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: heading, children: "STBY" }),
|
|
1498
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Receiver, { name: "NAV", unit: "MHz", value: nav ?? innerNav, ident: navIdent, color, format: formatNav, parse: parseNav, onChange: changeNav }),
|
|
1499
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Receiver, { name: "ADF", unit: "kHz", value: adf ?? innerAdf, ident: adfIdent, color, format: formatAdf, parse: parseAdf, onChange: changeAdf }),
|
|
1500
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: label, children: "DME" }),
|
|
1501
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { "aria-label": "DME distance", style: { ...display, gridColumn: "span 3", display: "flex", alignItems: "baseline", justifyContent: "flex-end", gap: "0.4em", padding: "0 0.5em", color }, children: [
|
|
1502
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "data-testid": "radio-stack-dme", children: formatDme(dme) }),
|
|
1503
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { color: MUTED, fontFamily: "'Helvetica Neue', Arial, sans-serif", fontSize: "0.5em" }, children: "NM" })
|
|
1271
1504
|
] })
|
|
1272
1505
|
]
|
|
1273
1506
|
}
|
|
@@ -1276,7 +1509,7 @@ function RadioStack({
|
|
|
1276
1509
|
}
|
|
1277
1510
|
|
|
1278
1511
|
// src/components/DataPanel.tsx
|
|
1279
|
-
var
|
|
1512
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1280
1513
|
var MAX_FIELDS = 6;
|
|
1281
1514
|
var SIDE2 = 252;
|
|
1282
1515
|
var PAD = 8;
|
|
@@ -1296,9 +1529,9 @@ function DataPanel({ fields = [], heading, ...props }) {
|
|
|
1296
1529
|
const cellH = (SIDE2 - PAD * 2 - GAP * (rows - 1)) / rows;
|
|
1297
1530
|
const valueSize = VALUE_SIZE[rows] ?? 27;
|
|
1298
1531
|
const label2 = `${heading ?? "Data panel"}: ` + (shown.length ? shown.map((f) => `${f.name} ${formatValue(f)}${f.unit ? ` ${f.unit}` : ""}`).join(", ") : "no data");
|
|
1299
|
-
return /* @__PURE__ */ (0,
|
|
1300
|
-
heading && /* @__PURE__ */ (0,
|
|
1301
|
-
/* @__PURE__ */ (0,
|
|
1532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
1533
|
+
heading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: CENTER, y: ORIGIN2 - 14, fill: "#ccc", fontSize: "13", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: heading.toUpperCase() }),
|
|
1534
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: ORIGIN2, y: ORIGIN2, width: SIDE2, height: SIDE2, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
1302
1535
|
shown.map((f, i) => {
|
|
1303
1536
|
const col = i % cols;
|
|
1304
1537
|
const row = Math.floor(i / cols);
|
|
@@ -1306,10 +1539,10 @@ function DataPanel({ fields = [], heading, ...props }) {
|
|
|
1306
1539
|
const y = ORIGIN2 + PAD + row * (cellH + GAP);
|
|
1307
1540
|
const value = formatValue(f);
|
|
1308
1541
|
const fit = Math.min(valueSize, (cellW - 16) / (0.62 * Math.max(1, value.length)));
|
|
1309
|
-
return /* @__PURE__ */ (0,
|
|
1310
|
-
/* @__PURE__ */ (0,
|
|
1311
|
-
/* @__PURE__ */ (0,
|
|
1312
|
-
/* @__PURE__ */ (0,
|
|
1542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { "data-testid": `data-field-${i}`, children: [
|
|
1543
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x, y, width: cellW, height: cellH, rx: "6", fill: "#000", stroke: "#262a30", strokeWidth: "1" }),
|
|
1544
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: x + 8, y: y + 12, fill: "#9aa4b1", fontSize: "12", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children: f.name.toUpperCase() }),
|
|
1545
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1313
1546
|
"text",
|
|
1314
1547
|
{
|
|
1315
1548
|
"data-testid": `data-value-${i}`,
|
|
@@ -1324,14 +1557,14 @@ function DataPanel({ fields = [], heading, ...props }) {
|
|
|
1324
1557
|
children: value
|
|
1325
1558
|
}
|
|
1326
1559
|
),
|
|
1327
|
-
f.unit && /* @__PURE__ */ (0,
|
|
1560
|
+
f.unit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: x + cellW - 8, y: y + cellH - 12, fill: "#9aa4b1", fontSize: "12", textAnchor: "end", dominantBaseline: "central", children: f.unit })
|
|
1328
1561
|
] }, i);
|
|
1329
1562
|
})
|
|
1330
1563
|
] });
|
|
1331
1564
|
}
|
|
1332
1565
|
|
|
1333
1566
|
// src/components/FuelIndicator.tsx
|
|
1334
|
-
var
|
|
1567
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1335
1568
|
var MAX_TANKS = 4;
|
|
1336
1569
|
var GREEN2 = "#2ee05a";
|
|
1337
1570
|
var RED = "#ff3b3b";
|
|
@@ -1374,16 +1607,16 @@ function FuelIndicator({
|
|
|
1374
1607
|
return { name: t.name, qty, cap, fraction, full, isLow, text: full ? "FULL" : qty.toFixed(places) };
|
|
1375
1608
|
});
|
|
1376
1609
|
const title = `${label2}: ` + (readings.length ? readings.map((r) => `${r.name} ${r.full ? "full" : `${r.text} of ${r.cap.toFixed(places)} ${unit}`}${r.isLow ? " (low)" : ""}`).join(", ") : "no tanks");
|
|
1377
|
-
return /* @__PURE__ */ (0,
|
|
1378
|
-
/* @__PURE__ */ (0,
|
|
1610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(InstrumentFrame, { ...props, label: title, children: [
|
|
1611
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: ORIGIN3, y: ORIGIN3, width: SIDE3, height: SIDE3, rx: "10", fill: "#000", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
1379
1612
|
readings.map((r, i) => {
|
|
1380
1613
|
const cx = INNER_LEFT + colW * (i + 0.5);
|
|
1381
1614
|
const color = r.isLow ? RED : GREEN2;
|
|
1382
1615
|
const tickX = cx - barW / 2 - 14;
|
|
1383
|
-
return /* @__PURE__ */ (0,
|
|
1384
|
-
i > 0 && /* @__PURE__ */ (0,
|
|
1385
|
-
/* @__PURE__ */ (0,
|
|
1386
|
-
/* @__PURE__ */ (0,
|
|
1616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { "data-testid": `fuel-tank-${i}`, children: [
|
|
1617
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${INNER_LEFT + colW * i} ${ORIGIN3 + 10} V ${FOOTER_Y}`, stroke: "#555", strokeWidth: "1.5" }),
|
|
1618
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: cx, y: ORIGIN3 + 22, fill: "#fff", fontSize: Math.min(17, colW / 5), fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: r.name.toUpperCase() }),
|
|
1619
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { strokeWidth: "2.5", strokeLinecap: "round", children: [0, 0.25, 0.5, 0.75, 1].map((f) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1387
1620
|
"path",
|
|
1388
1621
|
{
|
|
1389
1622
|
d: `M ${tickX - 7} ${BAR_BOTTOM - f * BAR_H} h 7`,
|
|
@@ -1391,9 +1624,9 @@ function FuelIndicator({
|
|
|
1391
1624
|
},
|
|
1392
1625
|
f
|
|
1393
1626
|
)) }),
|
|
1394
|
-
/* @__PURE__ */ (0,
|
|
1395
|
-
/* @__PURE__ */ (0,
|
|
1396
|
-
/* @__PURE__ */ (0,
|
|
1627
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: "#15181c" }),
|
|
1628
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { "data-testid": `fuel-bar-${i}`, style: motionStyle(`scaleY(${r.fraction})`, duration, cx, BAR_BOTTOM), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: color }) }),
|
|
1629
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1397
1630
|
"text",
|
|
1398
1631
|
{
|
|
1399
1632
|
"data-testid": `fuel-value-${i}`,
|
|
@@ -1408,16 +1641,16 @@ function FuelIndicator({
|
|
|
1408
1641
|
children: r.text
|
|
1409
1642
|
}
|
|
1410
1643
|
),
|
|
1411
|
-
/* @__PURE__ */ (0,
|
|
1644
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: cx, y: BAR_BOTTOM + 44, fill: "#fff", fontSize: "13", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: unit })
|
|
1412
1645
|
] }, i);
|
|
1413
1646
|
}),
|
|
1414
|
-
/* @__PURE__ */ (0,
|
|
1415
|
-
/* @__PURE__ */ (0,
|
|
1647
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${ORIGIN3 + 8} ${FOOTER_Y} H ${ORIGIN3 + SIDE3 - 8}`, stroke: "#555", strokeWidth: "1.5" }),
|
|
1648
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: CENTER, y: FOOTER_Y + 19, fill: "#fff", fontSize: "24", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: label2.toUpperCase() })
|
|
1416
1649
|
] });
|
|
1417
1650
|
}
|
|
1418
1651
|
|
|
1419
1652
|
// src/components/EngineIndicator.tsx
|
|
1420
|
-
var
|
|
1653
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1421
1654
|
var MAX_CYLINDERS = 6;
|
|
1422
1655
|
var MAX_BAR_GAUGES = 4;
|
|
1423
1656
|
var GREEN3 = "#5fe04a";
|
|
@@ -1426,11 +1659,11 @@ var RED2 = "#ff3030";
|
|
|
1426
1659
|
var BLUE = "#4fb7e8";
|
|
1427
1660
|
var LABEL2 = "#b9c8e6";
|
|
1428
1661
|
var LINE = "#8a8f99";
|
|
1429
|
-
var
|
|
1662
|
+
var round23 = (n) => Math.round(n * 100) / 100;
|
|
1430
1663
|
var DIAL_R = 182;
|
|
1431
1664
|
function chord(y, inset = 8) {
|
|
1432
1665
|
const half = Math.sqrt(Math.max(0, DIAL_R * DIAL_R - (y - CENTER) ** 2)) - inset;
|
|
1433
|
-
return `M ${
|
|
1666
|
+
return `M ${round23(CENTER - half)} ${y} H ${round23(CENTER + half)}`;
|
|
1434
1667
|
}
|
|
1435
1668
|
var DEFAULT_MANIFOLD = { min: 10, max: 35, green: [15, 29], yellow: [29, 31], high: 31, unit: "IN", decimals: 1 };
|
|
1436
1669
|
var DEFAULT_RPM = { min: 0, max: 3e3, green: [800, 2500], yellow: [2500, 2700], high: 2700, decimals: 0 };
|
|
@@ -1475,22 +1708,22 @@ function arcAt(cx, cy, r, a0, a1) {
|
|
|
1475
1708
|
}
|
|
1476
1709
|
function ArcGauge({ cx, label: label2, g, duration, testId }) {
|
|
1477
1710
|
const span = g.max - g.min;
|
|
1478
|
-
const angle = (v) =>
|
|
1479
|
-
const band = (from, to, color) => /* @__PURE__ */ (0,
|
|
1711
|
+
const angle = (v) => round23(-ARC_SWEEP + 2 * ARC_SWEEP * clamp((v - g.min) / span, 0, 1));
|
|
1712
|
+
const band = (from, to, color) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: arcAt(cx, ARC_Y, ARC_R, angle(from), angle(to)), stroke: color, strokeWidth: "6", fill: "none" });
|
|
1480
1713
|
const [tipX, tipY] = polar(ARC_R - 4, 0, cx, ARC_Y);
|
|
1481
1714
|
const [lx, ly] = polar(ARC_R - 16, -7, cx, ARC_Y);
|
|
1482
1715
|
const [rx, ry] = polar(ARC_R - 16, 7, cx, ARC_Y);
|
|
1483
|
-
return /* @__PURE__ */ (0,
|
|
1484
|
-
/* @__PURE__ */ (0,
|
|
1716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
|
|
1717
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: arcAt(cx, ARC_Y, ARC_R, -ARC_SWEEP, ARC_SWEEP), stroke: "#fff", strokeWidth: "1.5", fill: "none" }),
|
|
1485
1718
|
g.green && band(g.green[0], g.green[1], GREEN3),
|
|
1486
1719
|
g.yellow && band(g.yellow[0], g.yellow[1], YELLOW2),
|
|
1487
1720
|
g.low !== void 0 && band(g.min, g.low, RED2),
|
|
1488
1721
|
g.high !== void 0 && band(g.high, g.max, RED2),
|
|
1489
|
-
/* @__PURE__ */ (0,
|
|
1490
|
-
/* @__PURE__ */ (0,
|
|
1491
|
-
/* @__PURE__ */ (0,
|
|
1722
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { "data-testid": testId, style: motionStyle(`rotate(${angle(g.value)}deg)`, duration, cx, ARC_Y), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${tipX} ${tipY} L ${lx} ${ly} L ${rx} ${ry} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
|
|
1723
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: cx, y: ARC_Y - 20, fill: LABEL2, fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: label2 }),
|
|
1724
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("text", { x: cx, y: ARC_Y + 4, fill: g.color, fontSize: "28", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
1492
1725
|
g.text,
|
|
1493
|
-
g.unit && /* @__PURE__ */ (0,
|
|
1726
|
+
g.unit && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tspan", { fontSize: "11", dx: "2", children: g.unit })
|
|
1494
1727
|
] })
|
|
1495
1728
|
] });
|
|
1496
1729
|
}
|
|
@@ -1500,28 +1733,28 @@ var BAR_ROW_H = 39;
|
|
|
1500
1733
|
var BAR_TOP2 = 137;
|
|
1501
1734
|
function BarGauge({ top, g, label: label2, duration, testId }) {
|
|
1502
1735
|
const y = top + 14;
|
|
1503
|
-
const at = (v) =>
|
|
1504
|
-
const seg = (from, to, color, w = 7) => /* @__PURE__ */ (0,
|
|
1505
|
-
return /* @__PURE__ */ (0,
|
|
1506
|
-
/* @__PURE__ */ (0,
|
|
1507
|
-
/* @__PURE__ */ (0,
|
|
1736
|
+
const at = (v) => round23(BAR_X0 + (BAR_X1 - BAR_X0) * clamp((v - g.min) / (g.max - g.min), 0, 1));
|
|
1737
|
+
const seg = (from, to, color, w = 7) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${at(from)} ${y} H ${at(to)}`, stroke: color, strokeWidth: w });
|
|
1738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
|
|
1739
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${BAR_X0} ${y} H ${BAR_X1}`, stroke: "#fff", strokeWidth: "2" }),
|
|
1740
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${BAR_X0} ${y - 4} v 8 M ${BAR_X1} ${y - 4} v 8`, stroke: "#fff", strokeWidth: "2" }),
|
|
1508
1741
|
g.green && seg(g.green[0], g.green[1], GREEN3),
|
|
1509
1742
|
g.yellow && seg(g.yellow[0], g.yellow[1], YELLOW2),
|
|
1510
1743
|
g.low !== void 0 && seg(g.min, g.low, RED2),
|
|
1511
1744
|
g.high !== void 0 && seg(g.high, g.max, RED2),
|
|
1512
|
-
/* @__PURE__ */ (0,
|
|
1513
|
-
/* @__PURE__ */ (0,
|
|
1514
|
-
/* @__PURE__ */ (0,
|
|
1515
|
-
g.unit && /* @__PURE__ */ (0,
|
|
1745
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { "data-testid": testId, style: motionStyle(`translate(${round23(at(g.value) - BAR_X0)}px, 0px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${BAR_X0} ${y - 3} l -5 -9 h 10 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
|
|
1746
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: BAR_X0, y: top + 31, fill: LABEL2, fontSize: "13", fontWeight: "bold", dominantBaseline: "central", children: label2 }),
|
|
1747
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: 350, y: top + 15, fill: g.color, fontSize: "20", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.text }),
|
|
1748
|
+
g.unit && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: 350, y: top + 31, fill: LABEL2, fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.unit })
|
|
1516
1749
|
] });
|
|
1517
1750
|
}
|
|
1518
1751
|
function Tank({ x, fraction, duration, testId }) {
|
|
1519
1752
|
const top = 304;
|
|
1520
1753
|
const h = 40;
|
|
1521
|
-
return /* @__PURE__ */ (0,
|
|
1522
|
-
/* @__PURE__ */ (0,
|
|
1523
|
-
/* @__PURE__ */ (0,
|
|
1524
|
-
/* @__PURE__ */ (0,
|
|
1754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
|
|
1755
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: x - 7, y: top, width: "14", height: h, rx: "3", fill: "#000", stroke: "#fff", strokeWidth: "1.5" }),
|
|
1756
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { "data-testid": testId, style: motionStyle(`scaleY(${fraction})`, duration, x, top + h - 2), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: x - 5.5, y: top + 2, width: "11", height: h - 4, fill: BLUE }) }),
|
|
1757
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: x - 5.5, y: top + h - 5, width: "11", height: "3", fill: RED2 })
|
|
1525
1758
|
] });
|
|
1526
1759
|
}
|
|
1527
1760
|
var hottest = (values) => {
|
|
@@ -1589,79 +1822,79 @@ function EngineIndicator({
|
|
|
1589
1822
|
fuelLeft !== void 0 || fuelRight !== void 0 ? `fuel ${fmt(fuelLeft)}/${fmt(fuelRight)} ${fuelUnit}` : null,
|
|
1590
1823
|
volts !== void 0 ? `${fmt(volts, 1)} V` : null
|
|
1591
1824
|
].filter(Boolean).join(", ");
|
|
1592
|
-
return /* @__PURE__ */ (0,
|
|
1593
|
-
power !== void 0 && /* @__PURE__ */ (0,
|
|
1594
|
-
/* @__PURE__ */ (0,
|
|
1825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
1826
|
+
power !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("text", { x: CENTER, y: 44, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
1827
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("tspan", { fill: LABEL2, fontSize: "11", children: [
|
|
1595
1828
|
"POWER",
|
|
1596
1829
|
" "
|
|
1597
1830
|
] }),
|
|
1598
1831
|
fmt(power),
|
|
1599
|
-
/* @__PURE__ */ (0,
|
|
1832
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tspan", { fontSize: "11", children: "%" })
|
|
1600
1833
|
] }),
|
|
1601
|
-
/* @__PURE__ */ (0,
|
|
1602
|
-
/* @__PURE__ */ (0,
|
|
1603
|
-
/* @__PURE__ */ (0,
|
|
1604
|
-
/* @__PURE__ */ (0,
|
|
1605
|
-
/* @__PURE__ */ (0,
|
|
1606
|
-
/* @__PURE__ */ (0,
|
|
1607
|
-
/* @__PURE__ */ (0,
|
|
1834
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ArcGauge, { cx: 118, label: "MAN", g: man, duration, testId: "engine-man" }),
|
|
1835
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ArcGauge, { cx: 282, label: "RPM", g: speed, duration, testId: "engine-rpm" }),
|
|
1836
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { stroke: LINE, strokeWidth: "1.5", children: [
|
|
1837
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: chord(133) }),
|
|
1838
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M 200 133 V 298" }),
|
|
1839
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: chord(298) }),
|
|
1840
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M 136 298 V 348 M 264 298 V 348" })
|
|
1608
1841
|
] }),
|
|
1609
|
-
/* @__PURE__ */ (0,
|
|
1610
|
-
/* @__PURE__ */ (0,
|
|
1842
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: readouts.map((r) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
|
|
1843
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("text", { x: r.x, y: 144, fill: LABEL2, fontSize: "13", children: [
|
|
1611
1844
|
r.name,
|
|
1612
|
-
/* @__PURE__ */ (0,
|
|
1845
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tspan", { fontSize: "9", children: temperatureUnit })
|
|
1613
1846
|
] }),
|
|
1614
|
-
/* @__PURE__ */ (0,
|
|
1847
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { "data-testid": `engine-${r.name.toLowerCase()}`, x: r.x, y: 165, fill: r.color, fontSize: "22", children: fmt(r.value) })
|
|
1615
1848
|
] }, r.name)) }),
|
|
1616
|
-
/* @__PURE__ */ (0,
|
|
1617
|
-
columns > 0 && /* @__PURE__ */ (0,
|
|
1618
|
-
/* @__PURE__ */ (0,
|
|
1619
|
-
/* @__PURE__ */ (0,
|
|
1849
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M 40 178 H 190", stroke: LINE, strokeWidth: "1" }),
|
|
1850
|
+
columns > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
|
|
1851
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${chartX0} ${limitY} H ${chartX1}`, stroke: RED2, strokeWidth: "1.5", strokeDasharray: "5 4" }),
|
|
1852
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: chartX0 - 4, y: limitY, fill: "#fff", fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: "CHT" }),
|
|
1620
1853
|
Array.from({ length: cylinders }, (_, i) => {
|
|
1621
1854
|
const x0 = chartX0 + colW * i;
|
|
1622
1855
|
const mid = x0 + colW / 2;
|
|
1623
1856
|
const c = chtValues[i];
|
|
1624
1857
|
const e = egtValues[i];
|
|
1625
|
-
return /* @__PURE__ */ (0,
|
|
1626
|
-
c !== void 0 && /* @__PURE__ */ (0,
|
|
1627
|
-
e !== void 0 && /* @__PURE__ */ (0,
|
|
1628
|
-
/* @__PURE__ */ (0,
|
|
1858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
|
|
1859
|
+
c !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { "data-testid": `engine-cht-${i}`, style: motionStyle(`scaleY(${chtFrac(c)})`, duration, mid, chartBase), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: mid - barW - 1, y: chartBase - chartH, width: barW, height: chartH, fill: GREEN3 }) }),
|
|
1860
|
+
e !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { "data-testid": `engine-egt-${i}`, style: motionStyle(`scaleY(${egtFrac(e)})`, duration, mid, chartBase), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: mid + 1, y: chartBase - chartH, width: barW, height: chartH, fill: BLUE }) }),
|
|
1861
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: mid, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: i + 1 })
|
|
1629
1862
|
] }, i);
|
|
1630
1863
|
}),
|
|
1631
|
-
hasTit && /* @__PURE__ */ (0,
|
|
1632
|
-
/* @__PURE__ */ (0,
|
|
1633
|
-
/* @__PURE__ */ (0,
|
|
1864
|
+
hasTit && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
|
|
1865
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { "data-testid": "engine-tit-bar", style: motionStyle(`scaleY(${egtFrac(tit)})`, duration, chartX1 - colW / 2, chartBase), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: chartX1 - colW / 2 - barW / 2, y: chartBase - chartH, width: barW, height: chartH, fill: "#fff" }) }),
|
|
1866
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: chartX1 - colW / 2, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "T" })
|
|
1634
1867
|
] })
|
|
1635
1868
|
] }),
|
|
1636
|
-
bars.map((b, i) => /* @__PURE__ */ (0,
|
|
1637
|
-
i > 0 && /* @__PURE__ */ (0,
|
|
1638
|
-
/* @__PURE__ */ (0,
|
|
1869
|
+
bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
|
|
1870
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M 206 ${BAR_TOP2 + BAR_ROW_H * i - 2} H 352`, stroke: LINE, strokeWidth: "1" }),
|
|
1871
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BarGauge, { top: BAR_TOP2 + BAR_ROW_H * i, g: b.g, label: b.label, duration, testId: `engine-bar-${i}` })
|
|
1639
1872
|
] }, b.label)),
|
|
1640
|
-
/* @__PURE__ */ (0,
|
|
1641
|
-
/* @__PURE__ */ (0,
|
|
1873
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
1874
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("text", { "data-testid": "engine-amps", x: 104, y: 318, fill: "#fff", fontSize: "20", children: [
|
|
1642
1875
|
fmt(amps),
|
|
1643
|
-
/* @__PURE__ */ (0,
|
|
1876
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tspan", { fontSize: "11", dx: "2", children: "A" })
|
|
1644
1877
|
] }),
|
|
1645
|
-
/* @__PURE__ */ (0,
|
|
1646
|
-
/* @__PURE__ */ (0,
|
|
1647
|
-
/* @__PURE__ */ (0,
|
|
1648
|
-
/* @__PURE__ */ (0,
|
|
1878
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: 104, y: 338, fill: LABEL2, fontSize: "13", children: "ALT" }),
|
|
1879
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Tank, { x: 152, fraction: left / cap, duration, testId: "engine-fuel-left" }),
|
|
1880
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Tank, { x: 248, fraction: right / cap, duration, testId: "engine-fuel-right" }),
|
|
1881
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("text", { "data-testid": "engine-fuel", x: 200, y: 316, fill: "#fff", fontSize: "20", children: [
|
|
1649
1882
|
fmt(left),
|
|
1650
|
-
/* @__PURE__ */ (0,
|
|
1883
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tspan", { dx: "14", children: fmt(right) })
|
|
1651
1884
|
] }),
|
|
1652
|
-
/* @__PURE__ */ (0,
|
|
1653
|
-
/* @__PURE__ */ (0,
|
|
1654
|
-
/* @__PURE__ */ (0,
|
|
1885
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: 200, y: 335, fill: LABEL2, fontSize: "13", children: "Fuel" }),
|
|
1886
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: 200, y: 348, fill: LABEL2, fontSize: "9", children: fuelUnit }),
|
|
1887
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("text", { "data-testid": "engine-volts", x: 296, y: 318, fill: "#fff", fontSize: "20", children: [
|
|
1655
1888
|
fmt(volts, 1),
|
|
1656
|
-
/* @__PURE__ */ (0,
|
|
1889
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tspan", { fontSize: "11", dx: "2", children: "V" })
|
|
1657
1890
|
] }),
|
|
1658
|
-
/* @__PURE__ */ (0,
|
|
1891
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: 296, y: 338, fill: LABEL2, fontSize: "13", children: "BATT" })
|
|
1659
1892
|
] })
|
|
1660
1893
|
] });
|
|
1661
1894
|
}
|
|
1662
1895
|
|
|
1663
1896
|
// src/components/FlapIndicator.tsx
|
|
1664
|
-
var
|
|
1897
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1665
1898
|
var GREEN4 = "#3ddc3d";
|
|
1666
1899
|
var YELLOW3 = "#ffd400";
|
|
1667
1900
|
var ORANGE = "#ff8a00";
|
|
@@ -1700,12 +1933,12 @@ function FlapIndicator({
|
|
|
1700
1933
|
const overspeed = limit !== void 0 && !Number.isNaN(ias) && ias > limit.speed;
|
|
1701
1934
|
const segH = BAR_H2 / count;
|
|
1702
1935
|
const title = `${label2}: ${Math.round(position)}\xB0 of ${Math.round(full)}\xB0` + (limit ? `, max ${Math.round(limit.speed)} knots${overspeed ? " (overspeed)" : ""}` : "");
|
|
1703
|
-
return /* @__PURE__ */ (0,
|
|
1704
|
-
/* @__PURE__ */ (0,
|
|
1936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(InstrumentFrame, { ...props, label: title, children: [
|
|
1937
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: BAR_X - BAR_W / 2 - 4, y: BAR_TOP3 - 4, width: BAR_W + 8, height: BAR_H2 + 8, rx: "4", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
|
|
1705
1938
|
Array.from({ length: count }, (_, i) => {
|
|
1706
1939
|
const y = BAR_TOP3 + i * segH;
|
|
1707
1940
|
const on = i < lit;
|
|
1708
|
-
return /* @__PURE__ */ (0,
|
|
1941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1709
1942
|
"rect",
|
|
1710
1943
|
{
|
|
1711
1944
|
"data-testid": `flap-segment-${i}`,
|
|
@@ -1722,26 +1955,26 @@ function FlapIndicator({
|
|
|
1722
1955
|
i
|
|
1723
1956
|
);
|
|
1724
1957
|
}),
|
|
1725
|
-
/* @__PURE__ */ (0,
|
|
1726
|
-
/* @__PURE__ */ (0,
|
|
1727
|
-
/* @__PURE__ */ (0,
|
|
1958
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("g", { fill: "#fff", fontSize: "18", fontWeight: "bold", dominantBaseline: "central", children: scale.map((d) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("g", { children: [
|
|
1959
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: `M ${BAR_X + BAR_W / 2 + 8} ${yAt(d)} h 8`, stroke: "#fff", strokeWidth: "2" }),
|
|
1960
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("text", { x: BAR_X + BAR_W / 2 + 22, y: yAt(d), children: d })
|
|
1728
1961
|
] }, d)) }),
|
|
1729
|
-
/* @__PURE__ */ (0,
|
|
1730
|
-
limit && /* @__PURE__ */ (0,
|
|
1731
|
-
/* @__PURE__ */ (0,
|
|
1962
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("g", { "data-testid": "flap-pointer", style: motionStyle(`translate(0px, ${yAt(position) - BAR_TOP3}px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: `M ${BAR_X - BAR_W / 2 - 8} ${BAR_TOP3} l -14 -8 v 16 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
|
|
1963
|
+
limit && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("g", { textAnchor: "middle", dominantBaseline: "central", fill: overspeed ? RED3 : "#fff", children: [
|
|
1964
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("text", { "data-testid": "flap-speed", x: 118, y: 176, fontSize: "36", fontWeight: "bold", children: [
|
|
1732
1965
|
Math.round(limit.speed),
|
|
1733
|
-
/* @__PURE__ */ (0,
|
|
1966
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tspan", { fontSize: "13", dx: "3", children: "KTS" })
|
|
1734
1967
|
] }),
|
|
1735
|
-
/* @__PURE__ */ (0,
|
|
1968
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("text", { x: 118, y: 212, fontSize: "13", fontWeight: "bold", fill: "#bbb", letterSpacing: "2", children: "MAX" })
|
|
1736
1969
|
] }),
|
|
1737
|
-
/* @__PURE__ */ (0,
|
|
1970
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("text", { x: CENTER, y: 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
|
|
1738
1971
|
] });
|
|
1739
1972
|
}
|
|
1740
1973
|
|
|
1741
1974
|
// src/components/AoaIndicator.tsx
|
|
1742
|
-
var
|
|
1975
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1743
1976
|
var GREEN5 = "#3ddc3d";
|
|
1744
|
-
var
|
|
1977
|
+
var AMBER5 = "#ffb000";
|
|
1745
1978
|
var RED4 = "#ff2a2a";
|
|
1746
1979
|
var UNLIT_OPACITY = 0.15;
|
|
1747
1980
|
var ROWS = [
|
|
@@ -1750,10 +1983,10 @@ var ROWS = [
|
|
|
1750
1983
|
{ shape: "bar", color: GREEN5, y: 256 },
|
|
1751
1984
|
{ shape: "bar", color: GREEN5, y: 234 },
|
|
1752
1985
|
{ shape: "donut", color: GREEN5, y: 208 },
|
|
1753
|
-
{ shape: "bar", color:
|
|
1754
|
-
{ shape: "split", color:
|
|
1755
|
-
{ shape: "chevron", color:
|
|
1756
|
-
{ shape: "chevron", color:
|
|
1986
|
+
{ shape: "bar", color: AMBER5, y: 182 },
|
|
1987
|
+
{ shape: "split", color: AMBER5, y: 160 },
|
|
1988
|
+
{ shape: "chevron", color: AMBER5, y: 125 },
|
|
1989
|
+
{ shape: "chevron", color: AMBER5, y: 103 },
|
|
1757
1990
|
{ shape: "chevron", color: RED4, y: 74 },
|
|
1758
1991
|
{ shape: "chevron", color: RED4, y: 52 }
|
|
1759
1992
|
];
|
|
@@ -1767,20 +2000,20 @@ function RowShape({ shape, y }) {
|
|
|
1767
2000
|
const r = CENTER + HALF;
|
|
1768
2001
|
switch (shape) {
|
|
1769
2002
|
case "bar":
|
|
1770
|
-
return /* @__PURE__ */ (0,
|
|
2003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: HALF * 2, height: BAR_H3, rx: "2" });
|
|
1771
2004
|
case "split":
|
|
1772
|
-
return /* @__PURE__ */ (0,
|
|
1773
|
-
/* @__PURE__ */ (0,
|
|
1774
|
-
/* @__PURE__ */ (0,
|
|
2005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2006
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" }),
|
|
2007
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: r - 50, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" })
|
|
1775
2008
|
] });
|
|
1776
2009
|
case "donut":
|
|
1777
|
-
return /* @__PURE__ */ (0,
|
|
1778
|
-
/* @__PURE__ */ (0,
|
|
1779
|
-
/* @__PURE__ */ (0,
|
|
1780
|
-
/* @__PURE__ */ (0,
|
|
2010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2011
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
|
|
2012
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: CENTER + 24, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
|
|
2013
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("circle", { cx: CENTER, cy: y, r: 13, fill: "none", strokeWidth: "7" })
|
|
1781
2014
|
] });
|
|
1782
2015
|
case "chevron":
|
|
1783
|
-
return /* @__PURE__ */ (0,
|
|
2016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: `M ${l} ${y} L ${CENTER} ${y + CHEVRON_DEPTH} L ${r} ${y}`, fill: "none", strokeWidth: "11", strokeLinejoin: "miter" });
|
|
1784
2017
|
}
|
|
1785
2018
|
}
|
|
1786
2019
|
function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false, label: label2 = "AOA", ...props }) {
|
|
@@ -1794,11 +2027,11 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1794
2027
|
const reading = Number.isNaN(value) ? "---" : `${value.toFixed(1)}\xB0`;
|
|
1795
2028
|
const state = stall ? " (stall warning)" : lit > DONUT + 1 ? " (high)" : lit === DONUT + 1 ? " (optimum)" : "";
|
|
1796
2029
|
const title = `${label2}: ${reading}${Number.isNaN(value) ? "" : state}`;
|
|
1797
|
-
return /* @__PURE__ */ (0,
|
|
1798
|
-
/* @__PURE__ */ (0,
|
|
2030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(InstrumentFrame, { ...props, label: title, children: [
|
|
2031
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: CENTER - HALF - 10, y: 40, width: (HALF + 10) * 2, height: 278, rx: "10", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
|
|
1799
2032
|
ROWS.map((row, i) => {
|
|
1800
2033
|
const on = i < lit;
|
|
1801
|
-
return /* @__PURE__ */ (0,
|
|
2034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1802
2035
|
"g",
|
|
1803
2036
|
{
|
|
1804
2037
|
"data-testid": `aoa-row-${i}`,
|
|
@@ -1809,15 +2042,15 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1809
2042
|
opacity: on ? 1 : UNLIT_OPACITY,
|
|
1810
2043
|
style: { transition: "opacity 150ms ease-out" },
|
|
1811
2044
|
children: [
|
|
1812
|
-
/* @__PURE__ */ (0,
|
|
1813
|
-
on && stall && row.shape === "chevron" && /* @__PURE__ */ (0,
|
|
2045
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RowShape, { shape: row.shape, y: row.y }),
|
|
2046
|
+
on && stall && row.shape === "chevron" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("animate", { attributeName: "opacity", values: "1;0.25;1", dur: "0.6s", repeatCount: "indefinite" })
|
|
1814
2047
|
]
|
|
1815
2048
|
},
|
|
1816
2049
|
i
|
|
1817
2050
|
);
|
|
1818
2051
|
}),
|
|
1819
|
-
showValue && /* @__PURE__ */ (0,
|
|
1820
|
-
/* @__PURE__ */ (0,
|
|
2052
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("text", { "data-testid": "aoa-value", x: CENTER, y: 340, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", children: reading }),
|
|
2053
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("text", { x: CENTER, y: showValue ? 362 : 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
|
|
1821
2054
|
] });
|
|
1822
2055
|
}
|
|
1823
2056
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1835,6 +2068,7 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1835
2068
|
FlapIndicator,
|
|
1836
2069
|
FuelIndicator,
|
|
1837
2070
|
HeadingIndicator,
|
|
2071
|
+
HsiIndicator,
|
|
1838
2072
|
IlsIndicator,
|
|
1839
2073
|
MAX_BAR_GAUGES,
|
|
1840
2074
|
MAX_CYLINDERS,
|