@oicl/openbridge-webcomponents 0.0.15-dev-20240916083108 → 0.0.15-dev-20240923184809

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. package/.storybook/main.ts +8 -0
  2. package/.storybook/preview.ts +2 -0
  3. package/__snapshots__/building-blocks-watch--advice.png +0 -0
  4. package/__snapshots__/building-blocks-watch-flat--primary.png +0 -0
  5. package/__snapshots__/navigation-instruments-azimuth-thruster--in-command-at-setpoint-disable-auto-setpoint.png +0 -0
  6. package/__snapshots__/navigation-instruments-azimuth-thruster--in-command-at-setpoint.png +0 -0
  7. package/__snapshots__/navigation-instruments-azimuth-thruster--in-command.png +0 -0
  8. package/__snapshots__/navigation-instruments-azimuth-thruster--pod.png +0 -0
  9. package/__snapshots__/navigation-instruments-azimuth-thruster--single-direction-with-propeller.png +0 -0
  10. package/__snapshots__/navigation-instruments-azimuth-thruster--single-direction.png +0 -0
  11. package/__snapshots__/navigation-instruments-azimuth-thruster-labeled--large.png +0 -0
  12. package/__snapshots__/navigation-instruments-azimuth-thruster-labeled--medium.png +0 -0
  13. package/__snapshots__/navigation-instruments-azimuth-thruster-labeled--no-command.png +0 -0
  14. package/__snapshots__/navigation-instruments-compass--primary.png +0 -0
  15. package/__snapshots__/navigation-instruments-compass-flat--primary.png +0 -0
  16. package/__snapshots__/navigation-instruments-compass-flat--with-fov-indicator.png +0 -0
  17. package/__snapshots__/navigation-instruments-main-engine--active.png +0 -0
  18. package/__snapshots__/navigation-instruments-main-engine--in-command.png +0 -0
  19. package/__snapshots__/navigation-instruments-main-engine--off.png +0 -0
  20. package/__snapshots__/navigation-instruments-thruster--tunnel.png +0 -0
  21. package/custom-elements.json +2184 -660
  22. package/dist/navigation-instruments/azimuth-thruster/azimuth-thruster.d.ts.map +1 -1
  23. package/dist/navigation-instruments/azimuth-thruster/azimuth-thruster.js +2 -1
  24. package/dist/navigation-instruments/azimuth-thruster/azimuth-thruster.js.map +1 -1
  25. package/dist/navigation-instruments/compass/arrow.d.ts +7 -0
  26. package/dist/navigation-instruments/compass/arrow.d.ts.map +1 -0
  27. package/dist/navigation-instruments/compass/arrow.js +59 -0
  28. package/dist/navigation-instruments/compass/arrow.js.map +1 -0
  29. package/dist/navigation-instruments/compass/compass.d.ts +23 -0
  30. package/dist/navigation-instruments/compass/compass.d.ts.map +1 -0
  31. package/dist/navigation-instruments/compass/compass.js +139 -0
  32. package/dist/navigation-instruments/compass/compass.js.map +1 -0
  33. package/dist/navigation-instruments/compass/radial-tickmark.d.ts +4 -0
  34. package/dist/navigation-instruments/compass/radial-tickmark.d.ts.map +1 -0
  35. package/dist/navigation-instruments/compass/radial-tickmark.js +69 -0
  36. package/dist/navigation-instruments/compass/radial-tickmark.js.map +1 -0
  37. package/dist/navigation-instruments/compass-flat/compass-flat.css.js +29 -0
  38. package/dist/navigation-instruments/compass-flat/compass-flat.css.js.map +1 -0
  39. package/dist/navigation-instruments/compass-flat/compass-flat.d.ts +45 -0
  40. package/dist/navigation-instruments/compass-flat/compass-flat.d.ts.map +1 -0
  41. package/dist/navigation-instruments/compass-flat/compass-flat.js +223 -0
  42. package/dist/navigation-instruments/compass-flat/compass-flat.js.map +1 -0
  43. package/dist/navigation-instruments/main-engine/main-engine.css.js +22 -0
  44. package/dist/navigation-instruments/main-engine/main-engine.css.js.map +1 -0
  45. package/dist/navigation-instruments/main-engine/main-engine.d.ts +29 -0
  46. package/dist/navigation-instruments/main-engine/main-engine.d.ts.map +1 -0
  47. package/dist/navigation-instruments/main-engine/main-engine.js +196 -0
  48. package/dist/navigation-instruments/main-engine/main-engine.js.map +1 -0
  49. package/dist/navigation-instruments/thruster/advice.d.ts.map +1 -1
  50. package/dist/navigation-instruments/thruster/advice.js +9 -5
  51. package/dist/navigation-instruments/thruster/advice.js.map +1 -1
  52. package/dist/navigation-instruments/thruster/thruster.d.ts +54 -1
  53. package/dist/navigation-instruments/thruster/thruster.d.ts.map +1 -1
  54. package/dist/navigation-instruments/thruster/thruster.js +163 -99
  55. package/dist/navigation-instruments/thruster/thruster.js.map +1 -1
  56. package/dist/navigation-instruments/watch/advice.js +1 -1
  57. package/dist/navigation-instruments/watch/advice.js.map +1 -1
  58. package/dist/navigation-instruments/watch/label.d.ts +3 -0
  59. package/dist/navigation-instruments/watch/label.d.ts.map +1 -0
  60. package/dist/navigation-instruments/watch/label.js +68 -0
  61. package/dist/navigation-instruments/watch/label.js.map +1 -0
  62. package/dist/navigation-instruments/watch/watch.css.js +15 -14
  63. package/dist/navigation-instruments/watch/watch.css.js.map +1 -1
  64. package/dist/navigation-instruments/watch/watch.d.ts +3 -0
  65. package/dist/navigation-instruments/watch/watch.d.ts.map +1 -1
  66. package/dist/navigation-instruments/watch/watch.js +34 -1
  67. package/dist/navigation-instruments/watch/watch.js.map +1 -1
  68. package/dist/navigation-instruments/watch-flat/tickmark-flat.d.ts +20 -0
  69. package/dist/navigation-instruments/watch-flat/tickmark-flat.d.ts.map +1 -0
  70. package/dist/navigation-instruments/watch-flat/tickmark-flat.js +53 -0
  71. package/dist/navigation-instruments/watch-flat/tickmark-flat.js.map +1 -0
  72. package/dist/navigation-instruments/watch-flat/watch-flat.css.js +32 -0
  73. package/dist/navigation-instruments/watch-flat/watch-flat.css.js.map +1 -0
  74. package/dist/navigation-instruments/watch-flat/watch-flat.d.ts +29 -0
  75. package/dist/navigation-instruments/watch-flat/watch-flat.d.ts.map +1 -0
  76. package/dist/navigation-instruments/watch-flat/watch-flat.js +184 -0
  77. package/dist/navigation-instruments/watch-flat/watch-flat.js.map +1 -0
  78. package/dist/svghelpers/rectangular.d.ts +1 -0
  79. package/dist/svghelpers/rectangular.d.ts.map +1 -1
  80. package/dist/svghelpers/rectangular.js +3 -2
  81. package/dist/svghelpers/rectangular.js.map +1 -1
  82. package/package.json +16 -11
  83. package/src/navigation-instruments/azimuth-thruster/azimuth-thruster.ts +1 -0
  84. package/src/navigation-instruments/compass/arrow.ts +61 -0
  85. package/src/navigation-instruments/compass/compass.stories.ts +37 -0
  86. package/src/navigation-instruments/compass/compass.ts +132 -0
  87. package/src/navigation-instruments/compass/radial-tickmark.ts +77 -0
  88. package/src/navigation-instruments/compass-flat/compass-flat.css +23 -0
  89. package/src/navigation-instruments/compass-flat/compass-flat.stories.ts +35 -0
  90. package/src/navigation-instruments/compass-flat/compass-flat.ts +221 -0
  91. package/src/navigation-instruments/main-engine/main-engine.css +17 -0
  92. package/src/navigation-instruments/main-engine/main-engine.stories.ts +54 -0
  93. package/src/navigation-instruments/main-engine/main-engine.ts +160 -0
  94. package/src/navigation-instruments/thruster/advice.ts +9 -5
  95. package/src/navigation-instruments/thruster/thruster.stories.ts +1 -0
  96. package/src/navigation-instruments/thruster/thruster.ts +205 -113
  97. package/src/navigation-instruments/watch/advice.ts +1 -1
  98. package/src/navigation-instruments/watch/label.ts +69 -0
  99. package/src/navigation-instruments/watch/watch.css +7 -7
  100. package/src/navigation-instruments/watch/watch.ts +30 -1
  101. package/src/navigation-instruments/watch-flat/tickmark-flat.ts +62 -0
  102. package/src/navigation-instruments/watch-flat/watch-flat.css +19 -0
  103. package/src/navigation-instruments/watch-flat/watch-flat.stories.ts +17 -0
  104. package/src/navigation-instruments/watch-flat/watch-flat.ts +148 -0
  105. package/src/palettes/variables.css +1343 -1343
  106. package/src/svghelpers/rectangular.ts +6 -3
@@ -0,0 +1,223 @@
1
+ import { unsafeCSS, LitElement, svg } from "lit";
2
+ import componentStyle from "./compass-flat.css.js";
3
+ import { property, customElement } from "lit/decorators.js";
4
+ import { TickmarkType } from "../watch-flat/tickmark-flat.js";
5
+ import "../watch-flat/watch-flat.js";
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __decorateClass = (decorators, target, key, kind) => {
9
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
10
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11
+ if (decorator = decorators[i])
12
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13
+ if (kind && result)
14
+ __defProp(target, key, result);
15
+ return result;
16
+ };
17
+ var LabelPosition = /* @__PURE__ */ ((LabelPosition2) => {
18
+ LabelPosition2[LabelPosition2["top"] = -45] = "top";
19
+ LabelPosition2[LabelPosition2["bottom"] = 50] = "bottom";
20
+ return LabelPosition2;
21
+ })(LabelPosition || {});
22
+ var LabelStyle = /* @__PURE__ */ ((LabelStyle2) => {
23
+ LabelStyle2["regular"] = "var(--instrument-tick-mark-secondary-color)";
24
+ return LabelStyle2;
25
+ })(LabelStyle || {});
26
+ let ObcCompassFlat = class extends LitElement {
27
+ constructor() {
28
+ super(...arguments);
29
+ this.noPadding = true;
30
+ this.FOVIndicator = false;
31
+ this.padding = 16;
32
+ this.heading = 0;
33
+ this.courseOverGround = 0;
34
+ this.tickInterval = 5;
35
+ this.FOV = 45;
36
+ this.minFOV = 45;
37
+ this.maxFOV = 180;
38
+ this.labels = [];
39
+ this.containerWidth = 0;
40
+ this.resizeObserver = new ResizeObserver((entries) => {
41
+ for (const entry of entries) {
42
+ this.containerWidth = entry.contentRect.width;
43
+ this.updateLabels();
44
+ }
45
+ });
46
+ }
47
+ connectedCallback() {
48
+ super.connectedCallback();
49
+ this.resizeObserver.observe(this);
50
+ }
51
+ disconnectedCallback() {
52
+ super.disconnectedCallback();
53
+ this.resizeObserver.unobserve(this);
54
+ }
55
+ updateLabels() {
56
+ if (this.containerWidth < 192) {
57
+ this.labels = [];
58
+ } else if (this.containerWidth <= 300) {
59
+ this.labels = [
60
+ { x: -180, y: -45, text: "S" },
61
+ { x: -90, y: -45, text: "W" },
62
+ { x: 0, y: -45, text: "N" },
63
+ { x: 90, y: -45, text: "E" },
64
+ { x: 180, y: -45, text: "S" },
65
+ { x: 270, y: -45, text: "W" },
66
+ { x: 360, y: -45, text: "N" },
67
+ { x: 450, y: -45, text: "E" },
68
+ { x: 540, y: -45, text: "S" }
69
+ ];
70
+ } else {
71
+ this.labels = [
72
+ { x: -180, y: -45, text: "S" },
73
+ { x: -135, y: -45, text: "SW" },
74
+ { x: -90, y: -45, text: "W" },
75
+ { x: -45, y: -45, text: "NW" },
76
+ { x: 0, y: -45, text: "N" },
77
+ { x: 45, y: -45, text: "NE" },
78
+ { x: 90, y: -45, text: "E" },
79
+ { x: 135, y: -45, text: "SE" },
80
+ { x: 180, y: -45, text: "S" },
81
+ { x: 225, y: -45, text: "SW" },
82
+ { x: 270, y: -45, text: "W" },
83
+ { x: 315, y: -45, text: "NW" },
84
+ { x: 360, y: -45, text: "N" },
85
+ { x: 405, y: -45, text: "NE" },
86
+ { x: 450, y: -45, text: "E" },
87
+ { x: 495, y: -45, text: "SE" },
88
+ { x: 540, y: -45, text: "S" }
89
+ ];
90
+ }
91
+ }
92
+ generateIntervalTickmarks(scale) {
93
+ const tickmarks = [];
94
+ let cardinalInterval = 90;
95
+ if (this.containerWidth > 300) {
96
+ cardinalInterval = 45;
97
+ } else if (this.containerWidth < 192) {
98
+ cardinalInterval = 0;
99
+ }
100
+ for (let angle = -180; angle < this.maxFOV * 3; angle += this.tickInterval) {
101
+ if (cardinalInterval !== 0 && angle % cardinalInterval === 0) {
102
+ continue;
103
+ }
104
+ tickmarks.push({ angle: angle * scale, type: TickmarkType.secondary });
105
+ }
106
+ return tickmarks;
107
+ }
108
+ generateCardinalTickmarks(scale) {
109
+ const tickmarks = [];
110
+ for (const label of this.labels) {
111
+ tickmarks.push({ angle: label.x * scale, type: TickmarkType.main });
112
+ }
113
+ return tickmarks;
114
+ }
115
+ generateTickmarks(scale) {
116
+ return [
117
+ ...this.generateCardinalTickmarks(scale),
118
+ ...this.generateIntervalTickmarks(scale)
119
+ ];
120
+ }
121
+ renderFOVIndicator() {
122
+ const indicators = [];
123
+ const maxAdjustment = 10;
124
+ const minContainerWidth = 300;
125
+ const maxContainerWidth = 512;
126
+ let yAdjustment = 0;
127
+ if (this.containerWidth < maxContainerWidth) {
128
+ const widthRange = maxContainerWidth - minContainerWidth;
129
+ const scaleFactor = (maxContainerWidth - this.containerWidth) / widthRange;
130
+ yAdjustment = scaleFactor * maxAdjustment;
131
+ }
132
+ const y = 50 + yAdjustment;
133
+ indicators.push(svg`
134
+ <text x="-175" y=${y} class="label left" fill=${"var(--instrument-tick-mark-secondary-color)"}>
135
+ ${-this.FOV}\u00B0
136
+ </text>`);
137
+ indicators.push(svg`
138
+ <text x="0" y=${y} class="label" fill=${"var(--instrument-tick-mark-secondary-color)"}>
139
+ ${this.heading}\u00B0
140
+ </text>`);
141
+ indicators.push(svg`
142
+ <text x="175" y=${y} class="label right" fill=${"var(--instrument-tick-mark-secondary-color)"}>
143
+ ${this.FOV}\u00B0
144
+ </text>`);
145
+ return indicators;
146
+ }
147
+ get HDGSvg() {
148
+ return svg`<g transform="translate(-24, -74)">
149
+ <path d="M36.7011 44.1445L36.6898 44.1379L36.6781 44.1318L24.2301 37.6823L24.0001 37.5631L23.7701 37.6823L11.3221 44.1318L11.3104 44.1379L11.2991 44.1445C9.25497 45.3438 6.78661 43.308 7.68828 41.0919L22.6036 4.43285C23.1096 3.18905 24.8906 3.18905 25.3967 4.43284L40.3119 41.0919C41.2136 43.308 38.7452 45.3438 36.7011 44.1445Z" fill="var(--instrument-enhanced-secondary-color)" stroke="var(--border-silhouette-color)"/>
150
+ </g>`;
151
+ }
152
+ COGSvg(translation) {
153
+ return svg`
154
+ <g transform="translate(${-24 + translation}, -74)">
155
+ <path d="M31.9025 36.0262L33.1068 36.6502L32.5956 35.3938L24.4632 15.406L24.0001 14.2677L23.537 15.406L15.4046 35.3938L14.8935 36.6502L16.0978 36.0262L24.0001 31.9319L31.9025 36.0262ZM36.7011 44.1445L36.6898 44.1379L36.6781 44.1318L24.2301 37.6823L24.0001 37.5631L23.7701 37.6823L11.3221 44.1318L11.3104 44.1379L11.2991 44.1445C9.25497 45.3438 6.78661 43.308 7.68828 41.0919L22.6036 4.43285C23.1096 3.18905 24.8906 3.18905 25.3967 4.43284L40.3119 41.0919C41.2136 43.308 38.7452 45.3438 36.7011 44.1445Z" fill="var(--instrument-enhanced-secondary-color)" stroke="var(--border-silhouette-color)"/>
156
+ </g>
157
+ `;
158
+ }
159
+ render() {
160
+ let angleDiff = this.courseOverGround - this.heading;
161
+ if (angleDiff > this.maxFOV) {
162
+ angleDiff -= 360;
163
+ } else if (angleDiff < -this.maxFOV) {
164
+ angleDiff += 360;
165
+ }
166
+ this.FOV = Math.max(this.minFOV, Math.abs(angleDiff));
167
+ const baseOffset = 5;
168
+ const translationScale = baseOffset * 35 / this.FOV;
169
+ const translation = angleDiff * translationScale;
170
+ const tickmarks = this.generateTickmarks(translationScale);
171
+ this.labels.map((l) => {
172
+ l.x = l.x * translationScale;
173
+ });
174
+ const viewBox = this.noPadding ? "-192 -128 384 128" : "-200 -144 400 144";
175
+ return svg`
176
+ <div class="container">
177
+ <obc-watch-flat .noPadding=${this.noPadding} .FOVIndicator=${this.FOVIndicator ? this.renderFOVIndicator() : []} .labels=${this.labels} .rotation=${this.heading} .tickmarks=${tickmarks} .tickmarkSpacing=${translationScale}></obc-watch-flat>
178
+ <svg viewBox=${viewBox} xmlns="http://www.w3.org/2000/svg">
179
+ ${this.HDGSvg}${this.COGSvg(translation)}
180
+ </div>
181
+ `;
182
+ }
183
+ };
184
+ ObcCompassFlat.styles = unsafeCSS(componentStyle);
185
+ __decorateClass([
186
+ property({ type: Boolean })
187
+ ], ObcCompassFlat.prototype, "noPadding", 2);
188
+ __decorateClass([
189
+ property({ type: Boolean })
190
+ ], ObcCompassFlat.prototype, "FOVIndicator", 2);
191
+ __decorateClass([
192
+ property({ type: Number })
193
+ ], ObcCompassFlat.prototype, "padding", 2);
194
+ __decorateClass([
195
+ property({ type: Number })
196
+ ], ObcCompassFlat.prototype, "heading", 2);
197
+ __decorateClass([
198
+ property({ type: Number })
199
+ ], ObcCompassFlat.prototype, "courseOverGround", 2);
200
+ __decorateClass([
201
+ property({ type: Number })
202
+ ], ObcCompassFlat.prototype, "tickInterval", 2);
203
+ __decorateClass([
204
+ property({ type: Number })
205
+ ], ObcCompassFlat.prototype, "FOV", 2);
206
+ __decorateClass([
207
+ property({ type: Number })
208
+ ], ObcCompassFlat.prototype, "minFOV", 2);
209
+ __decorateClass([
210
+ property({ type: Number })
211
+ ], ObcCompassFlat.prototype, "maxFOV", 2);
212
+ __decorateClass([
213
+ property({ type: Number })
214
+ ], ObcCompassFlat.prototype, "containerWidth", 2);
215
+ ObcCompassFlat = __decorateClass([
216
+ customElement("obc-compass-flat")
217
+ ], ObcCompassFlat);
218
+ export {
219
+ LabelPosition,
220
+ LabelStyle,
221
+ ObcCompassFlat
222
+ };
223
+ //# sourceMappingURL=compass-flat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compass-flat.js","sources":["../../../src/navigation-instruments/compass-flat/compass-flat.ts"],"sourcesContent":["import {LitElement, svg, SVGTemplateResult, unsafeCSS} from 'lit';\nimport componentStyle from './compass-flat.css?inline';\nimport {customElement, property} from 'lit/decorators.js';\nimport {Tickmark, TickmarkType} from '../watch-flat/tickmark-flat';\nimport '../watch-flat/watch-flat';\n\nexport enum LabelPosition {\n top = -45,\n bottom = 50,\n}\n\nexport enum LabelStyle {\n regular = 'var(--instrument-tick-mark-secondary-color)',\n}\n\nexport interface Label {\n x: number;\n y: LabelPosition;\n text: string;\n}\n\n@customElement('obc-compass-flat')\nexport class ObcCompassFlat extends LitElement {\n @property({type: Boolean}) noPadding: boolean = true;\n @property({type: Boolean}) FOVIndicator: boolean = false;\n @property({type: Number}) padding: number = 16;\n @property({type: Number}) heading = 0;\n @property({type: Number}) courseOverGround = 0;\n @property({type: Number}) tickInterval = 5;\n @property({type: Number}) FOV = 45;\n @property({type: Number}) minFOV = 45;\n @property({type: Number}) maxFOV = 180;\n labels: Label[] = [];\n\n @property({type: Number}) containerWidth = 0;\n\n private resizeObserver: ResizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n this.containerWidth = entry.contentRect.width;\n this.updateLabels();\n }\n });\n\n override connectedCallback() {\n super.connectedCallback();\n this.resizeObserver.observe(this);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.resizeObserver.unobserve(this);\n }\n\n private updateLabels() {\n if (this.containerWidth < 192) {\n this.labels = [];\n } else if (this.containerWidth <= 300) {\n this.labels = [\n {x: -180, y: LabelPosition.top, text: 'S'},\n {x: -90, y: LabelPosition.top, text: 'W'},\n {x: 0, y: LabelPosition.top, text: 'N'},\n {x: 90, y: LabelPosition.top, text: 'E'},\n {x: 180, y: LabelPosition.top, text: 'S'},\n {x: 270, y: LabelPosition.top, text: 'W'},\n {x: 360, y: LabelPosition.top, text: 'N'},\n {x: 450, y: LabelPosition.top, text: 'E'},\n {x: 540, y: LabelPosition.top, text: 'S'},\n ];\n } else {\n this.labels = [\n {x: -180, y: LabelPosition.top, text: 'S'},\n {x: -135, y: LabelPosition.top, text: 'SW'},\n {x: -90, y: LabelPosition.top, text: 'W'},\n {x: -45, y: LabelPosition.top, text: 'NW'},\n {x: 0, y: LabelPosition.top, text: 'N'},\n {x: 45, y: LabelPosition.top, text: 'NE'},\n {x: 90, y: LabelPosition.top, text: 'E'},\n {x: 135, y: LabelPosition.top, text: 'SE'},\n {x: 180, y: LabelPosition.top, text: 'S'},\n {x: 225, y: LabelPosition.top, text: 'SW'},\n {x: 270, y: LabelPosition.top, text: 'W'},\n {x: 315, y: LabelPosition.top, text: 'NW'},\n {x: 360, y: LabelPosition.top, text: 'N'},\n {x: 405, y: LabelPosition.top, text: 'NE'},\n {x: 450, y: LabelPosition.top, text: 'E'},\n {x: 495, y: LabelPosition.top, text: 'SE'},\n {x: 540, y: LabelPosition.top, text: 'S'},\n ];\n }\n }\n\n private generateIntervalTickmarks(scale: number): Tickmark[] {\n const tickmarks: Tickmark[] = [];\n let cardinalInterval = 90;\n\n if (this.containerWidth > 300) {\n cardinalInterval = 45;\n } else if (this.containerWidth < 192) {\n cardinalInterval = 0;\n }\n\n for (\n let angle = -180;\n angle < this.maxFOV * 3;\n angle += this.tickInterval\n ) {\n if (cardinalInterval !== 0 && angle % cardinalInterval === 0) {\n continue;\n }\n tickmarks.push({angle: angle * scale, type: TickmarkType.secondary});\n }\n\n return tickmarks;\n }\n\n private generateCardinalTickmarks(scale: number): Tickmark[] {\n const tickmarks: Tickmark[] = [];\n\n for (const label of this.labels) {\n tickmarks.push({angle: label.x * scale, type: TickmarkType.main});\n }\n\n return tickmarks;\n }\n\n private generateTickmarks(scale: number): Tickmark[] {\n return [\n ...this.generateCardinalTickmarks(scale),\n ...this.generateIntervalTickmarks(scale),\n ];\n }\n\n private renderFOVIndicator(): SVGTemplateResult[] {\n const indicators: SVGTemplateResult[] = [];\n\n const maxAdjustment = 10;\n const minContainerWidth = 300;\n const maxContainerWidth = 512;\n\n let yAdjustment = 0;\n if (this.containerWidth < maxContainerWidth) {\n const widthRange = maxContainerWidth - minContainerWidth;\n const scaleFactor =\n (maxContainerWidth - this.containerWidth) / widthRange;\n yAdjustment = scaleFactor * maxAdjustment;\n }\n\n const y = LabelPosition.bottom + yAdjustment;\n\n indicators.push(svg`\n <text x=\"-175\" y=${y} class=\"label left\" fill=${LabelStyle.regular}>\n ${-this.FOV}\\u00B0\n </text>`);\n\n indicators.push(svg`\n <text x=\"0\" y=${y} class=\"label\" fill=${LabelStyle.regular}>\n ${this.heading}\\u00B0\n </text>`);\n\n indicators.push(svg`\n <text x=\"175\" y=${y} class=\"label right\" fill=${LabelStyle.regular}>\n ${this.FOV}\\u00B0\n </text>`);\n\n return indicators;\n }\n\n private get HDGSvg(): SVGTemplateResult {\n return svg`<g transform=\"translate(-24, -74)\">\n <path d=\"M36.7011 44.1445L36.6898 44.1379L36.6781 44.1318L24.2301 37.6823L24.0001 37.5631L23.7701 37.6823L11.3221 44.1318L11.3104 44.1379L11.2991 44.1445C9.25497 45.3438 6.78661 43.308 7.68828 41.0919L22.6036 4.43285C23.1096 3.18905 24.8906 3.18905 25.3967 4.43284L40.3119 41.0919C41.2136 43.308 38.7452 45.3438 36.7011 44.1445Z\" fill=\"var(--instrument-enhanced-secondary-color)\" stroke=\"var(--border-silhouette-color)\"/>\n </g>`;\n }\n\n private COGSvg(translation: number): SVGTemplateResult {\n return svg`\n <g transform=\"translate(${-24 + translation}, -74)\">\n <path d=\"M31.9025 36.0262L33.1068 36.6502L32.5956 35.3938L24.4632 15.406L24.0001 14.2677L23.537 15.406L15.4046 35.3938L14.8935 36.6502L16.0978 36.0262L24.0001 31.9319L31.9025 36.0262ZM36.7011 44.1445L36.6898 44.1379L36.6781 44.1318L24.2301 37.6823L24.0001 37.5631L23.7701 37.6823L11.3221 44.1318L11.3104 44.1379L11.2991 44.1445C9.25497 45.3438 6.78661 43.308 7.68828 41.0919L22.6036 4.43285C23.1096 3.18905 24.8906 3.18905 25.3967 4.43284L40.3119 41.0919C41.2136 43.308 38.7452 45.3438 36.7011 44.1445Z\" fill=\"var(--instrument-enhanced-secondary-color)\" stroke=\"var(--border-silhouette-color)\"/>\n </g>\n `;\n }\n\n override render() {\n let angleDiff = this.courseOverGround - this.heading;\n\n if (angleDiff > this.maxFOV) {\n angleDiff -= 360;\n } else if (angleDiff < -this.maxFOV) {\n angleDiff += 360;\n }\n\n this.FOV = Math.max(this.minFOV, Math.abs(angleDiff));\n\n const baseOffset = 5;\n const translationScale = (baseOffset * 35) / this.FOV;\n\n const translation = angleDiff * translationScale;\n\n const tickmarks = this.generateTickmarks(translationScale);\n this.labels.map((l) => {\n l.x = l.x * translationScale;\n });\n\n const viewBox = this.noPadding ? '-192 -128 384 128' : '-200 -144 400 144';\n\n return svg`\n <div class=\"container\">\n <obc-watch-flat .noPadding=${this.noPadding} .FOVIndicator=${this.FOVIndicator ? this.renderFOVIndicator() : []} .labels=${this.labels} .rotation=${this.heading} .tickmarks=${tickmarks} .tickmarkSpacing=${translationScale}></obc-watch-flat>\n <svg viewBox=${viewBox} xmlns=\"http://www.w3.org/2000/svg\"> \n ${this.HDGSvg}${this.COGSvg(translation)}\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-compass-flat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CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GAFd,eAEgB,WAAA,gBAAA,CAAA;AACD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAHb,eAGe,WAAA,WAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAJb,eAIe,WAAA,WAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GALb,eAKe,WAAA,oBAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GANb,eAMe,WAAA,gBAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAPb,eAOe,WAAA,OAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GARb,eAQe,WAAA,UAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GATb,eASe,WAAA,UAAA,CAAA;AAGA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAZb,eAYe,WAAA,kBAAA,CAAA;AAZf,iBAAN,gBAAA;AAAA,EADN,cAAc,kBAAkB;AAAA,GACpB,cAAA;"}
@@ -0,0 +1,22 @@
1
+ import { css } from "lit";
2
+ const compentStyle = css`* {
3
+ box-sizing: border-box;
4
+ }
5
+
6
+ .container {
7
+ position: relative;
8
+ width: 100%;
9
+ height: 100%;
10
+ }
11
+
12
+ .container>* {
13
+ position: absolute;
14
+ top: 0;
15
+ left: 0;
16
+ width: 100%;
17
+ height: 100%;
18
+ }`;
19
+ export {
20
+ compentStyle as default
21
+ };
22
+ //# sourceMappingURL=main-engine.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main-engine.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,29 @@
1
+ import { LitElement } from 'lit';
2
+ import { InstrumentState } from '../types';
3
+ import { LinearAdvice } from '../thruster/advice';
4
+ export declare class ObcMainEngine extends LitElement {
5
+ thrust: number;
6
+ thrustSetpoint: number | undefined;
7
+ thrustTouching: boolean;
8
+ atThrustSetpoint: boolean;
9
+ speed: number;
10
+ speedSetpoint: number | undefined;
11
+ speedTouching: boolean;
12
+ atSpeedSetpoint: boolean;
13
+ disableAutoAtThrustSetpoint: boolean;
14
+ disableAutoAtSpeedSetpoint: boolean;
15
+ autoAtThrustSetpointDeadband: number;
16
+ autoAtSpeedSetpointDeadband: number;
17
+ thrustSetpointAtZeroDeadband: number;
18
+ speedSetpointAtZeroDeadband: number;
19
+ state: InstrumentState;
20
+ thrustAdvices: LinearAdvice[];
21
+ render(): import("lit-html").TemplateResult<1>;
22
+ static styles: import("lit").CSSResult;
23
+ }
24
+ declare global {
25
+ interface HTMLElementTagNameMap {
26
+ 'obc-main-engine': ObcMainEngine;
27
+ }
28
+ }
29
+ //# sourceMappingURL=main-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main-engine.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/main-engine/main-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAgC,MAAM,KAAK,CAAC;AAG9D,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAQzC,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAEhD,qBACa,aAAc,SAAQ,UAAU;IACjB,MAAM,EAAE,MAAM,CAAK;IACnB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,cAAc,EAAE,OAAO,CAAS;IAChC,gBAAgB,EAAE,OAAO,CAAS;IACnC,KAAK,EAAE,MAAM,CAAK;IAClB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,aAAa,EAAE,OAAO,CAAS;IAC/B,eAAe,EAAE,OAAO,CAAS;IACjC,2BAA2B,EAAE,OAAO,CAAS;IAC7C,0BAA0B,EAAE,OAAO,CAAS;IAC7C,4BAA4B,EAAE,MAAM,CAAK;IACzC,2BAA2B,EAAE,MAAM,CAAK;IACxC,4BAA4B,EAAE,MAAM,CAAO;IAC3C,2BAA2B,EAAE,MAAM,CAAO;IAC1C,KAAK,EAAE,eAAe,CAA6B;IACpD,aAAa,EAAE,YAAY,EAAE,CAAM;IAEnD,MAAM;IAwHf,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,aAAa,CAAC;KAClC;CACF"}
@@ -0,0 +1,196 @@
1
+ import { unsafeCSS, LitElement, svg, nothing, html } from "lit";
2
+ import { property, customElement } from "lit/decorators.js";
3
+ import compentStyle from "./main-engine.css.js";
4
+ import { InstrumentState } from "../types.js";
5
+ import { atSetpoint, thrusterColors, convertThrustAdvices, thrusterTopSingleSided, setpointSvg } from "../thruster/thruster.js";
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __decorateClass = (decorators, target, key, kind) => {
9
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
10
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11
+ if (decorator = decorators[i])
12
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13
+ if (kind && result)
14
+ __defProp(target, key, result);
15
+ return result;
16
+ };
17
+ let ObcMainEngine = class extends LitElement {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.thrust = 0;
21
+ this.thrustTouching = false;
22
+ this.atThrustSetpoint = false;
23
+ this.speed = 0;
24
+ this.speedTouching = false;
25
+ this.atSpeedSetpoint = false;
26
+ this.disableAutoAtThrustSetpoint = false;
27
+ this.disableAutoAtSpeedSetpoint = false;
28
+ this.autoAtThrustSetpointDeadband = 1;
29
+ this.autoAtSpeedSetpointDeadband = 1;
30
+ this.thrustSetpointAtZeroDeadband = 0.5;
31
+ this.speedSetpointAtZeroDeadband = 0.5;
32
+ this.state = InstrumentState.inCommand;
33
+ this.thrustAdvices = [];
34
+ }
35
+ render() {
36
+ const thrustSetpointAtZero = Math.abs(this.thrustSetpoint || 0) < this.thrustSetpointAtZeroDeadband;
37
+ const speedSetpointAtZero = Math.abs(this.speedSetpoint || 0) < this.speedSetpointAtZeroDeadband;
38
+ const thrustAtSetpoint = atSetpoint(this.thrust, this.thrustSetpoint, {
39
+ atSetpoint: this.atThrustSetpoint,
40
+ autoAtSetpoint: !this.disableAutoAtThrustSetpoint,
41
+ autoSetpointDeadband: this.autoAtThrustSetpointDeadband,
42
+ touching: this.thrustTouching
43
+ });
44
+ const cThrust = thrusterColors(
45
+ {
46
+ atSetpoint: thrustAtSetpoint,
47
+ touching: this.thrustTouching
48
+ },
49
+ this.state
50
+ );
51
+ const speedAtSetpoint = atSetpoint(this.speed, this.speedSetpoint, {
52
+ atSetpoint: this.atSpeedSetpoint,
53
+ autoAtSetpoint: !this.disableAutoAtSpeedSetpoint,
54
+ autoSetpointDeadband: this.autoAtSpeedSetpointDeadband,
55
+ touching: this.speedTouching
56
+ });
57
+ const cSpeed = thrusterColors(
58
+ {
59
+ atSetpoint: speedAtSetpoint,
60
+ touching: this.speedTouching
61
+ },
62
+ this.state
63
+ );
64
+ const container = svg`<rect x="-80" y="-176" width="160" height="352" fill="var(--instrument-frame-primary-color)" stroke="var(--instrument-frame-tertiary-color)" rx="8"/>`;
65
+ const border = svg`<rect x="-80" y="-176" width="160" height="352" fill="none" stroke="var(--instrument-frame-tertiary-color)" rx="8" vector-effect="non-scaling-stroke"/>`;
66
+ const frameLeft = svg`<rect x="-56" y="-176" width="48" height="352" fill="var(--instrument-frame-secondary-color)" vector-effect="non-scaling-stroke" stroke="var(--instrument-frame-secondary-color)"/>`;
67
+ const frameRight = svg`<rect x="8" y="-176" width="48" height="352" fill="var(--instrument-frame-secondary-color)" vector-effect="non-scaling-stroke" stroke="var(--instrument-frame-secondary-color)"/>`;
68
+ const thrustCenter = svg`<rect x="8" y="-2" height="4" width="72" fill="${cThrust.zeroLineColor}" stroke=${cThrust.zeroLineColor} vector-effect="non-scaling-stroke"/>`;
69
+ const { topAdvices: topThrustAdvice, bottomAdvices: bottomThrustAdvice } = convertThrustAdvices(this.thrustAdvices, this.thrust);
70
+ const thrustTop = svg`<g transform="translate(44, 0)">
71
+ ${thrusterTopSingleSided(
72
+ 174,
73
+ Math.max(this.thrust, 0),
74
+ { box: cThrust.boxColor, container: "" },
75
+ {
76
+ hideContainer: true,
77
+ hideTicks: cThrust.hideTicks,
78
+ flipAdicePattern: false,
79
+ narrow: false
80
+ },
81
+ topThrustAdvice
82
+ )}</g>`;
83
+ const thrusterBottom = svg`<g transform="rotate(180) scale(-1,1) translate(44)">
84
+ ${thrusterTopSingleSided(
85
+ 174,
86
+ Math.max(-this.thrust, 0),
87
+ { box: cThrust.boxColor, container: "" },
88
+ {
89
+ hideContainer: true,
90
+ hideTicks: cThrust.hideTicks,
91
+ flipAdicePattern: false,
92
+ narrow: false
93
+ },
94
+ bottomThrustAdvice
95
+ )}</g>`;
96
+ const thrustSetpoint = this.thrustSetpoint !== void 0 ? svg`<g transform="translate(44, 0)">${setpointSvg(
97
+ 174,
98
+ this.thrustSetpoint,
99
+ thrustSetpointAtZero,
100
+ {
101
+ fill: cThrust.setPointColor,
102
+ stroke: "var(--border-silhouette-color)"
103
+ },
104
+ {
105
+ inCommand: this.state === InstrumentState.inCommand,
106
+ singleSided: true,
107
+ narrow: false
108
+ }
109
+ )}</g>` : nothing;
110
+ const speedHeight = 352 * (this.speed / 100) + 2;
111
+ const speedY = 176 - speedHeight;
112
+ const speedBoxColor = this.state === InstrumentState.inCommand ? "var(--instrument-enhanced-tertiary-color)" : "var(--instrument-regular-tertiary-color)";
113
+ const speedBox = svg`<rect x="-56" y=${speedY} width="48" height=${speedHeight} fill=${speedBoxColor} stroke=${speedBoxColor} vector-effect="non-scaling-stroke">`;
114
+ const speedLine = svg`<rect x="-56" y=${speedY - 2} width="48" height="4" rx="2" fill=${cSpeed.boxColor} stroke=${cSpeed.boxColor}/>
115
+ `;
116
+ const speedSetpoint = this.speedSetpoint !== void 0 ? svg`<g transform="scale(-1 1) translate(44, 176)">${setpointSvg(
117
+ 350,
118
+ this.speedSetpoint,
119
+ speedSetpointAtZero,
120
+ {
121
+ fill: cSpeed.setPointColor,
122
+ stroke: "var(--border-silhouette-color)"
123
+ },
124
+ {
125
+ inCommand: this.state === InstrumentState.inCommand,
126
+ singleSided: true,
127
+ narrow: false
128
+ }
129
+ )}</g>` : nothing;
130
+ return html`
131
+ <div class="container">
132
+ <svg viewbox="-100 -200 200 400">
133
+ ${container} ${frameLeft} ${frameRight} ${thrustCenter} ${thrustTop}
134
+ ${thrusterBottom} ${speedBox} ${speedLine} ${border} ${thrustSetpoint}
135
+ ${speedSetpoint}
136
+ </svg>
137
+ </div>
138
+ `;
139
+ }
140
+ };
141
+ ObcMainEngine.styles = unsafeCSS(compentStyle);
142
+ __decorateClass([
143
+ property({ type: Number })
144
+ ], ObcMainEngine.prototype, "thrust", 2);
145
+ __decorateClass([
146
+ property({ type: Number })
147
+ ], ObcMainEngine.prototype, "thrustSetpoint", 2);
148
+ __decorateClass([
149
+ property({ type: Boolean })
150
+ ], ObcMainEngine.prototype, "thrustTouching", 2);
151
+ __decorateClass([
152
+ property({ type: Boolean })
153
+ ], ObcMainEngine.prototype, "atThrustSetpoint", 2);
154
+ __decorateClass([
155
+ property({ type: Number })
156
+ ], ObcMainEngine.prototype, "speed", 2);
157
+ __decorateClass([
158
+ property({ type: Number })
159
+ ], ObcMainEngine.prototype, "speedSetpoint", 2);
160
+ __decorateClass([
161
+ property({ type: Boolean })
162
+ ], ObcMainEngine.prototype, "speedTouching", 2);
163
+ __decorateClass([
164
+ property({ type: Boolean })
165
+ ], ObcMainEngine.prototype, "atSpeedSetpoint", 2);
166
+ __decorateClass([
167
+ property({ type: Boolean })
168
+ ], ObcMainEngine.prototype, "disableAutoAtThrustSetpoint", 2);
169
+ __decorateClass([
170
+ property({ type: Boolean })
171
+ ], ObcMainEngine.prototype, "disableAutoAtSpeedSetpoint", 2);
172
+ __decorateClass([
173
+ property({ type: Number })
174
+ ], ObcMainEngine.prototype, "autoAtThrustSetpointDeadband", 2);
175
+ __decorateClass([
176
+ property({ type: Number })
177
+ ], ObcMainEngine.prototype, "autoAtSpeedSetpointDeadband", 2);
178
+ __decorateClass([
179
+ property({ type: Number })
180
+ ], ObcMainEngine.prototype, "thrustSetpointAtZeroDeadband", 2);
181
+ __decorateClass([
182
+ property({ type: Number })
183
+ ], ObcMainEngine.prototype, "speedSetpointAtZeroDeadband", 2);
184
+ __decorateClass([
185
+ property({ type: String })
186
+ ], ObcMainEngine.prototype, "state", 2);
187
+ __decorateClass([
188
+ property({ type: Array })
189
+ ], ObcMainEngine.prototype, "thrustAdvices", 2);
190
+ ObcMainEngine = __decorateClass([
191
+ customElement("obc-main-engine")
192
+ ], ObcMainEngine);
193
+ export {
194
+ ObcMainEngine
195
+ };
196
+ //# sourceMappingURL=main-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main-engine.js","sources":["../../../src/navigation-instruments/main-engine/main-engine.ts"],"sourcesContent":["import {LitElement, html, unsafeCSS, svg, nothing} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport compentStyle from './main-engine.css?inline';\nimport {InstrumentState} from '../types';\nimport {\n atSetpoint,\n convertThrustAdvices,\n thrusterColors,\n thrusterTopSingleSided,\n setpointSvg,\n} from '../thruster/thruster';\nimport {LinearAdvice} from '../thruster/advice';\n\n@customElement('obc-main-engine')\nexport class ObcMainEngine extends LitElement {\n @property({type: Number}) thrust: number = 0;\n @property({type: Number}) thrustSetpoint: number | undefined;\n @property({type: Boolean}) thrustTouching: boolean = false;\n @property({type: Boolean}) atThrustSetpoint: boolean = false;\n @property({type: Number}) speed: number = 0;\n @property({type: Number}) speedSetpoint: number | undefined;\n @property({type: Boolean}) speedTouching: boolean = false;\n @property({type: Boolean}) atSpeedSetpoint: boolean = false;\n @property({type: Boolean}) disableAutoAtThrustSetpoint: boolean = false;\n @property({type: Boolean}) disableAutoAtSpeedSetpoint: boolean = false;\n @property({type: Number}) autoAtThrustSetpointDeadband: number = 1;\n @property({type: Number}) autoAtSpeedSetpointDeadband: number = 1;\n @property({type: Number}) thrustSetpointAtZeroDeadband: number = 0.5;\n @property({type: Number}) speedSetpointAtZeroDeadband: number = 0.5;\n @property({type: String}) state: InstrumentState = InstrumentState.inCommand;\n @property({type: Array}) thrustAdvices: LinearAdvice[] = [];\n\n override render() {\n const thrustSetpointAtZero =\n Math.abs(this.thrustSetpoint || 0) < this.thrustSetpointAtZeroDeadband;\n const speedSetpointAtZero =\n Math.abs(this.speedSetpoint || 0) < this.speedSetpointAtZeroDeadband;\n const thrustAtSetpoint = atSetpoint(this.thrust, this.thrustSetpoint, {\n atSetpoint: this.atThrustSetpoint,\n autoAtSetpoint: !this.disableAutoAtThrustSetpoint,\n autoSetpointDeadband: this.autoAtThrustSetpointDeadband,\n touching: this.thrustTouching,\n });\n const cThrust = thrusterColors(\n {\n atSetpoint: thrustAtSetpoint,\n touching: this.thrustTouching,\n },\n this.state\n );\n const speedAtSetpoint = atSetpoint(this.speed, this.speedSetpoint, {\n atSetpoint: this.atSpeedSetpoint,\n autoAtSetpoint: !this.disableAutoAtSpeedSetpoint,\n autoSetpointDeadband: this.autoAtSpeedSetpointDeadband,\n touching: this.speedTouching,\n });\n const cSpeed = thrusterColors(\n {\n atSetpoint: speedAtSetpoint,\n touching: this.speedTouching,\n },\n this.state\n );\n const container = svg`<rect x=\"-80\" y=\"-176\" width=\"160\" height=\"352\" fill=\"var(--instrument-frame-primary-color)\" stroke=\"var(--instrument-frame-tertiary-color)\" rx=\"8\"/>`;\n const border = svg`<rect x=\"-80\" y=\"-176\" width=\"160\" height=\"352\" fill=\"none\" stroke=\"var(--instrument-frame-tertiary-color)\" rx=\"8\" vector-effect=\"non-scaling-stroke\"/>`;\n const frameLeft = svg`<rect x=\"-56\" y=\"-176\" width=\"48\" height=\"352\" fill=\"var(--instrument-frame-secondary-color)\" vector-effect=\"non-scaling-stroke\" stroke=\"var(--instrument-frame-secondary-color)\"/>`;\n const frameRight = svg`<rect x=\"8\" y=\"-176\" width=\"48\" height=\"352\" fill=\"var(--instrument-frame-secondary-color)\" vector-effect=\"non-scaling-stroke\" stroke=\"var(--instrument-frame-secondary-color)\"/>`;\n const thrustCenter = svg`<rect x=\"8\" y=\"-2\" height=\"4\" width=\"72\" fill=\"${cThrust.zeroLineColor}\" stroke=${cThrust.zeroLineColor} vector-effect=\"non-scaling-stroke\"/>`;\n const {topAdvices: topThrustAdvice, bottomAdvices: bottomThrustAdvice} =\n convertThrustAdvices(this.thrustAdvices, this.thrust);\n const thrustTop = svg`<g transform=\"translate(44, 0)\">\n ${thrusterTopSingleSided(\n 174,\n Math.max(this.thrust, 0),\n {box: cThrust.boxColor, container: ''},\n {\n hideContainer: true,\n hideTicks: cThrust.hideTicks,\n flipAdicePattern: false,\n narrow: false,\n },\n topThrustAdvice\n )}</g>`;\n const thrusterBottom = svg`<g transform=\"rotate(180) scale(-1,1) translate(44)\">\n ${thrusterTopSingleSided(\n 174,\n Math.max(-this.thrust, 0),\n {box: cThrust.boxColor, container: ''},\n {\n hideContainer: true,\n hideTicks: cThrust.hideTicks,\n flipAdicePattern: false,\n narrow: false,\n },\n bottomThrustAdvice\n )}</g>`;\n const thrustSetpoint =\n this.thrustSetpoint !== undefined\n ? svg`<g transform=\"translate(44, 0)\">${setpointSvg(\n 174,\n this.thrustSetpoint,\n thrustSetpointAtZero,\n {\n fill: cThrust.setPointColor,\n stroke: 'var(--border-silhouette-color)',\n },\n {\n inCommand: this.state === InstrumentState.inCommand,\n singleSided: true,\n narrow: false,\n }\n )}</g>`\n : nothing;\n\n const speedHeight = 352 * (this.speed / 100) + 2;\n const speedY = 176 - speedHeight;\n const speedBoxColor =\n this.state === InstrumentState.inCommand\n ? 'var(--instrument-enhanced-tertiary-color)'\n : 'var(--instrument-regular-tertiary-color)';\n const speedBox = svg`<rect x=\"-56\" y=${speedY} width=\"48\" height=${speedHeight} fill=${speedBoxColor} stroke=${speedBoxColor} vector-effect=\"non-scaling-stroke\">`;\n const speedLine = svg`<rect x=\"-56\" y=${speedY - 2} width=\"48\" height=\"4\" rx=\"2\" fill=${cSpeed.boxColor} stroke=${cSpeed.boxColor}/>\n`;\n const speedSetpoint =\n this.speedSetpoint !== undefined\n ? svg`<g transform=\"scale(-1 1) translate(44, 176)\">${setpointSvg(\n 350,\n this.speedSetpoint,\n speedSetpointAtZero,\n {\n fill: cSpeed.setPointColor,\n stroke: 'var(--border-silhouette-color)',\n },\n {\n inCommand: this.state === InstrumentState.inCommand,\n singleSided: true,\n narrow: false,\n }\n )}</g>`\n : nothing;\n\n return html`\n <div class=\"container\">\n <svg viewbox=\"-100 -200 200 400\">\n ${container} ${frameLeft} ${frameRight} ${thrustCenter} ${thrustTop}\n ${thrusterBottom} ${speedBox} ${speedLine} ${border} ${thrustSetpoint}\n ${speedSetpoint}\n </svg>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-main-engine': ObcMainEngine;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAca,IAAA,gBAAN,cAA4B,WAAW;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACsC,SAAA,SAAA;AAEU,SAAA,iBAAA;AACE,SAAA,mBAAA;AACb,SAAA,QAAA;AAEU,SAAA,gBAAA;AACE,SAAA,kBAAA;AACY,SAAA,8BAAA;AACD,SAAA,6BAAA;AACA,SAAA,+BAAA;AACD,SAAA,8BAAA;AACC,SAAA,+BAAA;AACD,SAAA,8BAAA;AACtC,SAAA,QAAyB,gBAAgB;AAC1C,SAAA,gBAAgC;EAAC;AAAA,EAEjD,SAAS;AAChB,UAAM,uBACJ,KAAK,IAA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A,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAfb,cAee,WAAA,SAAA,CAAA;AACD,gBAAA;AAAA,EAAxB,SAAS,EAAC,MAAM,OAAM;AAAA,GAhBZ,cAgBc,WAAA,iBAAA,CAAA;AAhBd,gBAAN,gBAAA;AAAA,EADN,cAAc,iBAAiB;AAAA,GACnB,aAAA;"}
@@ -1 +1 @@
1
- {"version":3,"file":"advice.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/thruster/advice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAe,MAAM,KAAK,CAAC;AACpD,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAIxD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,WAAW,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AAwBD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,eAAe,EACvB,aAAa,EAAE,OAAO,GACrB,iBAAiB,CA2DnB"}
1
+ {"version":3,"file":"advice.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/thruster/advice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAe,MAAM,KAAK,CAAC;AACpD,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAIxD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,WAAW,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AAwBD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,eAAe,EACvB,aAAa,EAAE,OAAO,GACrB,iBAAiB,CA+DnB"}
@@ -56,20 +56,24 @@ function renderAdvice(height, advice, flipDirection) {
56
56
  ${singleSidedTickmark(height, advice.max, tickmarkStyle)}
57
57
  `;
58
58
  } else {
59
- let mainColor;
59
+ let strokeColor;
60
60
  let tickmarkStyle;
61
+ let fillColor;
61
62
  if (advice.state === AdviceState.hinted) {
62
- mainColor = "var(--instrument-frame-tertiary-color)";
63
+ strokeColor = "var(--instrument-frame-tertiary-color)";
64
+ fillColor = "none";
63
65
  tickmarkStyle = TickmarkStyle.hinted;
64
66
  } else if (advice.state === AdviceState.regular) {
65
- mainColor = "var(--instrument-regular-secondary-color)";
67
+ strokeColor = "var(--instrument-regular-secondary-color)";
68
+ fillColor = "none";
66
69
  tickmarkStyle = TickmarkStyle.regular;
67
70
  } else {
68
- mainColor = "var(--instrument-enhanced-secondary-color)";
71
+ strokeColor = "var(--instrument-enhanced-secondary-color)";
72
+ fillColor = strokeColor;
69
73
  tickmarkStyle = TickmarkStyle.regular;
70
74
  }
71
75
  return svg`
72
- ${adviceMask(height, advice.min, advice.max, mainColor, mainColor)}
76
+ ${adviceMask(height, advice.min, advice.max, fillColor, strokeColor)}
73
77
  ${singleSidedTickmark(height, advice.min, tickmarkStyle)}
74
78
  ${singleSidedTickmark(height, advice.max, tickmarkStyle)}
75
79
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"advice.js","sources":["../../../src/navigation-instruments/thruster/advice.ts"],"sourcesContent":["import {SVGTemplateResult, nothing, svg} from 'lit';\nimport {AdviceState, AdviceType} from '../watch/advice';\nimport {TickmarkStyle} from '../watch/tickmark';\nimport {singleSidedTickmark} from './tickmark';\n\nexport interface LinearAdviceRaw {\n min: number;\n max: number;\n type: AdviceType;\n state: AdviceState;\n}\n\nexport interface LinearAdvice {\n min: number;\n max: number;\n type: AdviceType;\n hinted: boolean;\n}\n\nfunction adviceMask(\n height: number,\n min: number,\n max: number,\n fill: string,\n stroke: string\n): SVGTemplateResult {\n const width = 8;\n const x1 = 12;\n const x2 = x1 + width;\n const r = width / 2;\n const yL = (-min * height) / 100 - 2 * r - 2;\n const yH = (-max * height) / 100 + 2 * r - 2;\n\n const path = `M ${x1} ${yL} \n A ${r} ${r} 0 0 0 ${x2} ${yL}\n V ${yH}\n A ${r} ${r} 0 0 0 ${x1} ${yH}\n Z`;\n return svg`<path d=${path} fill=${fill} stroke=${stroke} stroke-width=\"1\" vector-effect=\"non-scaling-stroke\" />`;\n}\n\nexport function renderAdvice(\n height: number,\n advice: LinearAdviceRaw,\n flipDirection: boolean\n): SVGTemplateResult {\n if (advice.type === AdviceType.caution) {\n let mainColor;\n let fillColor: string | null = null;\n if (advice.state === AdviceState.hinted) {\n mainColor = 'var(--instrument-frame-tertiary-color)';\n } else if (advice.state === AdviceState.regular) {\n mainColor = 'var(--instrument-tick-mark-tertiary-color)';\n } else {\n mainColor = 'var(--on-caution-active-color)';\n fillColor = 'var(--alert-caution-color)';\n }\n const pattern = [];\n const ypattern = flipDirection ? 50 : -50;\n for (let i = -100; i < 300; i += 16) {\n pattern.push(svg`<g transform=\"translate(0 ${-i}) \">\n <path d=\"M 50 0 L 0 ${ypattern}\" stroke=${mainColor} stroke-width=\"6\"/>\n </g>\n `);\n }\n const maskId = `adviceMask-${advice.min}-${advice.max}`;\n let tickmarkStyle = TickmarkStyle.hinted;\n if (advice.state === AdviceState.regular) {\n tickmarkStyle = TickmarkStyle.regular;\n } else if (advice.state === AdviceState.triggered) {\n tickmarkStyle = TickmarkStyle.enhanced;\n }\n\n return svg`\n <mask id=${maskId}>\n ${adviceMask(height, advice.min, advice.max, 'white', 'black')}\n </mask>\n <g mask=\"url(#${maskId})\">\n ${fillColor ? svg`<rect x=\"-256\" y=\"-512\" width=\"512\" height=\"1024\" fill=\"${fillColor}\"/>` : nothing}\n ${pattern}\n </g>\n ${adviceMask(height, advice.min, advice.max, 'none', mainColor)}\n ${singleSidedTickmark(height, advice.min, tickmarkStyle)}\n ${singleSidedTickmark(height, advice.max, tickmarkStyle)}\n `;\n } else {\n let mainColor;\n let tickmarkStyle;\n if (advice.state === AdviceState.hinted) {\n mainColor = 'var(--instrument-frame-tertiary-color)';\n tickmarkStyle = TickmarkStyle.hinted;\n } else if (advice.state === AdviceState.regular) {\n mainColor = 'var(--instrument-regular-secondary-color)';\n tickmarkStyle = TickmarkStyle.regular;\n } else {\n mainColor = 'var(--instrument-enhanced-secondary-color)';\n tickmarkStyle = TickmarkStyle.regular;\n }\n return svg`\n ${adviceMask(height, advice.min, advice.max, mainColor, mainColor)}\n ${singleSidedTickmark(height, advice.min, tickmarkStyle)}\n ${singleSidedTickmark(height, advice.max, tickmarkStyle)}\n `;\n }\n}\n"],"names":[],"mappings":";;;;AAmBA,SAAS,WACP,QACA,KACA,KACA,MACA,QACmB;AACnB,QAAM,QAAQ;AACd,QAAM,KAAK;AACX,QAAM,KAAK,KAAK;AAChB,QAAM,IAAI,QAAQ;AAClB,QAAM,KAAM,CAAC,MAAM,SAAU,MAAM,IAAI,IAAI;AAC3C,QAAM,KAAM,CAAC,MAAM,SAAU,MAAM,IAAI,IAAI;AAE3C,QAAM,OAAO,KAAK,EAAE,IAAI,EAAE;AAAA,wBACJ,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE;AAAA,wBACxB,EAAE;AAAA,wBACF,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE;AAAA;AAE9C,SAAO,cAAc,IAAI,SAAS,IAAI,WAAW,MAAM;AACzD;AAEgB,SAAA,aACd,QACA,QACA,eACmB;AACf,MAAA,OAAO,SAAS,WAAW,SAAS;AAClC,QAAA;A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,cACG,WAAW,QAAQ,OAAO,KAAK,OAAO,KAAK,WAAW,SAAS,CAAC;AAAA,cAChE,oBAAoB,QAAQ,OAAO,KAAK,aAAa,CAAC;AAAA,cACtD,oBAAoB,QAAQ,OAAO,KAAK,aAAa,CAAC;AAAA;AAAA,EAElE;AACF;"}
1
+ {"version":3,"file":"advice.js","sources":["../../../src/navigation-instruments/thruster/advice.ts"],"sourcesContent":["import {SVGTemplateResult, nothing, svg} from 'lit';\nimport {AdviceState, AdviceType} from '../watch/advice';\nimport {TickmarkStyle} from '../watch/tickmark';\nimport {singleSidedTickmark} from './tickmark';\n\nexport interface LinearAdviceRaw {\n min: number;\n max: number;\n type: AdviceType;\n state: AdviceState;\n}\n\nexport interface LinearAdvice {\n min: number;\n max: number;\n type: AdviceType;\n hinted: boolean;\n}\n\nfunction adviceMask(\n height: number,\n min: number,\n max: number,\n fill: string,\n stroke: string\n): SVGTemplateResult {\n const width = 8;\n const x1 = 12;\n const x2 = x1 + width;\n const r = width / 2;\n const yL = (-min * height) / 100 - 2 * r - 2;\n const yH = (-max * height) / 100 + 2 * r - 2;\n\n const path = `M ${x1} ${yL} \n A ${r} ${r} 0 0 0 ${x2} ${yL}\n V ${yH}\n A ${r} ${r} 0 0 0 ${x1} ${yH}\n Z`;\n return svg`<path d=${path} fill=${fill} stroke=${stroke} stroke-width=\"1\" vector-effect=\"non-scaling-stroke\" />`;\n}\n\nexport function renderAdvice(\n height: number,\n advice: LinearAdviceRaw,\n flipDirection: boolean\n): SVGTemplateResult {\n if (advice.type === AdviceType.caution) {\n let mainColor;\n let fillColor: string | null = null;\n if (advice.state === AdviceState.hinted) {\n mainColor = 'var(--instrument-frame-tertiary-color)';\n } else if (advice.state === AdviceState.regular) {\n mainColor = 'var(--instrument-tick-mark-tertiary-color)';\n } else {\n mainColor = 'var(--on-caution-active-color)';\n fillColor = 'var(--alert-caution-color)';\n }\n const pattern = [];\n const ypattern = flipDirection ? 50 : -50;\n for (let i = -100; i < 300; i += 16) {\n pattern.push(svg`<g transform=\"translate(0 ${-i}) \">\n <path d=\"M 50 0 L 0 ${ypattern}\" stroke=${mainColor} stroke-width=\"6\"/>\n </g>\n `);\n }\n const maskId = `adviceMask-${advice.min}-${advice.max}`;\n let tickmarkStyle = TickmarkStyle.hinted;\n if (advice.state === AdviceState.regular) {\n tickmarkStyle = TickmarkStyle.regular;\n } else if (advice.state === AdviceState.triggered) {\n tickmarkStyle = TickmarkStyle.enhanced;\n }\n\n return svg`\n <mask id=${maskId}>\n ${adviceMask(height, advice.min, advice.max, 'white', 'black')}\n </mask>\n <g mask=\"url(#${maskId})\">\n ${fillColor ? svg`<rect x=\"-256\" y=\"-512\" width=\"512\" height=\"1024\" fill=\"${fillColor}\"/>` : nothing}\n ${pattern}\n </g>\n ${adviceMask(height, advice.min, advice.max, 'none', mainColor)}\n ${singleSidedTickmark(height, advice.min, tickmarkStyle)}\n ${singleSidedTickmark(height, advice.max, tickmarkStyle)}\n `;\n } else {\n let strokeColor;\n let tickmarkStyle;\n let fillColor: string;\n if (advice.state === AdviceState.hinted) {\n strokeColor = 'var(--instrument-frame-tertiary-color)';\n fillColor = 'none';\n tickmarkStyle = TickmarkStyle.hinted;\n } else if (advice.state === AdviceState.regular) {\n strokeColor = 'var(--instrument-regular-secondary-color)';\n fillColor = 'none';\n tickmarkStyle = TickmarkStyle.regular;\n } else {\n strokeColor = 'var(--instrument-enhanced-secondary-color)';\n fillColor = strokeColor;\n tickmarkStyle = TickmarkStyle.regular;\n }\n return svg`\n ${adviceMask(height, advice.min, advice.max, fillColor, strokeColor)}\n ${singleSidedTickmark(height, advice.min, tickmarkStyle)}\n ${singleSidedTickmark(height, advice.max, tickmarkStyle)}\n `;\n }\n}\n"],"names":[],"mappings":";;;;AAmBA,SAAS,WACP,QACA,KACA,KACA,MACA,QACmB;AACnB,QAAM,QAAQ;AACd,QAAM,KAAK;AACX,QAAM,KAAK,KAAK;AAChB,QAAM,IAAI,QAAQ;AAClB,QAAM,KAAM,CAA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