flight-indicators 1.2.0 → 1.2.2
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 +35 -1
- package/dist/index.cjs +439 -214
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -2
- package/dist/index.d.ts +48 -2
- package/dist/index.js +439 -215
- package/dist/index.js.map +1 -1
- package/package.json +4 -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
|
+
IlsIndicator: () => IlsIndicator,
|
|
37
38
|
MAX_BAR_GAUGES: () => MAX_BAR_GAUGES,
|
|
38
39
|
MAX_CYLINDERS: () => MAX_CYLINDERS,
|
|
39
40
|
MAX_FIELDS: () => MAX_FIELDS,
|
|
@@ -62,8 +63,8 @@ var DEFAULT_ANIMATION_MS = 300;
|
|
|
62
63
|
var clamp = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
63
64
|
var finite = (value, fallback = 0) => typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
64
65
|
var round = (n) => Math.round(n * 100) / 100;
|
|
65
|
-
function polar(r,
|
|
66
|
-
const a =
|
|
66
|
+
function polar(r, deg2, cx = CENTER, cy = CENTER) {
|
|
67
|
+
const a = deg2 * Math.PI / 180;
|
|
67
68
|
return [round(cx + r * Math.sin(a)), round(cy - r * Math.cos(a))];
|
|
68
69
|
}
|
|
69
70
|
function arcPath(r, startDeg, endDeg) {
|
|
@@ -73,9 +74,9 @@ function arcPath(r, startDeg, endDeg) {
|
|
|
73
74
|
const sweep = endDeg >= startDeg ? 1 : 0;
|
|
74
75
|
return `M ${x1} ${y1} A ${r} ${r} 0 ${largeArc} ${sweep} ${x2} ${y2}`;
|
|
75
76
|
}
|
|
76
|
-
function tickPath(r1, r2,
|
|
77
|
-
const [x1, y1] = polar(r1,
|
|
78
|
-
const [x2, y2] = polar(r2,
|
|
77
|
+
function tickPath(r1, r2, deg2) {
|
|
78
|
+
const [x1, y1] = polar(r1, deg2);
|
|
79
|
+
const [x2, y2] = polar(r2, deg2);
|
|
79
80
|
return `M ${x1} ${y1} L ${x2} ${y2}`;
|
|
80
81
|
}
|
|
81
82
|
function range(start, end, step) {
|
|
@@ -213,9 +214,9 @@ function AttitudeIndicator({ roll = 0, pitch = 0, pitchLimit = 40, ...props }) {
|
|
|
213
214
|
]
|
|
214
215
|
}
|
|
215
216
|
),
|
|
216
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("g", { stroke: "#fff", strokeWidth: "4", strokeLinecap: "round", children: ROLL_MARKS.flatMap(([
|
|
217
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: tickPath(FACE_R - 2, FACE_R - 2 - len, -
|
|
218
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: tickPath(FACE_R - 2, FACE_R - 2 - len,
|
|
217
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("g", { stroke: "#fff", strokeWidth: "4", strokeLinecap: "round", children: ROLL_MARKS.flatMap(([deg2, len]) => [
|
|
218
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: tickPath(FACE_R - 2, FACE_R - 2 - len, -deg2) }, `l${deg2}`),
|
|
219
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: tickPath(FACE_R - 2, FACE_R - 2 - len, deg2) }, `r${deg2}`)
|
|
219
220
|
]) }),
|
|
220
221
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: `M ${CENTER} ${CENTER - 158} l -10 -18 h 20 z`, fill: "#fff" }),
|
|
221
222
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("g", { "data-testid": "attitude-roll-pointer", style: motionStyle(`rotate(${-displayRoll}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: `M ${CENTER} ${CENTER - 156} l -10 18 h 20 z`, fill: "#ffb000" }) })
|
|
@@ -383,8 +384,8 @@ var TUBE_CY = 40;
|
|
|
383
384
|
var TUBE_R = 240;
|
|
384
385
|
var TUBE_SPAN = 16;
|
|
385
386
|
var BALL_TRAVEL = 13;
|
|
386
|
-
function tubePoint(
|
|
387
|
-
const a =
|
|
387
|
+
function tubePoint(deg2) {
|
|
388
|
+
const a = deg2 * Math.PI / 180;
|
|
388
389
|
return [CENTER + TUBE_R * Math.sin(a), TUBE_CY + TUBE_R * Math.cos(a)];
|
|
389
390
|
}
|
|
390
391
|
function TurnCoordinator({ turnRate = 0, slip = 0, ...props }) {
|
|
@@ -435,7 +436,7 @@ var MIRROR = { L: "R", C: "C", R: "L" };
|
|
|
435
436
|
var WIND = "#3cc8ff";
|
|
436
437
|
var AMBER = "#ffb000";
|
|
437
438
|
var GREEN = "#3ddc84";
|
|
438
|
-
var norm = (
|
|
439
|
+
var norm = (deg2) => (deg2 % 360 + 360) % 360;
|
|
439
440
|
function designator(heading) {
|
|
440
441
|
const n = Math.round(norm(heading) / 10) % 36;
|
|
441
442
|
return String(n === 0 ? 36 : n).padStart(2, "0");
|
|
@@ -623,7 +624,12 @@ var AMBER2 = "#ffb000";
|
|
|
623
624
|
var FULL_SCALE_DEG = 10;
|
|
624
625
|
var DOT_SPACING = 22;
|
|
625
626
|
var FULL_SCALE_PX = DOT_SPACING * 5;
|
|
626
|
-
var
|
|
627
|
+
var PIVOT_Y = CENTER - 100;
|
|
628
|
+
var SWING_LENGTH = 165;
|
|
629
|
+
var SWING_DOT_RADIUS = 156;
|
|
630
|
+
var SWING_DEG_PER_DOT = 7.5;
|
|
631
|
+
var SWING_FULL_SCALE_DEG = SWING_DEG_PER_DOT * 5;
|
|
632
|
+
var norm2 = (deg2) => (deg2 % 360 + 360) % 360;
|
|
627
633
|
var signedDiff = (a, b) => ((a - b) % 360 + 540) % 360 - 180;
|
|
628
634
|
function vorDeviation(course, radial) {
|
|
629
635
|
const d = signedDiff(radial, course);
|
|
@@ -648,7 +654,7 @@ function Flag({ y, up, visible, testId }) {
|
|
|
648
654
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("text", { x: CENTER + 22, y, fill: "#fff", fontSize: "15", fontWeight: "bold", dominantBaseline: "central", children: up ? "TO" : "FROM" })
|
|
649
655
|
] });
|
|
650
656
|
}
|
|
651
|
-
function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ...props }) {
|
|
657
|
+
function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, needle = "slide", ...props }) {
|
|
652
658
|
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
653
659
|
const crs = finite(course);
|
|
654
660
|
const computed = typeof radial === "number" && Number.isFinite(radial) ? vorDeviation(crs, radial) : void 0;
|
|
@@ -657,7 +663,9 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ..
|
|
|
657
663
|
const flag = !signal ? "OFF" : toFrom ?? computed?.toFrom ?? "OFF";
|
|
658
664
|
const displayCourse = useContinuousAngle(crs);
|
|
659
665
|
const courseText = String(Math.round(norm2(crs)) || 360).padStart(3, "0");
|
|
666
|
+
const swing = needle === "swing";
|
|
660
667
|
const needleX = dev / FULL_SCALE_DEG * FULL_SCALE_PX;
|
|
668
|
+
const needleAngle = -(dev / FULL_SCALE_DEG) * SWING_FULL_SCALE_DEG;
|
|
661
669
|
const devText = Math.abs(dev) < 0.05 ? "centred" : `${Math.abs(dev).toFixed(1)}\xB0 ${dev > 0 ? "right" : "left"}`;
|
|
662
670
|
const label2 = signal ? `VOR indicator: course ${courseText}\xB0, needle ${devText}, ${flag === "OFF" ? "no TO/FROM indication" : flag}` : `VOR indicator: course ${courseText}\xB0, no signal`;
|
|
663
671
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
@@ -685,11 +693,77 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ..
|
|
|
685
693
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: `M ${CENTER} ${CENTER - 150} l -10 -28 h 20 z`, fill: AMBER2, stroke: "#000", strokeWidth: "1.5" }),
|
|
686
694
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: `M ${CENTER} ${CENTER + 150} l -8 24 h 16 z`, fill: "#fff", stroke: "#000", strokeWidth: "1.5" }),
|
|
687
695
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("g", { stroke: AMBER2, strokeWidth: "4", strokeLinecap: "round", children: [45, 90, 135, 225, 270, 315].map((a) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: tickPath(192, 178, a) }, a)) }),
|
|
688
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
696
|
+
swing ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
697
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("g", { fill: "#fff", stroke: "#000", strokeWidth: "1", children: range(1, 5, 1).flatMap((i) => [-i, i]).map((i) => {
|
|
698
|
+
const [x, y] = polar(SWING_DOT_RADIUS, 180 - i * SWING_DEG_PER_DOT, CENTER, PIVOT_Y);
|
|
699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: x, cy: y, r: "5" }, i);
|
|
700
|
+
}) }),
|
|
701
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
702
|
+
"rect",
|
|
703
|
+
{
|
|
704
|
+
x: CENTER - 6,
|
|
705
|
+
y: PIVOT_Y + SWING_DOT_RADIUS - 10,
|
|
706
|
+
width: "12",
|
|
707
|
+
height: "20",
|
|
708
|
+
rx: "2",
|
|
709
|
+
fill: "none",
|
|
710
|
+
stroke: "#fff",
|
|
711
|
+
strokeWidth: "2.5"
|
|
712
|
+
}
|
|
713
|
+
),
|
|
714
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("rect", { x: CENTER + 46, y: CENTER - 72, width: "46", height: "76", rx: "5", fill: "#000", stroke: "#555", strokeWidth: "2" }),
|
|
715
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { fill: "#ccc", fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
716
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("text", { x: CENTER + 69, y: CENTER - 59, children: "TO" }),
|
|
717
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("text", { x: CENTER + 69, y: CENTER - 9, children: "FR" })
|
|
718
|
+
] }),
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { stroke: "#000", strokeWidth: "1.5", strokeLinejoin: "round", fill: "#fff", children: [
|
|
720
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
721
|
+
"path",
|
|
722
|
+
{
|
|
723
|
+
"data-testid": "vor-to",
|
|
724
|
+
d: `M ${CENTER + 69} ${CENTER - 44} l 11 18 h -22 z`,
|
|
725
|
+
opacity: flag === "TO" ? 1 : 0,
|
|
726
|
+
style: { transition: "opacity 200ms ease-out" }
|
|
727
|
+
}
|
|
728
|
+
),
|
|
729
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
730
|
+
"path",
|
|
731
|
+
{
|
|
732
|
+
"data-testid": "vor-from",
|
|
733
|
+
d: `M ${CENTER + 69} ${CENTER - 22} l 11 -18 h -22 z`,
|
|
734
|
+
opacity: flag === "FROM" ? 1 : 0,
|
|
735
|
+
style: { transition: "opacity 200ms ease-out" }
|
|
736
|
+
}
|
|
737
|
+
)
|
|
738
|
+
] }),
|
|
739
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { "data-testid": "vor-needle", style: motionStyle(`rotate(${needleAngle}deg)`, duration, CENTER, PIVOT_Y), children: [
|
|
740
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
741
|
+
"path",
|
|
742
|
+
{
|
|
743
|
+
d: `M ${CENTER} ${PIVOT_Y} V ${PIVOT_Y + SWING_LENGTH}`,
|
|
744
|
+
stroke: "#000",
|
|
745
|
+
strokeWidth: "7",
|
|
746
|
+
strokeLinecap: "round"
|
|
747
|
+
}
|
|
748
|
+
),
|
|
749
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
750
|
+
"path",
|
|
751
|
+
{
|
|
752
|
+
d: `M ${CENTER} ${PIVOT_Y} V ${PIVOT_Y + SWING_LENGTH}`,
|
|
753
|
+
stroke: "#fff",
|
|
754
|
+
strokeWidth: "4",
|
|
755
|
+
strokeLinecap: "round"
|
|
756
|
+
}
|
|
757
|
+
)
|
|
758
|
+
] }),
|
|
759
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: CENTER, cy: PIVOT_Y, r: "6", fill: "#333", stroke: "#fff", strokeWidth: "2" })
|
|
760
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
761
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("g", { fill: "#fff", stroke: "#000", strokeWidth: "1", children: range(1, 5, 1).flatMap((i) => [-i, i]).map((i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: CENTER + i * DOT_SPACING, cy: CENTER, r: "5" }, i)) }),
|
|
762
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: CENTER, cy: CENTER, r: "9", fill: "none", stroke: "#fff", strokeWidth: "2.5" }),
|
|
763
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Flag, { y: CENTER - 54, up: true, visible: flag === "TO", testId: "vor-to" }),
|
|
764
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Flag, { y: CENTER + 54, up: false, visible: flag === "FROM", testId: "vor-from" }),
|
|
765
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("g", { "data-testid": "vor-needle", style: motionStyle(`translate(${needleX}px, 0px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("rect", { x: CENTER - 3, y: CENTER - 68, width: "6", height: "136", rx: "3", fill: "#fff", stroke: "#000", strokeWidth: "1.5" }) })
|
|
766
|
+
] }),
|
|
693
767
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("rect", { x: CENTER - 44, y: CENTER + 72, width: "88", height: "26", rx: "4", fill: "#000", stroke: "#555", strokeWidth: "2" }),
|
|
694
768
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
695
769
|
"text",
|
|
@@ -709,23 +783,173 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ..
|
|
|
709
783
|
]
|
|
710
784
|
}
|
|
711
785
|
),
|
|
712
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
786
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
787
|
+
"g",
|
|
788
|
+
{
|
|
789
|
+
"data-testid": "vor-nav-flag",
|
|
790
|
+
opacity: signal ? 0 : 1,
|
|
791
|
+
style: { transition: "opacity 200ms ease-out" },
|
|
792
|
+
transform: swing ? "translate(-64 52)" : void 0,
|
|
793
|
+
children: [
|
|
794
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("rect", { x: CENTER - 28, y: CENTER - 98, width: "56", height: "24", rx: "3", fill: "#d42626", stroke: "#000", strokeWidth: "1.5" }),
|
|
795
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("text", { x: CENTER, y: CENTER - 85, fill: "#fff", fontSize: "15", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "NAV" })
|
|
796
|
+
]
|
|
797
|
+
}
|
|
798
|
+
)
|
|
716
799
|
] });
|
|
717
800
|
}
|
|
718
801
|
|
|
719
|
-
// src/components/
|
|
802
|
+
// src/components/IlsIndicator.tsx
|
|
720
803
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
721
804
|
var CARDINALS4 = { 0: "N", 90: "E", 180: "S", 270: "W" };
|
|
805
|
+
var YELLOW = "#d8e03a";
|
|
806
|
+
var FLAG = "#d9814f";
|
|
807
|
+
var SCALE_GREY = "#2c2c2c";
|
|
808
|
+
var DOT_SPACING2 = 18;
|
|
809
|
+
var FULL_SCALE_PX2 = DOT_SPACING2 * 5;
|
|
810
|
+
var LOC_PIVOT_Y = CENTER + 108;
|
|
811
|
+
var GS_PIVOT_X = CENTER - 108;
|
|
812
|
+
var SWING_LENGTH2 = 260;
|
|
813
|
+
var FLAG_OFFSET = 108;
|
|
814
|
+
var NEEDLE_CLIP_R = 150;
|
|
815
|
+
var SCALE_HALF = 112;
|
|
816
|
+
var GS_PARK_PX = -120;
|
|
817
|
+
var norm3 = (deg2) => (deg2 % 360 + 360) % 360;
|
|
818
|
+
var round2 = (n) => Math.round(n * 100) / 100 + 0;
|
|
819
|
+
var deg = (rad) => round2(rad * 180 / Math.PI);
|
|
820
|
+
function FlagWindow({ x, y, axis, visible, testId }) {
|
|
821
|
+
const [w, h] = axis === "h" ? [52, 24] : [24, 52];
|
|
822
|
+
const arrow = axis === "h" ? `M ${x - 18} ${y} H ${x + 18} M ${x - 12} ${y - 6} L ${x - 18} ${y} L ${x - 12} ${y + 6} M ${x + 12} ${y - 6} L ${x + 18} ${y} L ${x + 12} ${y + 6}` : `M ${x} ${y - 18} V ${y + 18} M ${x - 6} ${y - 12} L ${x} ${y - 18} L ${x + 6} ${y - 12} M ${x - 6} ${y + 12} L ${x} ${y + 18} L ${x + 6} ${y + 12}`;
|
|
823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { children: [
|
|
824
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: x - w / 2 - 3, y: y - h / 2 - 3, width: w + 6, height: h + 6, rx: "3", fill: "#050505", stroke: "#444", strokeWidth: "1.5" }),
|
|
825
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { "data-testid": testId, opacity: visible ? 1 : 0, style: { transition: "opacity 200ms ease-out" }, children: [
|
|
826
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: x - w / 2, y: y - h / 2, width: w, height: h, rx: "2", fill: FLAG }),
|
|
827
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: arrow, stroke: "#1a1a1a", strokeWidth: "3", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
828
|
+
] })
|
|
829
|
+
] });
|
|
830
|
+
}
|
|
831
|
+
function NeedleLine({ d }) {
|
|
832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
833
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d, stroke: "#000", strokeWidth: "7", strokeLinecap: "round" }),
|
|
834
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d, stroke: "#eee", strokeWidth: "4", strokeLinecap: "round" })
|
|
835
|
+
] });
|
|
836
|
+
}
|
|
837
|
+
function IlsIndicator({
|
|
838
|
+
course = 0,
|
|
839
|
+
radial,
|
|
840
|
+
deviation,
|
|
841
|
+
fullScale = 10,
|
|
842
|
+
toFrom,
|
|
843
|
+
signal = true,
|
|
844
|
+
glideslope,
|
|
845
|
+
glideslopeFullScale = 0.7,
|
|
846
|
+
glideslopeSignal,
|
|
847
|
+
needles = "slide",
|
|
848
|
+
...props
|
|
849
|
+
}) {
|
|
850
|
+
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
851
|
+
const crs = finite(course);
|
|
852
|
+
const computed = typeof radial === "number" && Number.isFinite(radial) ? vorDeviation(crs, radial) : void 0;
|
|
853
|
+
const locScale = finite(fullScale, 10) > 0 ? finite(fullScale, 10) : 10;
|
|
854
|
+
const gsScale = finite(glideslopeFullScale, 0.7) > 0 ? finite(glideslopeFullScale, 0.7) : 0.7;
|
|
855
|
+
const dev = signal ? clamp(finite(deviation, computed?.deviation ?? 0), -locScale, locScale) : 0;
|
|
856
|
+
const flag = !signal ? "OFF" : toFrom ?? computed?.toFrom ?? "OFF";
|
|
857
|
+
const hasGs = glideslopeSignal ?? (typeof glideslope === "number" && Number.isFinite(glideslope));
|
|
858
|
+
const gs = hasGs ? clamp(finite(glideslope), -gsScale, gsScale) : 0;
|
|
859
|
+
const swing = needles === "swing";
|
|
860
|
+
const locX = round2(dev / locScale * FULL_SCALE_PX2);
|
|
861
|
+
const gsY = hasGs ? round2(-(gs / gsScale) * FULL_SCALE_PX2) : swing ? GS_PARK_PX : 0;
|
|
862
|
+
const locAngle = deg(Math.atan2(locX, LOC_PIVOT_Y - CENTER));
|
|
863
|
+
const gsAngle = deg(Math.atan2(gsY, CENTER - GS_PIVOT_X));
|
|
864
|
+
const displayCourse = useContinuousAngle(crs);
|
|
865
|
+
const courseText = String(Math.round(norm3(crs)) || 360).padStart(3, "0");
|
|
866
|
+
const devText = Math.abs(dev) < 0.05 ? "centred" : `${Math.abs(dev).toFixed(1)}\xB0 ${dev > 0 ? "right" : "left"}`;
|
|
867
|
+
const gsText = !hasGs ? "glideslope off" : Math.abs(gs) < 5e-3 ? "glideslope centred" : `glideslope ${Math.abs(gs).toFixed(2)}\xB0 ${gs > 0 ? "up" : "down"}`;
|
|
868
|
+
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
|
+
const clipId = useSvgId("fi-ils-clip");
|
|
870
|
+
const dots = range(1, 5, 1).flatMap((i) => [-i, i]);
|
|
871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { "data-testid": "ils-card", style: motionStyle(`rotate(${-displayCourse}deg)`, duration), children: [
|
|
873
|
+
/* @__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
|
+
range(0, 330, 30).map((a) => {
|
|
875
|
+
const [x, y] = polar(136, a);
|
|
876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
877
|
+
"text",
|
|
878
|
+
{
|
|
879
|
+
x,
|
|
880
|
+
y,
|
|
881
|
+
transform: `rotate(${a} ${x} ${y})`,
|
|
882
|
+
fill: "#ddd",
|
|
883
|
+
fontSize: a % 90 === 0 ? 26 : 22,
|
|
884
|
+
fontWeight: "bold",
|
|
885
|
+
textAnchor: "middle",
|
|
886
|
+
dominantBaseline: "central",
|
|
887
|
+
children: CARDINALS4[a] ?? String(a / 10)
|
|
888
|
+
},
|
|
889
|
+
a
|
|
890
|
+
);
|
|
891
|
+
})
|
|
892
|
+
] }),
|
|
893
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: `M ${CENTER} ${CENTER - 151} l -11 -19 h 22 z`, fill: YELLOW, stroke: "#000", strokeWidth: "1" }),
|
|
894
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: `M ${CENTER} ${CENTER + 151} l -8 13 h 16 z`, fill: YELLOW, stroke: "#000", strokeWidth: "1" }),
|
|
895
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { fontSize: "13", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
896
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: CENTER + 34, y: CENTER - 86, width: "40", height: "22", rx: "2", fill: "#050505", stroke: "#333" }),
|
|
897
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("text", { "data-testid": "ils-to", x: CENTER + 54, y: CENTER - 75, fill: "#eee", opacity: flag === "TO" ? 1 : 0, style: { transition: "opacity 200ms ease-out" }, children: "TO" }),
|
|
898
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: CENTER - 74, y: CENTER + 64, width: "40", height: "22", rx: "2", fill: "#050505", stroke: "#333" }),
|
|
899
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("text", { "data-testid": "ils-from", x: CENTER - 54, y: CENTER + 75, fill: "#eee", opacity: flag === "FROM" ? 1 : 0, style: { transition: "opacity 200ms ease-out" }, children: "FR" })
|
|
900
|
+
] }),
|
|
901
|
+
swing ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
902
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: CENTER - SCALE_HALF, y: CENTER - 9, width: SCALE_HALF * 2, height: "18", rx: "3", fill: SCALE_GREY }),
|
|
903
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: CENTER - 9, y: CENTER - SCALE_HALF, width: "18", height: SCALE_HALF * 2, rx: "3", fill: SCALE_GREY }),
|
|
904
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { fill: "#eee", stroke: "#eee", children: [
|
|
905
|
+
dots.map((i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { children: [
|
|
906
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: CENTER + i * DOT_SPACING2, cy: CENTER, r: "4", stroke: "none" }),
|
|
907
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: `M ${CENTER + i * DOT_SPACING2} ${CENTER - 8} V ${CENTER + 8}`, strokeWidth: "1.5" })
|
|
908
|
+
] }, i)),
|
|
909
|
+
range(-5, 5, 0.5).filter((i) => i !== 0).map((i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: `M ${CENTER - (i % 1 ? 4 : 7)} ${CENTER + i * DOT_SPACING2} h ${i % 1 ? 8 : 14}`, strokeWidth: "2" }, i))
|
|
910
|
+
] })
|
|
911
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
912
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: CENTER - SCALE_HALF, y: CENTER - 9, width: SCALE_HALF * 2, height: "18", rx: "3", fill: SCALE_GREY }),
|
|
913
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: CENTER - 9, y: CENTER - SCALE_HALF, width: "18", height: SCALE_HALF * 2, rx: "3", fill: SCALE_GREY }),
|
|
914
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("g", { stroke: "#eee", strokeWidth: "2", children: range(-5, 5, 0.5).filter((i) => i !== 0).map((i) => {
|
|
915
|
+
const half = i % 1 ? 4 : 7;
|
|
916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { children: [
|
|
917
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: `M ${CENTER + i * DOT_SPACING2} ${CENTER - half} v ${half * 2}` }),
|
|
918
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: `M ${CENTER - half} ${CENTER + i * DOT_SPACING2} h ${half * 2}` })
|
|
919
|
+
] }, i);
|
|
920
|
+
}) })
|
|
921
|
+
] }),
|
|
922
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: CENTER, cy: CENTER, r: "16", fill: "none", stroke: "#000", strokeWidth: "7" }),
|
|
923
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: CENTER, cy: CENTER, r: "16", fill: "none", stroke: "#eee", strokeWidth: "4" }),
|
|
924
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: CENTER, cy: CENTER, r: NEEDLE_CLIP_R }) }),
|
|
925
|
+
swing ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { clipPath: `url(#${clipId})`, children: [
|
|
926
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("g", { "data-testid": "ils-gs-needle", style: motionStyle(`rotate(${gsAngle}deg)`, duration, GS_PIVOT_X, CENTER), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NeedleLine, { d: `M ${GS_PIVOT_X} ${CENTER} H ${GS_PIVOT_X + SWING_LENGTH2}` }) }),
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("g", { "data-testid": "ils-loc-needle", style: motionStyle(`rotate(${locAngle}deg)`, duration, CENTER, LOC_PIVOT_Y), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NeedleLine, { d: `M ${CENTER} ${LOC_PIVOT_Y} V ${LOC_PIVOT_Y - SWING_LENGTH2}` }) })
|
|
928
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
929
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("g", { "data-testid": "ils-gs-needle", style: motionStyle(`translate(0px, ${gsY}px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NeedleLine, { d: `M ${CENTER - 104} ${CENTER} H ${CENTER + 104}` }) }),
|
|
930
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("g", { "data-testid": "ils-loc-needle", style: motionStyle(`translate(${locX}px, 0px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NeedleLine, { d: `M ${CENTER} ${CENTER - 104} V ${CENTER + 104}` }) })
|
|
931
|
+
] }),
|
|
932
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FlagWindow, { x: CENTER, y: CENTER + FLAG_OFFSET, axis: "h", visible: !signal, testId: "ils-nav-flag" }),
|
|
933
|
+
/* @__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
|
+
] })
|
|
940
|
+
] });
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
// src/components/AdfIndicator.tsx
|
|
944
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
945
|
+
var CARDINALS5 = { 0: "N", 90: "E", 180: "S", 270: "W" };
|
|
722
946
|
var AMBER3 = "#ffb000";
|
|
723
947
|
var NEEDLE = "#ffe14d";
|
|
724
948
|
var PARKED_DEG = 90;
|
|
725
|
-
var
|
|
726
|
-
var pad3 = (
|
|
949
|
+
var norm4 = (deg2) => (deg2 % 360 + 360) % 360;
|
|
950
|
+
var pad3 = (deg2) => String(Math.round(norm4(deg2)) % 360).padStart(3, "0");
|
|
727
951
|
function relativeBearing(heading, bearingToStation) {
|
|
728
|
-
return
|
|
952
|
+
return norm4(finite(bearingToStation) - finite(heading));
|
|
729
953
|
}
|
|
730
954
|
function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
|
|
731
955
|
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
@@ -734,12 +958,12 @@ function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
|
|
|
734
958
|
const displayCard = useContinuousAngle(hdg);
|
|
735
959
|
const displayNeedle = useContinuousAngle(signal ? rel : PARKED_DEG);
|
|
736
960
|
const label2 = signal ? `ADF indicator: station ${pad3(rel)}\xB0 relative, bearing ${pad3(rel + hdg)}\xB0 to station` : "ADF indicator: no signal";
|
|
737
|
-
return /* @__PURE__ */ (0,
|
|
738
|
-
/* @__PURE__ */ (0,
|
|
739
|
-
/* @__PURE__ */ (0,
|
|
961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
962
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { "data-testid": "adf-card", style: motionStyle(`rotate(${-displayCard}deg)`, duration), children: [
|
|
963
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
|
|
740
964
|
range(0, 330, 30).map((a) => {
|
|
741
965
|
const [x, y] = polar(132, a);
|
|
742
|
-
return /* @__PURE__ */ (0,
|
|
966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
743
967
|
"text",
|
|
744
968
|
{
|
|
745
969
|
x,
|
|
@@ -750,24 +974,24 @@ function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
|
|
|
750
974
|
fontWeight: "bold",
|
|
751
975
|
textAnchor: "middle",
|
|
752
976
|
dominantBaseline: "central",
|
|
753
|
-
children:
|
|
977
|
+
children: CARDINALS5[a] ?? String(a / 10)
|
|
754
978
|
},
|
|
755
979
|
a
|
|
756
980
|
);
|
|
757
981
|
})
|
|
758
982
|
] }),
|
|
759
|
-
/* @__PURE__ */ (0,
|
|
760
|
-
/* @__PURE__ */ (0,
|
|
761
|
-
/* @__PURE__ */ (0,
|
|
762
|
-
/* @__PURE__ */ (0,
|
|
763
|
-
/* @__PURE__ */ (0,
|
|
983
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: `M ${CENTER} ${CENTER - 150} l -10 -28 h 20 z`, fill: AMBER3, stroke: "#000", strokeWidth: "1.5" }),
|
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { stroke: AMBER3, strokeWidth: "4", strokeLinecap: "round", children: [45, 90, 135, 180, 225, 270, 315].map((a) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: tickPath(192, 178, a) }, a)) }),
|
|
985
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { stroke: AMBER3, strokeWidth: "2", strokeLinecap: "round", opacity: "0.7", children: [
|
|
986
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: `M ${CENTER - 26} ${CENTER} H ${CENTER + 26}` }),
|
|
987
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: `M ${CENTER} ${CENTER - 26} V ${CENTER + 14}` })
|
|
764
988
|
] }),
|
|
765
|
-
/* @__PURE__ */ (0,
|
|
766
|
-
/* @__PURE__ */ (0,
|
|
767
|
-
/* @__PURE__ */ (0,
|
|
768
|
-
/* @__PURE__ */ (0,
|
|
989
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x: CENTER, y: CENTER + 62, fill: "#ccc", fontSize: "15", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: "ADF" }),
|
|
990
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { "data-testid": "adf-flag", opacity: signal ? 0 : 1, style: { transition: "opacity 200ms ease-out" }, children: [
|
|
991
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", { x: CENTER - 28, y: CENTER - 76, width: "56", height: "24", rx: "3", fill: "#d42626", stroke: "#000", strokeWidth: "1.5" }),
|
|
992
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x: CENTER, y: CENTER - 63, fill: "#fff", fontSize: "15", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "ADF" })
|
|
769
993
|
] }),
|
|
770
|
-
/* @__PURE__ */ (0,
|
|
994
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { "data-testid": "adf-needle", style: motionStyle(`rotate(${displayNeedle}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
771
995
|
"path",
|
|
772
996
|
{
|
|
773
997
|
d: `M ${CENTER} ${CENTER - 146} l -13 30 h 9 V ${CENTER + 140} h 8 V ${CENTER - 116} h 9 z`,
|
|
@@ -777,12 +1001,12 @@ function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
|
|
|
777
1001
|
strokeLinejoin: "round"
|
|
778
1002
|
}
|
|
779
1003
|
) }),
|
|
780
|
-
/* @__PURE__ */ (0,
|
|
1004
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Hub, { r: 10 })
|
|
781
1005
|
] });
|
|
782
1006
|
}
|
|
783
1007
|
|
|
784
1008
|
// src/components/RadioPanel.tsx
|
|
785
|
-
var
|
|
1009
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
786
1010
|
var SIDE = 252;
|
|
787
1011
|
var ORIGIN = CENTER - SIDE / 2;
|
|
788
1012
|
var ROW_H = 60;
|
|
@@ -799,9 +1023,9 @@ var formatAdf = (khz) => usable(khz) ? Number.isInteger(khz) ? String(khz) : khz
|
|
|
799
1023
|
var formatDme = (nm) => usable(nm) ? nm < 99.95 ? nm.toFixed(1) : nm.toFixed(0) : "--.-";
|
|
800
1024
|
function Display({ x, y, width, value, color, testId, unit }) {
|
|
801
1025
|
const h = ROW_H - 16;
|
|
802
|
-
return /* @__PURE__ */ (0,
|
|
803
|
-
/* @__PURE__ */ (0,
|
|
804
|
-
/* @__PURE__ */ (0,
|
|
1026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { children: [
|
|
1027
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("rect", { x, y: y + 8, width, height: h, rx: "5", fill: "#1a0d00", stroke: "#3a2a14", strokeWidth: "1.5" }),
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
805
1029
|
"text",
|
|
806
1030
|
{
|
|
807
1031
|
"data-testid": testId,
|
|
@@ -816,18 +1040,18 @@ function Display({ x, y, width, value, color, testId, unit }) {
|
|
|
816
1040
|
children: value
|
|
817
1041
|
}
|
|
818
1042
|
),
|
|
819
|
-
unit && /* @__PURE__ */ (0,
|
|
1043
|
+
unit && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("text", { x: x + width - 10, y: y + ROW_H / 2 + 5, fill: "#9aa4b1", fontSize: "13", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: unit })
|
|
820
1044
|
] });
|
|
821
1045
|
}
|
|
822
1046
|
function Swap({ y }) {
|
|
823
1047
|
const cy = y + ROW_H / 2;
|
|
824
|
-
return /* @__PURE__ */ (0,
|
|
825
|
-
/* @__PURE__ */ (0,
|
|
826
|
-
/* @__PURE__ */ (0,
|
|
1048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { stroke: "#9aa4b1", strokeWidth: "1.8", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1049
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: `M ${SWAP_X - 7} ${cy - 4} H ${SWAP_X + 7} m -4 -3 l 4 3 l -4 3` }),
|
|
1050
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: `M ${SWAP_X + 7} ${cy + 4} H ${SWAP_X - 7} m 4 -3 l -4 3 l 4 3` })
|
|
827
1051
|
] });
|
|
828
1052
|
}
|
|
829
1053
|
function RowLabel({ y, children }) {
|
|
830
|
-
return /* @__PURE__ */ (0,
|
|
1054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("text", { x: LABEL_X, y: y + ROW_H / 2 + 1, fill: "#ccc", fontSize: "14", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children });
|
|
831
1055
|
}
|
|
832
1056
|
function RadioPanel({ nav, adf, dme, color = "#ff9a2e", ...props }) {
|
|
833
1057
|
const rows = [
|
|
@@ -837,29 +1061,29 @@ function RadioPanel({ nav, adf, dme, color = "#ff9a2e", ...props }) {
|
|
|
837
1061
|
const dmeText = formatDme(dme);
|
|
838
1062
|
const dmeY = FIRST_ROW + 2 * (ROW_H + ROW_GAP);
|
|
839
1063
|
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"}`;
|
|
840
|
-
return /* @__PURE__ */ (0,
|
|
841
|
-
/* @__PURE__ */ (0,
|
|
842
|
-
/* @__PURE__ */ (0,
|
|
843
|
-
/* @__PURE__ */ (0,
|
|
844
|
-
/* @__PURE__ */ (0,
|
|
1064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
1065
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("rect", { x: ORIGIN, y: ORIGIN, width: SIDE, height: SIDE, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
1066
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { fill: "#9aa4b1", fontSize: "11", fontWeight: "bold", letterSpacing: "1.5", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
1067
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("text", { x: ACTIVE_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "ACTIVE" }),
|
|
1068
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("text", { x: STANDBY_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "STBY" })
|
|
845
1069
|
] }),
|
|
846
1070
|
rows.map((r, i) => {
|
|
847
1071
|
const y = FIRST_ROW + i * (ROW_H + ROW_GAP);
|
|
848
|
-
return /* @__PURE__ */ (0,
|
|
849
|
-
/* @__PURE__ */ (0,
|
|
850
|
-
/* @__PURE__ */ (0,
|
|
851
|
-
/* @__PURE__ */ (0,
|
|
852
|
-
/* @__PURE__ */ (0,
|
|
1072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { children: [
|
|
1073
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RowLabel, { y, children: r.name }),
|
|
1074
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Display, { x: ACTIVE_X, y, width: DISPLAY_W, value: r.active, color, testId: `radio-${r.key}-active` }),
|
|
1075
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Swap, { y }),
|
|
1076
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Display, { x: STANDBY_X, y, width: DISPLAY_W, value: r.standby, color, testId: `radio-${r.key}-standby` })
|
|
853
1077
|
] }, r.key);
|
|
854
1078
|
}),
|
|
855
|
-
/* @__PURE__ */ (0,
|
|
856
|
-
/* @__PURE__ */ (0,
|
|
1079
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RowLabel, { y: dmeY, children: "DME" }),
|
|
1080
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Display, { x: ACTIVE_X, y: dmeY, width: STANDBY_X + DISPLAY_W - ACTIVE_X, value: dmeText, color, testId: "radio-dme", unit: "NM" })
|
|
857
1081
|
] });
|
|
858
1082
|
}
|
|
859
1083
|
|
|
860
1084
|
// src/components/RadioStack.tsx
|
|
861
1085
|
var import_react2 = require("react");
|
|
862
|
-
var
|
|
1086
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
863
1087
|
var parseNav = (text) => {
|
|
864
1088
|
const mhz = Math.round(Number.parseFloat(text.replace(",", ".")) * 100) / 100;
|
|
865
1089
|
return mhz >= 108 && mhz <= 117.95 ? mhz : void 0;
|
|
@@ -892,9 +1116,9 @@ var display = {
|
|
|
892
1116
|
var label = { display: "flex", flexDirection: "column", justifyContent: "center", color: LABEL, fontWeight: "bold", letterSpacing: "0.06em", lineHeight: 1.15 };
|
|
893
1117
|
var ident = { color: "#3cc8ff", fontSize: "0.72em", fontFamily: MONO, minHeight: "1.15em" };
|
|
894
1118
|
function SwapIcon() {
|
|
895
|
-
return /* @__PURE__ */ (0,
|
|
896
|
-
/* @__PURE__ */ (0,
|
|
897
|
-
/* @__PURE__ */ (0,
|
|
1119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.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: [
|
|
1120
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M2 5.5 H14 M11 2.5 l3 3 l-3 3" }),
|
|
1121
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M14 10.5 H2 M5 7.5 l-3 3 l3 3" })
|
|
898
1122
|
] });
|
|
899
1123
|
}
|
|
900
1124
|
function Receiver({ name, unit, value, ident: station, color, format, parse, onChange }) {
|
|
@@ -928,13 +1152,13 @@ function Receiver({ name, unit, value, ident: station, color, format, parse, onC
|
|
|
928
1152
|
if (text && standby === void 0 || standby === value.standby) return;
|
|
929
1153
|
onChange({ active: value.active, standby });
|
|
930
1154
|
};
|
|
931
|
-
return /* @__PURE__ */ (0,
|
|
932
|
-
/* @__PURE__ */ (0,
|
|
933
|
-
/* @__PURE__ */ (0,
|
|
934
|
-
/* @__PURE__ */ (0,
|
|
1155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1156
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: label, children: [
|
|
1157
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: name }),
|
|
1158
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "data-testid": `radio-stack-${key}-ident`, style: ident, children: station ?? "" })
|
|
935
1159
|
] }),
|
|
936
|
-
/* @__PURE__ */ (0,
|
|
937
|
-
/* @__PURE__ */ (0,
|
|
1160
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { "data-testid": `radio-stack-${key}-active`, "aria-label": `${name} active frequency`, style: { ...display, color }, children: format(value.active) }),
|
|
1161
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
938
1162
|
"button",
|
|
939
1163
|
{
|
|
940
1164
|
type: "button",
|
|
@@ -942,10 +1166,10 @@ function Receiver({ name, unit, value, ident: station, color, format, parse, onC
|
|
|
942
1166
|
"aria-label": `Swap ${name} active and standby`,
|
|
943
1167
|
title: "Swap active and standby",
|
|
944
1168
|
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" },
|
|
945
|
-
children: /* @__PURE__ */ (0,
|
|
1169
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SwapIcon, {})
|
|
946
1170
|
}
|
|
947
1171
|
),
|
|
948
|
-
/* @__PURE__ */ (0,
|
|
1172
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
949
1173
|
"input",
|
|
950
1174
|
{
|
|
951
1175
|
type: "text",
|
|
@@ -1007,7 +1231,7 @@ function RadioStack({
|
|
|
1007
1231
|
const heading = { color: MUTED, fontSize: "0.72em", fontWeight: "bold", letterSpacing: "0.12em", textAlign: "center" };
|
|
1008
1232
|
return (
|
|
1009
1233
|
// The outer box is a size container so every inner measurement can follow the width.
|
|
1010
|
-
/* @__PURE__ */ (0,
|
|
1234
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className, style: { display: "inline-block", width, maxWidth: "100%", verticalAlign: "top", containerType: "inline-size", ...style }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1011
1235
|
"div",
|
|
1012
1236
|
{
|
|
1013
1237
|
role: "group",
|
|
@@ -1030,20 +1254,20 @@ function RadioStack({
|
|
|
1030
1254
|
userSelect: "none"
|
|
1031
1255
|
},
|
|
1032
1256
|
children: [
|
|
1033
|
-
SCREWS2.map((position, i) => /* @__PURE__ */ (0,
|
|
1034
|
-
/* @__PURE__ */ (0,
|
|
1035
|
-
/* @__PURE__ */ (0,
|
|
1257
|
+
SCREWS2.map((position, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("svg", { viewBox: "-14 -14 28 28", "aria-hidden": "true", style: { position: "absolute", width: "0.75em", height: "0.75em", ...position }, children: [
|
|
1258
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("circle", { r: "12", fill: "#3a3a3a", stroke: "#111", strokeWidth: "2" }),
|
|
1259
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M -8 3 L 8 -3", stroke: "#111", strokeWidth: "3" })
|
|
1036
1260
|
] }, i)),
|
|
1037
|
-
/* @__PURE__ */ (0,
|
|
1038
|
-
/* @__PURE__ */ (0,
|
|
1039
|
-
/* @__PURE__ */ (0,
|
|
1040
|
-
/* @__PURE__ */ (0,
|
|
1041
|
-
/* @__PURE__ */ (0,
|
|
1042
|
-
/* @__PURE__ */ (0,
|
|
1043
|
-
/* @__PURE__ */ (0,
|
|
1044
|
-
/* @__PURE__ */ (0,
|
|
1045
|
-
/* @__PURE__ */ (0,
|
|
1046
|
-
/* @__PURE__ */ (0,
|
|
1261
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", {}),
|
|
1262
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: heading, children: "ACTIVE" }),
|
|
1263
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", {}),
|
|
1264
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: heading, children: "STBY" }),
|
|
1265
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Receiver, { name: "NAV", unit: "MHz", value: nav ?? innerNav, ident: navIdent, color, format: formatNav, parse: parseNav, onChange: changeNav }),
|
|
1266
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Receiver, { name: "ADF", unit: "kHz", value: adf ?? innerAdf, ident: adfIdent, color, format: formatAdf, parse: parseAdf, onChange: changeAdf }),
|
|
1267
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: label, children: "DME" }),
|
|
1268
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.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: [
|
|
1269
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "data-testid": "radio-stack-dme", children: formatDme(dme) }),
|
|
1270
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { color: MUTED, fontFamily: "'Helvetica Neue', Arial, sans-serif", fontSize: "0.5em" }, children: "NM" })
|
|
1047
1271
|
] })
|
|
1048
1272
|
]
|
|
1049
1273
|
}
|
|
@@ -1052,7 +1276,7 @@ function RadioStack({
|
|
|
1052
1276
|
}
|
|
1053
1277
|
|
|
1054
1278
|
// src/components/DataPanel.tsx
|
|
1055
|
-
var
|
|
1279
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1056
1280
|
var MAX_FIELDS = 6;
|
|
1057
1281
|
var SIDE2 = 252;
|
|
1058
1282
|
var PAD = 8;
|
|
@@ -1072,9 +1296,9 @@ function DataPanel({ fields = [], heading, ...props }) {
|
|
|
1072
1296
|
const cellH = (SIDE2 - PAD * 2 - GAP * (rows - 1)) / rows;
|
|
1073
1297
|
const valueSize = VALUE_SIZE[rows] ?? 27;
|
|
1074
1298
|
const label2 = `${heading ?? "Data panel"}: ` + (shown.length ? shown.map((f) => `${f.name} ${formatValue(f)}${f.unit ? ` ${f.unit}` : ""}`).join(", ") : "no data");
|
|
1075
|
-
return /* @__PURE__ */ (0,
|
|
1076
|
-
heading && /* @__PURE__ */ (0,
|
|
1077
|
-
/* @__PURE__ */ (0,
|
|
1299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
1300
|
+
heading && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("text", { x: CENTER, y: ORIGIN2 - 14, fill: "#ccc", fontSize: "13", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: heading.toUpperCase() }),
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: ORIGIN2, y: ORIGIN2, width: SIDE2, height: SIDE2, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
1078
1302
|
shown.map((f, i) => {
|
|
1079
1303
|
const col = i % cols;
|
|
1080
1304
|
const row = Math.floor(i / cols);
|
|
@@ -1082,10 +1306,10 @@ function DataPanel({ fields = [], heading, ...props }) {
|
|
|
1082
1306
|
const y = ORIGIN2 + PAD + row * (cellH + GAP);
|
|
1083
1307
|
const value = formatValue(f);
|
|
1084
1308
|
const fit = Math.min(valueSize, (cellW - 16) / (0.62 * Math.max(1, value.length)));
|
|
1085
|
-
return /* @__PURE__ */ (0,
|
|
1086
|
-
/* @__PURE__ */ (0,
|
|
1087
|
-
/* @__PURE__ */ (0,
|
|
1088
|
-
/* @__PURE__ */ (0,
|
|
1309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("g", { "data-testid": `data-field-${i}`, children: [
|
|
1310
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x, y, width: cellW, height: cellH, rx: "6", fill: "#000", stroke: "#262a30", strokeWidth: "1" }),
|
|
1311
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("text", { x: x + 8, y: y + 12, fill: "#9aa4b1", fontSize: "12", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children: f.name.toUpperCase() }),
|
|
1312
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1089
1313
|
"text",
|
|
1090
1314
|
{
|
|
1091
1315
|
"data-testid": `data-value-${i}`,
|
|
@@ -1100,14 +1324,14 @@ function DataPanel({ fields = [], heading, ...props }) {
|
|
|
1100
1324
|
children: value
|
|
1101
1325
|
}
|
|
1102
1326
|
),
|
|
1103
|
-
f.unit && /* @__PURE__ */ (0,
|
|
1327
|
+
f.unit && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("text", { x: x + cellW - 8, y: y + cellH - 12, fill: "#9aa4b1", fontSize: "12", textAnchor: "end", dominantBaseline: "central", children: f.unit })
|
|
1104
1328
|
] }, i);
|
|
1105
1329
|
})
|
|
1106
1330
|
] });
|
|
1107
1331
|
}
|
|
1108
1332
|
|
|
1109
1333
|
// src/components/FuelIndicator.tsx
|
|
1110
|
-
var
|
|
1334
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1111
1335
|
var MAX_TANKS = 4;
|
|
1112
1336
|
var GREEN2 = "#2ee05a";
|
|
1113
1337
|
var RED = "#ff3b3b";
|
|
@@ -1150,16 +1374,16 @@ function FuelIndicator({
|
|
|
1150
1374
|
return { name: t.name, qty, cap, fraction, full, isLow, text: full ? "FULL" : qty.toFixed(places) };
|
|
1151
1375
|
});
|
|
1152
1376
|
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");
|
|
1153
|
-
return /* @__PURE__ */ (0,
|
|
1154
|
-
/* @__PURE__ */ (0,
|
|
1377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(InstrumentFrame, { ...props, label: title, children: [
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: ORIGIN3, y: ORIGIN3, width: SIDE3, height: SIDE3, rx: "10", fill: "#000", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
1155
1379
|
readings.map((r, i) => {
|
|
1156
1380
|
const cx = INNER_LEFT + colW * (i + 0.5);
|
|
1157
1381
|
const color = r.isLow ? RED : GREEN2;
|
|
1158
1382
|
const tickX = cx - barW / 2 - 14;
|
|
1159
|
-
return /* @__PURE__ */ (0,
|
|
1160
|
-
i > 0 && /* @__PURE__ */ (0,
|
|
1161
|
-
/* @__PURE__ */ (0,
|
|
1162
|
-
/* @__PURE__ */ (0,
|
|
1383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { "data-testid": `fuel-tank-${i}`, children: [
|
|
1384
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: `M ${INNER_LEFT + colW * i} ${ORIGIN3 + 10} V ${FOOTER_Y}`, stroke: "#555", strokeWidth: "1.5" }),
|
|
1385
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.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() }),
|
|
1386
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { strokeWidth: "2.5", strokeLinecap: "round", children: [0, 0.25, 0.5, 0.75, 1].map((f) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1163
1387
|
"path",
|
|
1164
1388
|
{
|
|
1165
1389
|
d: `M ${tickX - 7} ${BAR_BOTTOM - f * BAR_H} h 7`,
|
|
@@ -1167,9 +1391,9 @@ function FuelIndicator({
|
|
|
1167
1391
|
},
|
|
1168
1392
|
f
|
|
1169
1393
|
)) }),
|
|
1170
|
-
/* @__PURE__ */ (0,
|
|
1171
|
-
/* @__PURE__ */ (0,
|
|
1172
|
-
/* @__PURE__ */ (0,
|
|
1394
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: "#15181c" }),
|
|
1395
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { "data-testid": `fuel-bar-${i}`, style: motionStyle(`scaleY(${r.fraction})`, duration, cx, BAR_BOTTOM), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: color }) }),
|
|
1396
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1173
1397
|
"text",
|
|
1174
1398
|
{
|
|
1175
1399
|
"data-testid": `fuel-value-${i}`,
|
|
@@ -1184,29 +1408,29 @@ function FuelIndicator({
|
|
|
1184
1408
|
children: r.text
|
|
1185
1409
|
}
|
|
1186
1410
|
),
|
|
1187
|
-
/* @__PURE__ */ (0,
|
|
1411
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: cx, y: BAR_BOTTOM + 44, fill: "#fff", fontSize: "13", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: unit })
|
|
1188
1412
|
] }, i);
|
|
1189
1413
|
}),
|
|
1190
|
-
/* @__PURE__ */ (0,
|
|
1191
|
-
/* @__PURE__ */ (0,
|
|
1414
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: `M ${ORIGIN3 + 8} ${FOOTER_Y} H ${ORIGIN3 + SIDE3 - 8}`, stroke: "#555", strokeWidth: "1.5" }),
|
|
1415
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: CENTER, y: FOOTER_Y + 19, fill: "#fff", fontSize: "24", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: label2.toUpperCase() })
|
|
1192
1416
|
] });
|
|
1193
1417
|
}
|
|
1194
1418
|
|
|
1195
1419
|
// src/components/EngineIndicator.tsx
|
|
1196
|
-
var
|
|
1420
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1197
1421
|
var MAX_CYLINDERS = 6;
|
|
1198
1422
|
var MAX_BAR_GAUGES = 4;
|
|
1199
1423
|
var GREEN3 = "#5fe04a";
|
|
1200
|
-
var
|
|
1424
|
+
var YELLOW2 = "#ffd400";
|
|
1201
1425
|
var RED2 = "#ff3030";
|
|
1202
1426
|
var BLUE = "#4fb7e8";
|
|
1203
1427
|
var LABEL2 = "#b9c8e6";
|
|
1204
1428
|
var LINE = "#8a8f99";
|
|
1205
|
-
var
|
|
1429
|
+
var round22 = (n) => Math.round(n * 100) / 100;
|
|
1206
1430
|
var DIAL_R = 182;
|
|
1207
1431
|
function chord(y, inset = 8) {
|
|
1208
1432
|
const half = Math.sqrt(Math.max(0, DIAL_R * DIAL_R - (y - CENTER) ** 2)) - inset;
|
|
1209
|
-
return `M ${
|
|
1433
|
+
return `M ${round22(CENTER - half)} ${y} H ${round22(CENTER + half)}`;
|
|
1210
1434
|
}
|
|
1211
1435
|
var DEFAULT_MANIFOLD = { min: 10, max: 35, green: [15, 29], yellow: [29, 31], high: 31, unit: "IN", decimals: 1 };
|
|
1212
1436
|
var DEFAULT_RPM = { min: 0, max: 3e3, green: [800, 2500], yellow: [2500, 2700], high: 2700, decimals: 0 };
|
|
@@ -1232,7 +1456,7 @@ function resolve(g, defaults = {}) {
|
|
|
1232
1456
|
min,
|
|
1233
1457
|
max,
|
|
1234
1458
|
fraction,
|
|
1235
|
-
color: inRed ? RED2 : inYellow ?
|
|
1459
|
+
color: inRed ? RED2 : inYellow ? YELLOW2 : "#fff",
|
|
1236
1460
|
text: value.toFixed(decimals),
|
|
1237
1461
|
unit: g.unit ?? defaults.unit,
|
|
1238
1462
|
green: g.green ?? defaults.green,
|
|
@@ -1251,22 +1475,22 @@ function arcAt(cx, cy, r, a0, a1) {
|
|
|
1251
1475
|
}
|
|
1252
1476
|
function ArcGauge({ cx, label: label2, g, duration, testId }) {
|
|
1253
1477
|
const span = g.max - g.min;
|
|
1254
|
-
const angle = (v) =>
|
|
1255
|
-
const band = (from, to, color) => /* @__PURE__ */ (0,
|
|
1478
|
+
const angle = (v) => round22(-ARC_SWEEP + 2 * ARC_SWEEP * clamp((v - g.min) / span, 0, 1));
|
|
1479
|
+
const band = (from, to, color) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: arcAt(cx, ARC_Y, ARC_R, angle(from), angle(to)), stroke: color, strokeWidth: "6", fill: "none" });
|
|
1256
1480
|
const [tipX, tipY] = polar(ARC_R - 4, 0, cx, ARC_Y);
|
|
1257
1481
|
const [lx, ly] = polar(ARC_R - 16, -7, cx, ARC_Y);
|
|
1258
1482
|
const [rx, ry] = polar(ARC_R - 16, 7, cx, ARC_Y);
|
|
1259
|
-
return /* @__PURE__ */ (0,
|
|
1260
|
-
/* @__PURE__ */ (0,
|
|
1483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
|
|
1484
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: arcAt(cx, ARC_Y, ARC_R, -ARC_SWEEP, ARC_SWEEP), stroke: "#fff", strokeWidth: "1.5", fill: "none" }),
|
|
1261
1485
|
g.green && band(g.green[0], g.green[1], GREEN3),
|
|
1262
|
-
g.yellow && band(g.yellow[0], g.yellow[1],
|
|
1486
|
+
g.yellow && band(g.yellow[0], g.yellow[1], YELLOW2),
|
|
1263
1487
|
g.low !== void 0 && band(g.min, g.low, RED2),
|
|
1264
1488
|
g.high !== void 0 && band(g.high, g.max, RED2),
|
|
1265
|
-
/* @__PURE__ */ (0,
|
|
1266
|
-
/* @__PURE__ */ (0,
|
|
1267
|
-
/* @__PURE__ */ (0,
|
|
1489
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { "data-testid": testId, style: motionStyle(`rotate(${angle(g.value)}deg)`, duration, cx, ARC_Y), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${tipX} ${tipY} L ${lx} ${ly} L ${rx} ${ry} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
|
|
1490
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: cx, y: ARC_Y - 20, fill: LABEL2, fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: label2 }),
|
|
1491
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("text", { x: cx, y: ARC_Y + 4, fill: g.color, fontSize: "28", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
1268
1492
|
g.text,
|
|
1269
|
-
g.unit && /* @__PURE__ */ (0,
|
|
1493
|
+
g.unit && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tspan", { fontSize: "11", dx: "2", children: g.unit })
|
|
1270
1494
|
] })
|
|
1271
1495
|
] });
|
|
1272
1496
|
}
|
|
@@ -1276,28 +1500,28 @@ var BAR_ROW_H = 39;
|
|
|
1276
1500
|
var BAR_TOP2 = 137;
|
|
1277
1501
|
function BarGauge({ top, g, label: label2, duration, testId }) {
|
|
1278
1502
|
const y = top + 14;
|
|
1279
|
-
const at = (v) =>
|
|
1280
|
-
const seg = (from, to, color, w = 7) => /* @__PURE__ */ (0,
|
|
1281
|
-
return /* @__PURE__ */ (0,
|
|
1282
|
-
/* @__PURE__ */ (0,
|
|
1283
|
-
/* @__PURE__ */ (0,
|
|
1503
|
+
const at = (v) => round22(BAR_X0 + (BAR_X1 - BAR_X0) * clamp((v - g.min) / (g.max - g.min), 0, 1));
|
|
1504
|
+
const seg = (from, to, color, w = 7) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${at(from)} ${y} H ${at(to)}`, stroke: color, strokeWidth: w });
|
|
1505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${BAR_X0} ${y} H ${BAR_X1}`, stroke: "#fff", strokeWidth: "2" }),
|
|
1507
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${BAR_X0} ${y - 4} v 8 M ${BAR_X1} ${y - 4} v 8`, stroke: "#fff", strokeWidth: "2" }),
|
|
1284
1508
|
g.green && seg(g.green[0], g.green[1], GREEN3),
|
|
1285
|
-
g.yellow && seg(g.yellow[0], g.yellow[1],
|
|
1509
|
+
g.yellow && seg(g.yellow[0], g.yellow[1], YELLOW2),
|
|
1286
1510
|
g.low !== void 0 && seg(g.min, g.low, RED2),
|
|
1287
1511
|
g.high !== void 0 && seg(g.high, g.max, RED2),
|
|
1288
|
-
/* @__PURE__ */ (0,
|
|
1289
|
-
/* @__PURE__ */ (0,
|
|
1290
|
-
/* @__PURE__ */ (0,
|
|
1291
|
-
g.unit && /* @__PURE__ */ (0,
|
|
1512
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { "data-testid": testId, style: motionStyle(`translate(${round22(at(g.value) - BAR_X0)}px, 0px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${BAR_X0} ${y - 3} l -5 -9 h 10 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: BAR_X0, y: top + 31, fill: LABEL2, fontSize: "13", fontWeight: "bold", dominantBaseline: "central", children: label2 }),
|
|
1514
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: 350, y: top + 15, fill: g.color, fontSize: "20", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.text }),
|
|
1515
|
+
g.unit && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: 350, y: top + 31, fill: LABEL2, fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.unit })
|
|
1292
1516
|
] });
|
|
1293
1517
|
}
|
|
1294
1518
|
function Tank({ x, fraction, duration, testId }) {
|
|
1295
1519
|
const top = 304;
|
|
1296
1520
|
const h = 40;
|
|
1297
|
-
return /* @__PURE__ */ (0,
|
|
1298
|
-
/* @__PURE__ */ (0,
|
|
1299
|
-
/* @__PURE__ */ (0,
|
|
1300
|
-
/* @__PURE__ */ (0,
|
|
1521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
|
|
1522
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: x - 7, y: top, width: "14", height: h, rx: "3", fill: "#000", stroke: "#fff", strokeWidth: "1.5" }),
|
|
1523
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { "data-testid": testId, style: motionStyle(`scaleY(${fraction})`, duration, x, top + h - 2), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: x - 5.5, y: top + 2, width: "11", height: h - 4, fill: BLUE }) }),
|
|
1524
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: x - 5.5, y: top + h - 5, width: "11", height: "3", fill: RED2 })
|
|
1301
1525
|
] });
|
|
1302
1526
|
}
|
|
1303
1527
|
var hottest = (values) => {
|
|
@@ -1365,81 +1589,81 @@ function EngineIndicator({
|
|
|
1365
1589
|
fuelLeft !== void 0 || fuelRight !== void 0 ? `fuel ${fmt(fuelLeft)}/${fmt(fuelRight)} ${fuelUnit}` : null,
|
|
1366
1590
|
volts !== void 0 ? `${fmt(volts, 1)} V` : null
|
|
1367
1591
|
].filter(Boolean).join(", ");
|
|
1368
|
-
return /* @__PURE__ */ (0,
|
|
1369
|
-
power !== void 0 && /* @__PURE__ */ (0,
|
|
1370
|
-
/* @__PURE__ */ (0,
|
|
1592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
1593
|
+
power !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("text", { x: CENTER, y: 44, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
1594
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("tspan", { fill: LABEL2, fontSize: "11", children: [
|
|
1371
1595
|
"POWER",
|
|
1372
1596
|
" "
|
|
1373
1597
|
] }),
|
|
1374
1598
|
fmt(power),
|
|
1375
|
-
/* @__PURE__ */ (0,
|
|
1599
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tspan", { fontSize: "11", children: "%" })
|
|
1376
1600
|
] }),
|
|
1377
|
-
/* @__PURE__ */ (0,
|
|
1378
|
-
/* @__PURE__ */ (0,
|
|
1379
|
-
/* @__PURE__ */ (0,
|
|
1380
|
-
/* @__PURE__ */ (0,
|
|
1381
|
-
/* @__PURE__ */ (0,
|
|
1382
|
-
/* @__PURE__ */ (0,
|
|
1383
|
-
/* @__PURE__ */ (0,
|
|
1601
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ArcGauge, { cx: 118, label: "MAN", g: man, duration, testId: "engine-man" }),
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ArcGauge, { cx: 282, label: "RPM", g: speed, duration, testId: "engine-rpm" }),
|
|
1603
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { stroke: LINE, strokeWidth: "1.5", children: [
|
|
1604
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: chord(133) }),
|
|
1605
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M 200 133 V 298" }),
|
|
1606
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: chord(298) }),
|
|
1607
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M 136 298 V 348 M 264 298 V 348" })
|
|
1384
1608
|
] }),
|
|
1385
|
-
/* @__PURE__ */ (0,
|
|
1386
|
-
/* @__PURE__ */ (0,
|
|
1609
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: readouts.map((r) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
|
|
1610
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("text", { x: r.x, y: 144, fill: LABEL2, fontSize: "13", children: [
|
|
1387
1611
|
r.name,
|
|
1388
|
-
/* @__PURE__ */ (0,
|
|
1612
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tspan", { fontSize: "9", children: temperatureUnit })
|
|
1389
1613
|
] }),
|
|
1390
|
-
/* @__PURE__ */ (0,
|
|
1614
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { "data-testid": `engine-${r.name.toLowerCase()}`, x: r.x, y: 165, fill: r.color, fontSize: "22", children: fmt(r.value) })
|
|
1391
1615
|
] }, r.name)) }),
|
|
1392
|
-
/* @__PURE__ */ (0,
|
|
1393
|
-
columns > 0 && /* @__PURE__ */ (0,
|
|
1394
|
-
/* @__PURE__ */ (0,
|
|
1395
|
-
/* @__PURE__ */ (0,
|
|
1616
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M 40 178 H 190", stroke: LINE, strokeWidth: "1" }),
|
|
1617
|
+
columns > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
|
|
1618
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${chartX0} ${limitY} H ${chartX1}`, stroke: RED2, strokeWidth: "1.5", strokeDasharray: "5 4" }),
|
|
1619
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: chartX0 - 4, y: limitY, fill: "#fff", fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: "CHT" }),
|
|
1396
1620
|
Array.from({ length: cylinders }, (_, i) => {
|
|
1397
1621
|
const x0 = chartX0 + colW * i;
|
|
1398
1622
|
const mid = x0 + colW / 2;
|
|
1399
1623
|
const c = chtValues[i];
|
|
1400
1624
|
const e = egtValues[i];
|
|
1401
|
-
return /* @__PURE__ */ (0,
|
|
1402
|
-
c !== void 0 && /* @__PURE__ */ (0,
|
|
1403
|
-
e !== void 0 && /* @__PURE__ */ (0,
|
|
1404
|
-
/* @__PURE__ */ (0,
|
|
1625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
|
|
1626
|
+
c !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { "data-testid": `engine-cht-${i}`, style: motionStyle(`scaleY(${chtFrac(c)})`, duration, mid, chartBase), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: mid - barW - 1, y: chartBase - chartH, width: barW, height: chartH, fill: GREEN3 }) }),
|
|
1627
|
+
e !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { "data-testid": `engine-egt-${i}`, style: motionStyle(`scaleY(${egtFrac(e)})`, duration, mid, chartBase), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: mid + 1, y: chartBase - chartH, width: barW, height: chartH, fill: BLUE }) }),
|
|
1628
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: mid, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: i + 1 })
|
|
1405
1629
|
] }, i);
|
|
1406
1630
|
}),
|
|
1407
|
-
hasTit && /* @__PURE__ */ (0,
|
|
1408
|
-
/* @__PURE__ */ (0,
|
|
1409
|
-
/* @__PURE__ */ (0,
|
|
1631
|
+
hasTit && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
|
|
1632
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { "data-testid": "engine-tit-bar", style: motionStyle(`scaleY(${egtFrac(tit)})`, duration, chartX1 - colW / 2, chartBase), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: chartX1 - colW / 2 - barW / 2, y: chartBase - chartH, width: barW, height: chartH, fill: "#fff" }) }),
|
|
1633
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: chartX1 - colW / 2, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "T" })
|
|
1410
1634
|
] })
|
|
1411
1635
|
] }),
|
|
1412
|
-
bars.map((b, i) => /* @__PURE__ */ (0,
|
|
1413
|
-
i > 0 && /* @__PURE__ */ (0,
|
|
1414
|
-
/* @__PURE__ */ (0,
|
|
1636
|
+
bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
|
|
1637
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M 206 ${BAR_TOP2 + BAR_ROW_H * i - 2} H 352`, stroke: LINE, strokeWidth: "1" }),
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BarGauge, { top: BAR_TOP2 + BAR_ROW_H * i, g: b.g, label: b.label, duration, testId: `engine-bar-${i}` })
|
|
1415
1639
|
] }, b.label)),
|
|
1416
|
-
/* @__PURE__ */ (0,
|
|
1417
|
-
/* @__PURE__ */ (0,
|
|
1640
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
1641
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("text", { "data-testid": "engine-amps", x: 104, y: 318, fill: "#fff", fontSize: "20", children: [
|
|
1418
1642
|
fmt(amps),
|
|
1419
|
-
/* @__PURE__ */ (0,
|
|
1643
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tspan", { fontSize: "11", dx: "2", children: "A" })
|
|
1420
1644
|
] }),
|
|
1421
|
-
/* @__PURE__ */ (0,
|
|
1422
|
-
/* @__PURE__ */ (0,
|
|
1423
|
-
/* @__PURE__ */ (0,
|
|
1424
|
-
/* @__PURE__ */ (0,
|
|
1645
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: 104, y: 338, fill: LABEL2, fontSize: "13", children: "ALT" }),
|
|
1646
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tank, { x: 152, fraction: left / cap, duration, testId: "engine-fuel-left" }),
|
|
1647
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tank, { x: 248, fraction: right / cap, duration, testId: "engine-fuel-right" }),
|
|
1648
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("text", { "data-testid": "engine-fuel", x: 200, y: 316, fill: "#fff", fontSize: "20", children: [
|
|
1425
1649
|
fmt(left),
|
|
1426
|
-
/* @__PURE__ */ (0,
|
|
1650
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tspan", { dx: "14", children: fmt(right) })
|
|
1427
1651
|
] }),
|
|
1428
|
-
/* @__PURE__ */ (0,
|
|
1429
|
-
/* @__PURE__ */ (0,
|
|
1430
|
-
/* @__PURE__ */ (0,
|
|
1652
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: 200, y: 335, fill: LABEL2, fontSize: "13", children: "Fuel" }),
|
|
1653
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: 200, y: 348, fill: LABEL2, fontSize: "9", children: fuelUnit }),
|
|
1654
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("text", { "data-testid": "engine-volts", x: 296, y: 318, fill: "#fff", fontSize: "20", children: [
|
|
1431
1655
|
fmt(volts, 1),
|
|
1432
|
-
/* @__PURE__ */ (0,
|
|
1656
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tspan", { fontSize: "11", dx: "2", children: "V" })
|
|
1433
1657
|
] }),
|
|
1434
|
-
/* @__PURE__ */ (0,
|
|
1658
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: 296, y: 338, fill: LABEL2, fontSize: "13", children: "BATT" })
|
|
1435
1659
|
] })
|
|
1436
1660
|
] });
|
|
1437
1661
|
}
|
|
1438
1662
|
|
|
1439
1663
|
// src/components/FlapIndicator.tsx
|
|
1440
|
-
var
|
|
1664
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1441
1665
|
var GREEN4 = "#3ddc3d";
|
|
1442
|
-
var
|
|
1666
|
+
var YELLOW3 = "#ffd400";
|
|
1443
1667
|
var ORANGE = "#ff8a00";
|
|
1444
1668
|
var RED3 = "#ff2a2a";
|
|
1445
1669
|
var BAR_X = 226;
|
|
@@ -1449,7 +1673,7 @@ var BAR_BOTTOM2 = 302;
|
|
|
1449
1673
|
var BAR_H2 = BAR_BOTTOM2 - BAR_TOP3;
|
|
1450
1674
|
function segmentColor(fraction) {
|
|
1451
1675
|
if (fraction < 0.25) return GREEN4;
|
|
1452
|
-
if (fraction < 0.5) return
|
|
1676
|
+
if (fraction < 0.5) return YELLOW3;
|
|
1453
1677
|
if (fraction < 0.75) return ORANGE;
|
|
1454
1678
|
return RED3;
|
|
1455
1679
|
}
|
|
@@ -1470,18 +1694,18 @@ function FlapIndicator({
|
|
|
1470
1694
|
const count = Math.max(1, Math.floor(finite(segments, 20)));
|
|
1471
1695
|
const lit = Math.round(fraction * count);
|
|
1472
1696
|
const scale = (detents ?? Array.from({ length: Math.floor(full / 10) + 1 }, (_, i) => i * 10)).filter((d) => d >= 0 && d <= full);
|
|
1473
|
-
const yAt = (
|
|
1697
|
+
const yAt = (deg2) => Math.round((BAR_TOP3 + deg2 / full * BAR_H2) * 100) / 100;
|
|
1474
1698
|
const limit = (speedLimits ?? []).filter((l) => Number.isFinite(l.flaps) && Number.isFinite(l.speed) && l.flaps <= position).sort((a, b) => b.flaps - a.flaps)[0];
|
|
1475
1699
|
const ias = finite(airspeed, NaN);
|
|
1476
1700
|
const overspeed = limit !== void 0 && !Number.isNaN(ias) && ias > limit.speed;
|
|
1477
1701
|
const segH = BAR_H2 / count;
|
|
1478
1702
|
const title = `${label2}: ${Math.round(position)}\xB0 of ${Math.round(full)}\xB0` + (limit ? `, max ${Math.round(limit.speed)} knots${overspeed ? " (overspeed)" : ""}` : "");
|
|
1479
|
-
return /* @__PURE__ */ (0,
|
|
1480
|
-
/* @__PURE__ */ (0,
|
|
1703
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(InstrumentFrame, { ...props, label: title, children: [
|
|
1704
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.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" }),
|
|
1481
1705
|
Array.from({ length: count }, (_, i) => {
|
|
1482
1706
|
const y = BAR_TOP3 + i * segH;
|
|
1483
1707
|
const on = i < lit;
|
|
1484
|
-
return /* @__PURE__ */ (0,
|
|
1708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1485
1709
|
"rect",
|
|
1486
1710
|
{
|
|
1487
1711
|
"data-testid": `flap-segment-${i}`,
|
|
@@ -1498,24 +1722,24 @@ function FlapIndicator({
|
|
|
1498
1722
|
i
|
|
1499
1723
|
);
|
|
1500
1724
|
}),
|
|
1501
|
-
/* @__PURE__ */ (0,
|
|
1502
|
-
/* @__PURE__ */ (0,
|
|
1503
|
-
/* @__PURE__ */ (0,
|
|
1725
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { fill: "#fff", fontSize: "18", fontWeight: "bold", dominantBaseline: "central", children: scale.map((d) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
|
|
1726
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${BAR_X + BAR_W / 2 + 8} ${yAt(d)} h 8`, stroke: "#fff", strokeWidth: "2" }),
|
|
1727
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: BAR_X + BAR_W / 2 + 22, y: yAt(d), children: d })
|
|
1504
1728
|
] }, d)) }),
|
|
1505
|
-
/* @__PURE__ */ (0,
|
|
1506
|
-
limit && /* @__PURE__ */ (0,
|
|
1507
|
-
/* @__PURE__ */ (0,
|
|
1729
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { "data-testid": "flap-pointer", style: motionStyle(`translate(0px, ${yAt(position) - BAR_TOP3}px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${BAR_X - BAR_W / 2 - 8} ${BAR_TOP3} l -14 -8 v 16 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
|
|
1730
|
+
limit && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { textAnchor: "middle", dominantBaseline: "central", fill: overspeed ? RED3 : "#fff", children: [
|
|
1731
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("text", { "data-testid": "flap-speed", x: 118, y: 176, fontSize: "36", fontWeight: "bold", children: [
|
|
1508
1732
|
Math.round(limit.speed),
|
|
1509
|
-
/* @__PURE__ */ (0,
|
|
1733
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tspan", { fontSize: "13", dx: "3", children: "KTS" })
|
|
1510
1734
|
] }),
|
|
1511
|
-
/* @__PURE__ */ (0,
|
|
1735
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: 118, y: 212, fontSize: "13", fontWeight: "bold", fill: "#bbb", letterSpacing: "2", children: "MAX" })
|
|
1512
1736
|
] }),
|
|
1513
|
-
/* @__PURE__ */ (0,
|
|
1737
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: CENTER, y: 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
|
|
1514
1738
|
] });
|
|
1515
1739
|
}
|
|
1516
1740
|
|
|
1517
1741
|
// src/components/AoaIndicator.tsx
|
|
1518
|
-
var
|
|
1742
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1519
1743
|
var GREEN5 = "#3ddc3d";
|
|
1520
1744
|
var AMBER4 = "#ffb000";
|
|
1521
1745
|
var RED4 = "#ff2a2a";
|
|
@@ -1543,20 +1767,20 @@ function RowShape({ shape, y }) {
|
|
|
1543
1767
|
const r = CENTER + HALF;
|
|
1544
1768
|
switch (shape) {
|
|
1545
1769
|
case "bar":
|
|
1546
|
-
return /* @__PURE__ */ (0,
|
|
1770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: HALF * 2, height: BAR_H3, rx: "2" });
|
|
1547
1771
|
case "split":
|
|
1548
|
-
return /* @__PURE__ */ (0,
|
|
1549
|
-
/* @__PURE__ */ (0,
|
|
1550
|
-
/* @__PURE__ */ (0,
|
|
1772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1773
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" }),
|
|
1774
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: r - 50, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" })
|
|
1551
1775
|
] });
|
|
1552
1776
|
case "donut":
|
|
1553
|
-
return /* @__PURE__ */ (0,
|
|
1554
|
-
/* @__PURE__ */ (0,
|
|
1555
|
-
/* @__PURE__ */ (0,
|
|
1556
|
-
/* @__PURE__ */ (0,
|
|
1777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1778
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
|
|
1779
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: CENTER + 24, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
|
|
1780
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("circle", { cx: CENTER, cy: y, r: 13, fill: "none", strokeWidth: "7" })
|
|
1557
1781
|
] });
|
|
1558
1782
|
case "chevron":
|
|
1559
|
-
return /* @__PURE__ */ (0,
|
|
1783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: `M ${l} ${y} L ${CENTER} ${y + CHEVRON_DEPTH} L ${r} ${y}`, fill: "none", strokeWidth: "11", strokeLinejoin: "miter" });
|
|
1560
1784
|
}
|
|
1561
1785
|
}
|
|
1562
1786
|
function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false, label: label2 = "AOA", ...props }) {
|
|
@@ -1570,11 +1794,11 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1570
1794
|
const reading = Number.isNaN(value) ? "---" : `${value.toFixed(1)}\xB0`;
|
|
1571
1795
|
const state = stall ? " (stall warning)" : lit > DONUT + 1 ? " (high)" : lit === DONUT + 1 ? " (optimum)" : "";
|
|
1572
1796
|
const title = `${label2}: ${reading}${Number.isNaN(value) ? "" : state}`;
|
|
1573
|
-
return /* @__PURE__ */ (0,
|
|
1574
|
-
/* @__PURE__ */ (0,
|
|
1797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(InstrumentFrame, { ...props, label: title, children: [
|
|
1798
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: CENTER - HALF - 10, y: 40, width: (HALF + 10) * 2, height: 278, rx: "10", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
|
|
1575
1799
|
ROWS.map((row, i) => {
|
|
1576
1800
|
const on = i < lit;
|
|
1577
|
-
return /* @__PURE__ */ (0,
|
|
1801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1578
1802
|
"g",
|
|
1579
1803
|
{
|
|
1580
1804
|
"data-testid": `aoa-row-${i}`,
|
|
@@ -1585,15 +1809,15 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1585
1809
|
opacity: on ? 1 : UNLIT_OPACITY,
|
|
1586
1810
|
style: { transition: "opacity 150ms ease-out" },
|
|
1587
1811
|
children: [
|
|
1588
|
-
/* @__PURE__ */ (0,
|
|
1589
|
-
on && stall && row.shape === "chevron" && /* @__PURE__ */ (0,
|
|
1812
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RowShape, { shape: row.shape, y: row.y }),
|
|
1813
|
+
on && stall && row.shape === "chevron" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("animate", { attributeName: "opacity", values: "1;0.25;1", dur: "0.6s", repeatCount: "indefinite" })
|
|
1590
1814
|
]
|
|
1591
1815
|
},
|
|
1592
1816
|
i
|
|
1593
1817
|
);
|
|
1594
1818
|
}),
|
|
1595
|
-
showValue && /* @__PURE__ */ (0,
|
|
1596
|
-
/* @__PURE__ */ (0,
|
|
1819
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("text", { "data-testid": "aoa-value", x: CENTER, y: 340, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", children: reading }),
|
|
1820
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("text", { x: CENTER, y: showValue ? 362 : 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
|
|
1597
1821
|
] });
|
|
1598
1822
|
}
|
|
1599
1823
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1611,6 +1835,7 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1611
1835
|
FlapIndicator,
|
|
1612
1836
|
FuelIndicator,
|
|
1613
1837
|
HeadingIndicator,
|
|
1838
|
+
IlsIndicator,
|
|
1614
1839
|
MAX_BAR_GAUGES,
|
|
1615
1840
|
MAX_CYLINDERS,
|
|
1616
1841
|
MAX_FIELDS,
|