@oicl/openbridge-webcomponents 0.0.20260407101310 → 0.0.20260407112816
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/dist/building-blocks/instrument-radial/instrument-radial.d.ts +3 -0
- package/dist/building-blocks/instrument-radial/instrument-radial.d.ts.map +1 -1
- package/dist/building-blocks/instrument-radial/instrument-radial.js +50 -22
- package/dist/building-blocks/instrument-radial/instrument-radial.js.map +1 -1
- package/dist/navigation-instruments/compass/arrow.d.ts +1 -1
- package/dist/navigation-instruments/compass/arrow.d.ts.map +1 -1
- package/dist/navigation-instruments/compass/arrow.js +3 -3
- package/dist/navigation-instruments/compass/arrow.js.map +1 -1
- package/dist/navigation-instruments/compass/compass.d.ts +12 -6
- package/dist/navigation-instruments/compass/compass.d.ts.map +1 -1
- package/dist/navigation-instruments/compass/compass.js +29 -24
- package/dist/navigation-instruments/compass/compass.js.map +1 -1
- package/dist/navigation-instruments/compass-flat/compass-flat.d.ts +37 -1
- package/dist/navigation-instruments/compass-flat/compass-flat.d.ts.map +1 -1
- package/dist/navigation-instruments/compass-flat/compass-flat.js +34 -3
- package/dist/navigation-instruments/compass-flat/compass-flat.js.map +1 -1
- package/dist/navigation-instruments/compass-sector/compass-sector.css.js +34 -0
- package/dist/navigation-instruments/compass-sector/compass-sector.css.js.map +1 -0
- package/dist/navigation-instruments/compass-sector/compass-sector.d.ts +101 -0
- package/dist/navigation-instruments/compass-sector/compass-sector.d.ts.map +1 -0
- package/dist/navigation-instruments/compass-sector/compass-sector.js +404 -0
- package/dist/navigation-instruments/compass-sector/compass-sector.js.map +1 -0
- package/dist/navigation-instruments/rate-of-turn/rate-of-turn.controller.d.ts +15 -2
- package/dist/navigation-instruments/rate-of-turn/rate-of-turn.controller.d.ts.map +1 -1
- package/dist/navigation-instruments/rate-of-turn/rate-of-turn.controller.js +50 -18
- package/dist/navigation-instruments/rate-of-turn/rate-of-turn.controller.js.map +1 -1
- package/dist/navigation-instruments/rate-of-turn/rate-of-turn.d.ts +40 -6
- package/dist/navigation-instruments/rate-of-turn/rate-of-turn.d.ts.map +1 -1
- package/dist/navigation-instruments/rate-of-turn/rate-of-turn.js +40 -47
- package/dist/navigation-instruments/rate-of-turn/rate-of-turn.js.map +1 -1
- package/dist/navigation-instruments/rate-of-turn/rot-renderer.d.ts +63 -0
- package/dist/navigation-instruments/rate-of-turn/rot-renderer.d.ts.map +1 -0
- package/dist/navigation-instruments/rate-of-turn/rot-renderer.js +211 -0
- package/dist/navigation-instruments/rate-of-turn/rot-renderer.js.map +1 -0
- package/dist/navigation-instruments/rot-sector/rot-sector.d.ts +10 -4
- package/dist/navigation-instruments/rot-sector/rot-sector.d.ts.map +1 -1
- package/dist/navigation-instruments/rot-sector/rot-sector.js +13 -3
- package/dist/navigation-instruments/rot-sector/rot-sector.js.map +1 -1
- package/dist/navigation-instruments/rudder/rudder.d.ts +4 -0
- package/dist/navigation-instruments/rudder/rudder.d.ts.map +1 -1
- package/dist/navigation-instruments/rudder/rudder.js +55 -19
- package/dist/navigation-instruments/rudder/rudder.js.map +1 -1
- package/dist/navigation-instruments/watch/advice.d.ts +3 -3
- package/dist/navigation-instruments/watch/advice.d.ts.map +1 -1
- package/dist/navigation-instruments/watch/advice.js +68 -16
- package/dist/navigation-instruments/watch/advice.js.map +1 -1
- package/dist/navigation-instruments/watch/tickmark.d.ts +2 -1
- package/dist/navigation-instruments/watch/tickmark.d.ts.map +1 -1
- package/dist/navigation-instruments/watch/tickmark.js +15 -13
- package/dist/navigation-instruments/watch/tickmark.js.map +1 -1
- package/dist/navigation-instruments/watch/watch.d.ts +29 -0
- package/dist/navigation-instruments/watch/watch.d.ts.map +1 -1
- package/dist/navigation-instruments/watch/watch.js +256 -44
- package/dist/navigation-instruments/watch/watch.js.map +1 -1
- package/dist/navigation-instruments/watch-flat/watch-flat.d.ts +29 -1
- package/dist/navigation-instruments/watch-flat/watch-flat.d.ts.map +1 -1
- package/dist/navigation-instruments/watch-flat/watch-flat.js +162 -17
- package/dist/navigation-instruments/watch-flat/watch-flat.js.map +1 -1
- package/dist/svghelpers/arc-frame.d.ts +42 -0
- package/dist/svghelpers/arc-frame.d.ts.map +1 -0
- package/dist/svghelpers/arc-frame.js +123 -0
- package/dist/svghelpers/arc-frame.js.map +1 -0
- package/package.json +1 -1
- package/dist/navigation-instruments/compass/rot.d.ts +0 -4
- package/dist/navigation-instruments/compass/rot.d.ts.map +0 -1
- package/dist/navigation-instruments/compass/rot.js +0 -11
- package/dist/navigation-instruments/compass/rot.js.map +0 -1
|
@@ -46,6 +46,9 @@ export declare class ObcInstrumentRadial extends ObcInstrumentRadial_base {
|
|
|
46
46
|
advices: GaugeRadialAdvice[];
|
|
47
47
|
clipTop: number;
|
|
48
48
|
clipBottom: number;
|
|
49
|
+
zoomToFitArc: boolean;
|
|
50
|
+
private _radiusOffset;
|
|
51
|
+
private _arcFrame;
|
|
49
52
|
get minAngle(): number;
|
|
50
53
|
get maxAngle(): number;
|
|
51
54
|
private get _derivedNeedleColor();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-radial.d.ts","sourceRoot":"","sources":["../../../src/building-blocks/instrument-radial/instrument-radial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,UAAU,EAAqB,MAAM,KAAK,CAAC;AAGxD,OAAO,EAEL,UAAU,EAEX,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EAAC,QAAQ,EAAC,MAAM,gDAAgD,CAAC;AAExE,OAAO,EAAC,aAAa,EAAC,MAAM,gDAAgD,CAAC;AAC7E,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"instrument-radial.d.ts","sourceRoot":"","sources":["../../../src/building-blocks/instrument-radial/instrument-radial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,UAAU,EAAqB,MAAM,KAAK,CAAC;AAGxD,OAAO,EAEL,UAAU,EAEX,MAAM,8CAA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C,SAAS,CAAgC;IAEjD,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,OAAO,KAAK,mBAAmB,GAU9B;IAED,OAAO,KAAK,gBAAgB,GAe3B;IAEQ,MAAM;IAsFf,OAAO,KAAK,OAAO,GAmBlB;IAED,IAAI,SAAS,IAAI,QAAQ,EAAE,CAkI1B;IAED,OAAO,KAAK,QAAQ,GAkBnB;IAED,OAAgB,MAAM,0BAmCpB;CACH;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,uBAAuB,EAAE,mBAAmB,CAAC;KAC9C;CACF"}
|
|
@@ -2,10 +2,11 @@ import { LitElement, html, nothing, svg, css } from "lit";
|
|
|
2
2
|
import { property } from "lit/decorators.js";
|
|
3
3
|
import { customElement } from "../../decorator.js";
|
|
4
4
|
import { AdviceState } from "../../navigation-instruments/watch/advice.js";
|
|
5
|
-
import { WatchCircleType } from "../../navigation-instruments/watch/watch.js";
|
|
5
|
+
import { WatchCircleType, innerRingRadiusFor, OUTER_RING_RADIUS } from "../../navigation-instruments/watch/watch.js";
|
|
6
6
|
import { TickmarkStyle, TickmarkType } from "../../navigation-instruments/watch/tickmark.js";
|
|
7
7
|
import { InstrumentState, Priority } from "../../navigation-instruments/types.js";
|
|
8
8
|
import { SetpointMixin } from "../../svghelpers/setpoint-mixin.js";
|
|
9
|
+
import { computeZoomToFitArcFrame } from "../../svghelpers/arc-frame.js";
|
|
9
10
|
var __defProp = Object.defineProperty;
|
|
10
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11
12
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -41,8 +42,9 @@ let ObcInstrumentRadial = class extends SetpointMixin(LitElement) {
|
|
|
41
42
|
this.advices = [];
|
|
42
43
|
this.clipTop = 0;
|
|
43
44
|
this.clipBottom = 0;
|
|
45
|
+
this.zoomToFitArc = false;
|
|
46
|
+
this._radiusOffset = 0;
|
|
44
47
|
}
|
|
45
|
-
// in percent of height
|
|
46
48
|
get minAngle() {
|
|
47
49
|
return this.getAngle(this.minValue);
|
|
48
50
|
}
|
|
@@ -75,10 +77,37 @@ let ObcInstrumentRadial = class extends SetpointMixin(LitElement) {
|
|
|
75
77
|
fillColor: barColor
|
|
76
78
|
}
|
|
77
79
|
];
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
const areas = [
|
|
81
|
+
{
|
|
82
|
+
startAngle: this.minAngle,
|
|
83
|
+
endAngle: this.maxAngle,
|
|
84
|
+
roundInsideCut: true,
|
|
85
|
+
roundOutsideCut: true
|
|
86
|
+
}
|
|
87
|
+
];
|
|
88
|
+
const watchCircleType = this.type === "needle" ? WatchCircleType.single : WatchCircleType.double;
|
|
89
|
+
let viewBox;
|
|
90
|
+
if (this.zoomToFitArc) {
|
|
91
|
+
const ext = 48;
|
|
92
|
+
const targetSize = (176 + ext) * 2;
|
|
93
|
+
const frame = computeZoomToFitArcFrame({
|
|
94
|
+
areas,
|
|
95
|
+
outerRadius: OUTER_RING_RADIUS,
|
|
96
|
+
innerRadius: innerRingRadiusFor(watchCircleType),
|
|
97
|
+
extension: ext,
|
|
98
|
+
targetSize
|
|
99
|
+
});
|
|
100
|
+
viewBox = frame.viewBox;
|
|
101
|
+
this._radiusOffset = frame.radiusOffset;
|
|
102
|
+
this._arcFrame = frame;
|
|
103
|
+
} else {
|
|
104
|
+
this._radiusOffset = 0;
|
|
105
|
+
this._arcFrame = void 0;
|
|
106
|
+
const width = 448;
|
|
107
|
+
const height = width * (1 - this.clipTop / 100 - this.clipBottom / 100);
|
|
108
|
+
const top = -width / 2 + width * this.clipTop / 100;
|
|
109
|
+
viewBox = `${-width / 2} ${top} ${width} ${height}`;
|
|
110
|
+
}
|
|
82
111
|
return html`
|
|
83
112
|
<div class="container">
|
|
84
113
|
<obc-watch
|
|
@@ -95,18 +124,13 @@ let ObcInstrumentRadial = class extends SetpointMixin(LitElement) {
|
|
|
95
124
|
.tickmarksInside=${this.tickmarksInside}
|
|
96
125
|
.tickmarkStyle=${this.tickmarkStyle}
|
|
97
126
|
.advices=${this._advices}
|
|
98
|
-
.areas=${
|
|
99
|
-
|
|
100
|
-
startAngle: this.minAngle,
|
|
101
|
-
endAngle: this.maxAngle,
|
|
102
|
-
roundInsideCut: true,
|
|
103
|
-
roundOutsideCut: true
|
|
104
|
-
}
|
|
105
|
-
]}
|
|
106
|
-
.watchCircleType=${this.type === "needle" ? WatchCircleType.single : WatchCircleType.double}
|
|
127
|
+
.areas=${areas}
|
|
128
|
+
.watchCircleType=${watchCircleType}
|
|
107
129
|
.barAreas=${barAreas}
|
|
108
|
-
.clipTop=${this.clipTop}
|
|
109
|
-
.clipBottom=${this.clipBottom}
|
|
130
|
+
.clipTop=${this.zoomToFitArc ? 0 : this.clipTop}
|
|
131
|
+
.clipBottom=${this.zoomToFitArc ? 0 : this.clipBottom}
|
|
132
|
+
.zoomToFitArc=${this.zoomToFitArc}
|
|
133
|
+
.arcFrame=${this._arcFrame}
|
|
110
134
|
></obc-watch>
|
|
111
135
|
<svg class="gauge-radial" viewBox=${viewBox}>${this._needle}</svg>
|
|
112
136
|
</div>
|
|
@@ -117,17 +141,18 @@ let ObcInstrumentRadial = class extends SetpointMixin(LitElement) {
|
|
|
117
141
|
return nothing;
|
|
118
142
|
}
|
|
119
143
|
const needleColor = this.needleColor ?? this._derivedNeedleColor;
|
|
144
|
+
const rOff = this._radiusOffset;
|
|
120
145
|
if (this.type === "needle") {
|
|
121
146
|
return svg`<g transform="rotate(${this.getAngle(this.value)}) translate(-256, -256)">
|
|
122
147
|
<circle cx="256" cy="256" r="14" fill=${needleColor}/>
|
|
123
|
-
<rect x="250" y="96" width="12" height="192" rx="6" fill=${needleColor}/>
|
|
124
|
-
<rect x="252" y="98" width="8" height="188" rx="4" stroke=${needleColor} fill=${needleColor} stroke-width="4"/>
|
|
125
|
-
</
|
|
148
|
+
<rect x="250" y="${96 - rOff}" width="12" height="${192 + rOff}" rx="6" fill=${needleColor}/>
|
|
149
|
+
<rect x="252" y="${98 - rOff}" width="8" height="${188 + rOff}" rx="4" stroke=${needleColor} fill=${needleColor} stroke-width="4"/>
|
|
150
|
+
</g>
|
|
126
151
|
`;
|
|
127
152
|
} else {
|
|
128
153
|
return svg`<g transform="rotate(${this.getAngle(this.value)}) translate(-256, -256)">
|
|
129
|
-
<rect x="252" y="96" width="8" height="48" rx="4" fill=${needleColor} stroke="var(--border-silhouette-color)"/>
|
|
130
|
-
</
|
|
154
|
+
<rect x="252" y="${96 - rOff}" width="8" height="48" rx="4" fill=${needleColor} stroke="var(--border-silhouette-color)"/>
|
|
155
|
+
</g>
|
|
131
156
|
`;
|
|
132
157
|
}
|
|
133
158
|
}
|
|
@@ -332,6 +357,9 @@ __decorateClass([
|
|
|
332
357
|
__decorateClass([
|
|
333
358
|
property({ type: Number })
|
|
334
359
|
], ObcInstrumentRadial.prototype, "clipBottom", 2);
|
|
360
|
+
__decorateClass([
|
|
361
|
+
property({ type: Boolean })
|
|
362
|
+
], ObcInstrumentRadial.prototype, "zoomToFitArc", 2);
|
|
335
363
|
ObcInstrumentRadial = __decorateClass([
|
|
336
364
|
customElement("obc-instrument-radial")
|
|
337
365
|
], ObcInstrumentRadial);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-radial.js","sources":["../../../src/building-blocks/instrument-radial/instrument-radial.ts"],"sourcesContent":["import {css, LitElement, html, svg, nothing} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {customElement} from '../../decorator.js';\nimport {\n AdviceState,\n AdviceType,\n AngleAdviceRaw,\n} from '../../navigation-instruments/watch/advice.js';\nimport {WatchCircleType} from '../../navigation-instruments/watch/watch.js';\nimport {Tickmark} from '../../navigation-instruments/watch/tickmark.js';\nimport {TickmarkType} from '../../navigation-instruments/watch/tickmark.js';\nimport {TickmarkStyle} from '../../navigation-instruments/watch/tickmark.js';\nimport {InstrumentState, Priority} from '../../navigation-instruments/types.js';\nimport {SetpointMixin} from '../../svghelpers/setpoint-mixin.js';\n\nexport enum ObcGaugeRadialType {\n filled = 'filled',\n bar = 'bar',\n needle = 'needle',\n}\n\nexport interface GaugeRadialAdvice {\n minValue: number;\n maxValue: number;\n type: AdviceType;\n hinted: boolean;\n}\n@customElement('obc-instrument-radial')\nexport class ObcInstrumentRadial extends SetpointMixin(LitElement) {\n // setpoint, newSetpoint, atSetpoint, touching, autoAtSetpoint,\n // autoAtSetpointDeadband, setpointAtZeroDeadband, setpointOverride\n // — all inherited from SetpointMixin\n\n @property({type: String}) state: InstrumentState = InstrumentState.active;\n @property({type: String}) priority: Priority = Priority.regular;\n\n @property({type: Number}) value = 0;\n @property({type: Number}) maxValue = 100;\n @property({type: Number}) minValue = 0;\n @property({attribute: false}) getAngle!: (v: number) => number;\n @property({type: String}) needleColor: string | undefined;\n @property({type: String}) barColor: string | undefined;\n @property({type: Boolean}) showLabels: boolean = false;\n /**\n * Interval for primary tickmarks in value units.\n * When undefined or <= 0, no primary tickmarks are shown.\n */\n @property({type: Number}) primaryTickmarkInterval: number | undefined = 50;\n /**\n * Interval for secondary tickmarks in value units.\n * When undefined or <= 0, no secondary tickmarks are shown.\n */\n @property({type: Number}) secondaryTickmarkInterval: number | undefined = 10;\n /**\n * Interval for tertiary tickmarks in value units.\n * When undefined or <= 0, no tertiary tickmarks are shown.\n */\n @property({type: Number}) tertiaryTickmarkInterval: number | undefined =\n undefined;\n @property({type: String}) type: ObcGaugeRadialType =\n ObcGaugeRadialType.filled;\n @property({type: String}) needleType: ObcGaugeRadialType =\n ObcGaugeRadialType.filled;\n @property({type: Boolean}) tickmarksInside: boolean = false;\n @property({type: String}) tickmarkStyle: TickmarkStyle =\n TickmarkStyle.regular;\n @property({type: Array, attribute: false}) advices: GaugeRadialAdvice[] = [];\n @property({type: Number}) clipTop: number = 0; // in percent of height\n @property({type: Number}) clipBottom: number = 0; // in percent of height\n\n get minAngle(): number {\n return this.getAngle(this.minValue);\n }\n\n get maxAngle(): number {\n return this.getAngle(this.maxValue);\n }\n\n private get _derivedNeedleColor(): string {\n if (\n this.state === InstrumentState.loading ||\n this.state === InstrumentState.off\n ) {\n return 'transparent';\n }\n return this.priority === Priority.enhanced\n ? 'var(--instrument-enhanced-secondary-color)'\n : 'var(--instrument-regular-secondary-color)';\n }\n\n private get _derivedBarColor(): string {\n if (\n this.state === InstrumentState.loading ||\n this.state === InstrumentState.off\n ) {\n return 'transparent';\n }\n if (this.type === ObcGaugeRadialType.filled) {\n return this.priority === Priority.enhanced\n ? 'var(--instrument-enhanced-secondary-color)'\n : 'var(--instrument-regular-secondary-color)';\n }\n return this.priority === Priority.enhanced\n ? 'var(--instrument-enhanced-tertiary-color)'\n : 'var(--instrument-regular-tertiary-color)';\n }\n\n override render() {\n const barColor = this.barColor ?? this._derivedBarColor;\n const setpointAngle =\n this.setpoint !== undefined ? this.getAngle(this.setpoint) : undefined;\n const newSetpointAngle =\n this.newSetpoint !== undefined\n ? this.getAngle(this.newSetpoint)\n : undefined;\n\n const barAreas =\n this.type === ObcGaugeRadialType.needle\n ? []\n : [\n {\n startAngle: this.getAngle(0),\n endAngle: this.getAngle(this.value),\n fillColor: barColor,\n },\n ];\n\n const width = 448;\n const height = width * (1 - this.clipTop / 100 - this.clipBottom / 100);\n const top = -width / 2 + (width * this.clipTop) / 100;\n const viewBox = `-${width / 2} ${top} ${width} ${height}`;\n\n return html`\n <div class=\"container\">\n <obc-watch\n .state=${this.state}\n .priority=${this.priority}\n .angleSetpoint=${setpointAngle}\n .newAngleSetpoint=${newSetpointAngle}\n .atAngleSetpoint=${this.computeAtSetpoint(this.value)}\n .angleSetpointAtZeroDeadband=${this.setpointAtZeroDeadband}\n .setpointOverride=${this.setpointOverride}\n .animateSetpoint=${this.animateSetpoint}\n .padding=${48}\n .tickmarks=${this.tickmarks}\n .tickmarksInside=${this.tickmarksInside}\n .tickmarkStyle=${this.tickmarkStyle}\n .advices=${this._advices}\n .areas=${[\n {\n startAngle: this.minAngle,\n endAngle: this.maxAngle,\n roundInsideCut: true,\n roundOutsideCut: true,\n },\n ]}\n .watchCircleType=${this.type === ObcGaugeRadialType.needle\n ? WatchCircleType.single\n : WatchCircleType.double}\n .barAreas=${barAreas}\n .clipTop=${this.clipTop}\n .clipBottom=${this.clipBottom}\n ></obc-watch>\n <svg class=\"gauge-radial\" viewBox=${viewBox}>${this._needle}</svg>\n </div>\n `;\n }\n\n private get _needle() {\n if (this.type === ObcGaugeRadialType.filled) {\n return nothing;\n }\n const needleColor = this.needleColor ?? this._derivedNeedleColor;\n if (this.type === ObcGaugeRadialType.needle) {\n return svg`<g transform=\"rotate(${this.getAngle(this.value)}) translate(-256, -256)\">\n <circle cx=\"256\" cy=\"256\" r=\"14\" fill=${needleColor}/>\n <rect x=\"250\" y=\"96\" width=\"12\" height=\"192\" rx=\"6\" fill=${needleColor}/>\n <rect x=\"252\" y=\"98\" width=\"8\" height=\"188\" rx=\"4\" stroke=${needleColor} fill=${needleColor} stroke-width=\"4\"/>\n </svg> \n`;\n } else {\n return svg`<g transform=\"rotate(${this.getAngle(this.value)}) translate(-256, -256)\">\n<rect x=\"252\" y=\"96\" width=\"8\" height=\"48\" rx=\"4\" fill=${needleColor} stroke=\"var(--border-silhouette-color)\"/>\n</svg>\n `;\n }\n }\n\n get tickmarks(): Tickmark[] {\n const tickmarks: Tickmark[] = [];\n\n // Primary tickmarks — skip when undefined or <= 0 to prevent infinite loops\n const primaryInterval = this.primaryTickmarkInterval;\n if (\n primaryInterval !== undefined &&\n primaryInterval > 0 &&\n Number.isFinite(primaryInterval)\n ) {\n for (let i = primaryInterval; i < this.maxValue; i += primaryInterval) {\n tickmarks.push({\n angle: this.getAngle(i),\n type: TickmarkType.primary,\n text: this.showLabels ? i.toString() : undefined,\n });\n }\n\n if (this.showLabels && this.maxValue % primaryInterval === 0) {\n tickmarks.push({\n angle: this.getAngle(this.maxValue),\n type: TickmarkType.textOnly,\n text: this.showLabels ? this.maxValue.toString() : undefined,\n });\n }\n\n for (let i = -primaryInterval; i > this.minValue; i -= primaryInterval) {\n tickmarks.push({\n angle: this.getAngle(i),\n type: TickmarkType.primary,\n text: this.showLabels ? i.toString() : undefined,\n });\n }\n\n if (this.showLabels && this.minValue % primaryInterval === 0) {\n tickmarks.push({\n angle: this.getAngle(this.minValue),\n type: TickmarkType.textOnly,\n text: this.showLabels ? this.minValue.toString() : undefined,\n });\n }\n }\n\n // Secondary tickmarks — skip when undefined or <= 0 to prevent infinite loops\n const secondaryInterval = this.secondaryTickmarkInterval;\n if (\n secondaryInterval !== undefined &&\n secondaryInterval > 0 &&\n Number.isFinite(secondaryInterval)\n ) {\n const existingTickmarks = tickmarks.map((t) => t.angle);\n\n for (\n let i = secondaryInterval;\n i < this.maxValue;\n i += secondaryInterval\n ) {\n if (existingTickmarks.includes(this.getAngle(i))) {\n continue;\n }\n tickmarks.push({\n angle: this.getAngle(i),\n type: TickmarkType.secondary,\n });\n }\n\n for (\n let i = -secondaryInterval;\n i > this.minValue;\n i -= secondaryInterval\n ) {\n if (existingTickmarks.includes(this.getAngle(i))) {\n continue;\n }\n tickmarks.push({\n angle: this.getAngle(i),\n type: TickmarkType.secondary,\n });\n }\n }\n\n // Tertiary tickmarks — skip when undefined or <= 0 to prevent infinite loops\n const tertiaryInterval = this.tertiaryTickmarkInterval;\n if (\n tertiaryInterval !== undefined &&\n tertiaryInterval > 0 &&\n Number.isFinite(tertiaryInterval)\n ) {\n const existingTickmarks = tickmarks.map((t) => t.angle);\n\n for (let i = tertiaryInterval; i < this.maxValue; i += tertiaryInterval) {\n if (existingTickmarks.includes(this.getAngle(i))) {\n continue;\n }\n tickmarks.push({\n angle: this.getAngle(i),\n type: TickmarkType.tertiary,\n });\n }\n\n for (\n let i = -tertiaryInterval;\n i > this.minValue;\n i -= tertiaryInterval\n ) {\n if (existingTickmarks.includes(this.getAngle(i))) {\n continue;\n }\n tickmarks.push({\n angle: this.getAngle(i),\n type: TickmarkType.tertiary,\n });\n }\n }\n\n // Add the zero tickmark\n\n const zeroTickmark = tickmarks.find((t) => t.angle === this.getAngle(0));\n if (zeroTickmark) {\n zeroTickmark.type =\n this.minValue < 0 ? TickmarkType.main : TickmarkType.textOnly;\n } else {\n tickmarks.push({\n angle: this.getAngle(0),\n type: this.minValue < 0 ? TickmarkType.main : TickmarkType.textOnly,\n text: this.showLabels ? '0' : undefined,\n });\n }\n\n return tickmarks;\n }\n\n private get _advices(): AngleAdviceRaw[] {\n return this.advices.map((advice) => {\n const minAngle = this.getAngle(advice.minValue);\n const maxAngle = this.getAngle(advice.maxValue);\n let state = advice.hinted ? AdviceState.hinted : AdviceState.regular;\n if (this.value >= advice.minValue && this.value <= advice.maxValue) {\n state = AdviceState.triggered;\n }\n\n return {\n minAngle,\n maxAngle,\n type: advice.type,\n state,\n hideMinTickmark: advice.minValue === this.minValue,\n hideMaxTickmark: advice.maxValue === this.maxValue,\n };\n });\n }\n\n static override styles = css`\n * {\n box-sizing: border-box;\n }\n\n .container {\n position: relative;\n width: 100%;\n height: 100%;\n }\n\n .container > * {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n }\n\n obc-watch {\n anchor-name: --watch;\n }\n\n .speed-gauge-value {\n position: absolute;\n top: clamp(\n 70%,\n calc(80% - (anchor-size(--watch height) - 200px) * 0.2),\n 80%\n );\n left: 50%;\n transform: translateX(-50%);\n width: fit-content;\n height: fit-content;\n }\n `;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-instrument-radial': ObcInstrumentRadial;\n }\n}\n"],"names":["ObcGaugeRadialType"],"mappings":";;;;;;;;;;;;;;;;;;AAeO,IAAK,uCAAAA,wBAAL;AACLA,sBAAA,QAAA,IAAS;AACTA,sBAAA,KAAA,IAAM;AACNA,sBAAA,QAAA,IAAS;AAHC,SAAAA;AAAA,GAAA,sBAAA,CAAA,CAAA;AAaL,IAAM,sBAAN,cAAkC,cAAc,UAAU,EAAE;AAAA,EAA5D,cAAA;AAAA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A,mBAAA,CAAA;AACD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GApCb,oBAoCe,WAAA,iBAAA,CAAA;AAEiB,gBAAA;AAAA,EAA1C,SAAS,EAAC,MAAM,OAAO,WAAW,OAAM;AAAA,GAtC9B,oBAsCgC,WAAA,WAAA,CAAA;AACjB,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAvCb,oBAuCe,WAAA,WAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAxCb,oBAwCe,WAAA,cAAA,CAAA;AAxCf,sBAAN,gBAAA;AAAA,EADN,cAAc,uBAAuB;AAAA,GACzB,mBAAA;"}
|
|
1
|
+
{"version":3,"file":"instrument-radial.js","sources":["../../../src/building-blocks/instrument-radial/instrument-radial.ts"],"sourcesContent":["import {css, LitElement, html, svg, nothing} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {customElement} from '../../decorator.js';\nimport {\n AdviceState,\n AdviceType,\n AngleAdviceRaw,\n} from '../../navigation-instruments/watch/advice.js';\nimport {WatchCircleType} from '../../navigation-instruments/watch/watch.js';\nimport {Tickmark} from '../../navigation-instruments/watch/tickmark.js';\nimport {TickmarkType} from '../../navigation-instruments/watch/tickmark.js';\nimport {TickmarkStyle} from '../../navigation-instruments/watch/tickmark.js';\nimport {InstrumentState, Priority} from '../../navigation-instruments/types.js';\nimport {SetpointMixin} from '../../svghelpers/setpoint-mixin.js';\nimport {\n OUTER_RING_RADIUS,\n innerRingRadiusFor,\n} from '../../navigation-instruments/watch/watch.js';\nimport {\n computeZoomToFitArcFrame,\n type ZoomToFitArcFrame,\n} from '../../svghelpers/arc-frame.js';\n\nexport enum ObcGaugeRadialType {\n filled = 'filled',\n bar = 'bar',\n needle = 'needle',\n}\n\nexport interface GaugeRadialAdvice {\n minValue: number;\n maxValue: number;\n type: AdviceType;\n hinted: boolean;\n}\n@customElement('obc-instrument-radial')\nexport class ObcInstrumentRadial extends SetpointMixin(LitElement) {\n // setpoint, newSetpoint, atSetpoint, touching, autoAtSetpoint,\n // autoAtSetpointDeadband, setpointAtZeroDeadband, setpointOverride\n // — all inherited from SetpointMixin\n\n @property({type: String}) state: InstrumentState = InstrumentState.active;\n @property({type: String}) priority: Priority = Priority.regular;\n\n @property({type: Number}) value = 0;\n @property({type: Number}) maxValue = 100;\n @property({type: Number}) minValue = 0;\n @property({attribute: false}) getAngle!: (v: number) => number;\n @property({type: String}) needleColor: string | undefined;\n @property({type: String}) barColor: string | undefined;\n @property({type: Boolean}) showLabels: boolean = false;\n /**\n * Interval for primary tickmarks in value units.\n * When undefined or <= 0, no primary tickmarks are shown.\n */\n @property({type: Number}) primaryTickmarkInterval: number | undefined = 50;\n /**\n * Interval for secondary tickmarks in value units.\n * When undefined or <= 0, no secondary tickmarks are shown.\n */\n @property({type: Number}) secondaryTickmarkInterval: number | undefined = 10;\n /**\n * Interval for tertiary tickmarks in value units.\n * When undefined or <= 0, no tertiary tickmarks are shown.\n */\n @property({type: Number}) tertiaryTickmarkInterval: number | undefined =\n undefined;\n @property({type: String}) type: ObcGaugeRadialType =\n ObcGaugeRadialType.filled;\n @property({type: String}) needleType: ObcGaugeRadialType =\n ObcGaugeRadialType.filled;\n @property({type: Boolean}) tickmarksInside: boolean = false;\n @property({type: String}) tickmarkStyle: TickmarkStyle =\n TickmarkStyle.regular;\n @property({type: Array, attribute: false}) advices: GaugeRadialAdvice[] = [];\n @property({type: Number}) clipTop: number = 0; // in percent of height\n @property({type: Number}) clipBottom: number = 0; // in percent of height\n @property({type: Boolean}) zoomToFitArc: boolean = false;\n\n private _radiusOffset = 0;\n private _arcFrame: ZoomToFitArcFrame | undefined;\n\n get minAngle(): number {\n return this.getAngle(this.minValue);\n }\n\n get maxAngle(): number {\n return this.getAngle(this.maxValue);\n }\n\n private get _derivedNeedleColor(): string {\n if (\n this.state === InstrumentState.loading ||\n this.state === InstrumentState.off\n ) {\n return 'transparent';\n }\n return this.priority === Priority.enhanced\n ? 'var(--instrument-enhanced-secondary-color)'\n : 'var(--instrument-regular-secondary-color)';\n }\n\n private get _derivedBarColor(): string {\n if (\n this.state === InstrumentState.loading ||\n this.state === InstrumentState.off\n ) {\n return 'transparent';\n }\n if (this.type === ObcGaugeRadialType.filled) {\n return this.priority === Priority.enhanced\n ? 'var(--instrument-enhanced-secondary-color)'\n : 'var(--instrument-regular-secondary-color)';\n }\n return this.priority === Priority.enhanced\n ? 'var(--instrument-enhanced-tertiary-color)'\n : 'var(--instrument-regular-tertiary-color)';\n }\n\n override render() {\n const barColor = this.barColor ?? this._derivedBarColor;\n const setpointAngle =\n this.setpoint !== undefined ? this.getAngle(this.setpoint) : undefined;\n const newSetpointAngle =\n this.newSetpoint !== undefined\n ? this.getAngle(this.newSetpoint)\n : undefined;\n\n const barAreas =\n this.type === ObcGaugeRadialType.needle\n ? []\n : [\n {\n startAngle: this.getAngle(0),\n endAngle: this.getAngle(this.value),\n fillColor: barColor,\n },\n ];\n\n const areas = [\n {\n startAngle: this.minAngle,\n endAngle: this.maxAngle,\n roundInsideCut: true,\n roundOutsideCut: true,\n },\n ];\n\n const watchCircleType =\n this.type === ObcGaugeRadialType.needle\n ? WatchCircleType.single\n : WatchCircleType.double;\n\n let viewBox: string;\n if (this.zoomToFitArc) {\n const ext = 48;\n const targetSize = (176 + ext) * 2;\n const frame = computeZoomToFitArcFrame({\n areas,\n outerRadius: OUTER_RING_RADIUS,\n innerRadius: innerRingRadiusFor(watchCircleType),\n extension: ext,\n targetSize,\n });\n viewBox = frame.viewBox;\n this._radiusOffset = frame.radiusOffset;\n this._arcFrame = frame;\n } else {\n this._radiusOffset = 0;\n this._arcFrame = undefined;\n const width = 448;\n const height = width * (1 - this.clipTop / 100 - this.clipBottom / 100);\n const top = -width / 2 + (width * this.clipTop) / 100;\n viewBox = `${-width / 2} ${top} ${width} ${height}`;\n }\n\n return html`\n <div class=\"container\">\n <obc-watch\n .state=${this.state}\n .priority=${this.priority}\n .angleSetpoint=${setpointAngle}\n .newAngleSetpoint=${newSetpointAngle}\n .atAngleSetpoint=${this.computeAtSetpoint(this.value)}\n .angleSetpointAtZeroDeadband=${this.setpointAtZeroDeadband}\n .setpointOverride=${this.setpointOverride}\n .animateSetpoint=${this.animateSetpoint}\n .padding=${48}\n .tickmarks=${this.tickmarks}\n .tickmarksInside=${this.tickmarksInside}\n .tickmarkStyle=${this.tickmarkStyle}\n .advices=${this._advices}\n .areas=${areas}\n .watchCircleType=${watchCircleType}\n .barAreas=${barAreas}\n .clipTop=${this.zoomToFitArc ? 0 : this.clipTop}\n .clipBottom=${this.zoomToFitArc ? 0 : this.clipBottom}\n .zoomToFitArc=${this.zoomToFitArc}\n .arcFrame=${this._arcFrame}\n ></obc-watch>\n <svg class=\"gauge-radial\" viewBox=${viewBox}>${this._needle}</svg>\n </div>\n `;\n }\n\n private get _needle() {\n if (this.type === ObcGaugeRadialType.filled) {\n return nothing;\n }\n const needleColor = this.needleColor ?? this._derivedNeedleColor;\n const rOff = this._radiusOffset;\n if (this.type === ObcGaugeRadialType.needle) {\n return svg`<g transform=\"rotate(${this.getAngle(this.value)}) translate(-256, -256)\">\n <circle cx=\"256\" cy=\"256\" r=\"14\" fill=${needleColor}/>\n <rect x=\"250\" y=\"${96 - rOff}\" width=\"12\" height=\"${192 + rOff}\" rx=\"6\" fill=${needleColor}/>\n <rect x=\"252\" y=\"${98 - rOff}\" width=\"8\" height=\"${188 + rOff}\" rx=\"4\" stroke=${needleColor} fill=${needleColor} stroke-width=\"4\"/>\n </g>\n`;\n } else {\n return svg`<g transform=\"rotate(${this.getAngle(this.value)}) translate(-256, -256)\">\n<rect x=\"252\" y=\"${96 - rOff}\" width=\"8\" height=\"48\" rx=\"4\" fill=${needleColor} stroke=\"var(--border-silhouette-color)\"/>\n</g>\n `;\n }\n }\n\n get tickmarks(): Tickmark[] {\n const tickmarks: Tickmark[] = [];\n\n // Primary tickmarks — skip when undefined or <= 0 to prevent infinite loops\n const primaryInterval = this.primaryTickmarkInterval;\n if (\n primaryInterval !== undefined &&\n primaryInterval > 0 &&\n Number.isFinite(primaryInterval)\n ) {\n for (let i = primaryInterval; i < this.maxValue; i += primaryInterval) {\n tickmarks.push({\n angle: this.getAngle(i),\n type: TickmarkType.primary,\n text: this.showLabels ? i.toString() : undefined,\n });\n }\n\n if (this.showLabels && this.maxValue % primaryInterval === 0) {\n tickmarks.push({\n angle: this.getAngle(this.maxValue),\n type: TickmarkType.textOnly,\n text: this.showLabels ? this.maxValue.toString() : undefined,\n });\n }\n\n for (let i = -primaryInterval; i > this.minValue; i -= primaryInterval) {\n tickmarks.push({\n angle: this.getAngle(i),\n type: TickmarkType.primary,\n text: this.showLabels ? i.toString() : undefined,\n });\n }\n\n if (this.showLabels && this.minValue % primaryInterval === 0) {\n tickmarks.push({\n angle: this.getAngle(this.minValue),\n type: TickmarkType.textOnly,\n text: this.showLabels ? this.minValue.toString() : undefined,\n });\n }\n }\n\n // Secondary tickmarks — skip when undefined or <= 0 to prevent infinite loops\n const secondaryInterval = this.secondaryTickmarkInterval;\n if (\n secondaryInterval !== undefined &&\n secondaryInterval > 0 &&\n Number.isFinite(secondaryInterval)\n ) {\n const existingTickmarks = tickmarks.map((t) => t.angle);\n\n for (\n let i = secondaryInterval;\n i < this.maxValue;\n i += secondaryInterval\n ) {\n if (existingTickmarks.includes(this.getAngle(i))) {\n continue;\n }\n tickmarks.push({\n angle: this.getAngle(i),\n type: TickmarkType.secondary,\n });\n }\n\n for (\n let i = -secondaryInterval;\n i > this.minValue;\n i -= secondaryInterval\n ) {\n if (existingTickmarks.includes(this.getAngle(i))) {\n continue;\n }\n tickmarks.push({\n angle: this.getAngle(i),\n type: TickmarkType.secondary,\n });\n }\n }\n\n // Tertiary tickmarks — skip when undefined or <= 0 to prevent infinite loops\n const tertiaryInterval = this.tertiaryTickmarkInterval;\n if (\n tertiaryInterval !== undefined &&\n tertiaryInterval > 0 &&\n Number.isFinite(tertiaryInterval)\n ) {\n const existingTickmarks = tickmarks.map((t) => t.angle);\n\n for (let i = tertiaryInterval; i < this.maxValue; i += tertiaryInterval) {\n if (existingTickmarks.includes(this.getAngle(i))) {\n continue;\n }\n tickmarks.push({\n angle: this.getAngle(i),\n type: TickmarkType.tertiary,\n });\n }\n\n for (\n let i = -tertiaryInterval;\n i > this.minValue;\n i -= tertiaryInterval\n ) {\n if (existingTickmarks.includes(this.getAngle(i))) {\n continue;\n }\n tickmarks.push({\n angle: this.getAngle(i),\n type: TickmarkType.tertiary,\n });\n }\n }\n\n // Add the zero tickmark\n\n const zeroTickmark = tickmarks.find((t) => t.angle === this.getAngle(0));\n if (zeroTickmark) {\n zeroTickmark.type =\n this.minValue < 0 ? TickmarkType.main : TickmarkType.textOnly;\n } else {\n tickmarks.push({\n angle: this.getAngle(0),\n type: this.minValue < 0 ? TickmarkType.main : TickmarkType.textOnly,\n text: this.showLabels ? '0' : undefined,\n });\n }\n\n return tickmarks;\n }\n\n private get _advices(): AngleAdviceRaw[] {\n return this.advices.map((advice) => {\n const minAngle = this.getAngle(advice.minValue);\n const maxAngle = this.getAngle(advice.maxValue);\n let state = advice.hinted ? AdviceState.hinted : AdviceState.regular;\n if (this.value >= advice.minValue && this.value <= advice.maxValue) {\n state = AdviceState.triggered;\n }\n\n return {\n minAngle,\n maxAngle,\n type: advice.type,\n state,\n hideMinTickmark: advice.minValue === this.minValue,\n hideMaxTickmark: advice.maxValue === this.maxValue,\n };\n });\n }\n\n static override styles = css`\n * {\n box-sizing: border-box;\n }\n\n .container {\n position: relative;\n width: 100%;\n height: 100%;\n }\n\n .container > * {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n }\n\n obc-watch {\n anchor-name: --watch;\n }\n\n .speed-gauge-value {\n position: absolute;\n top: clamp(\n 70%,\n calc(80% - (anchor-size(--watch height) - 200px) * 0.2),\n 80%\n );\n left: 50%;\n transform: translateX(-50%);\n width: fit-content;\n height: fit-content;\n }\n `;\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B,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAvCb,oBAuCe,WAAA,WAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAxCb,oBAwCe,WAAA,cAAA,CAAA;AACC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAzCd,oBAyCgB,WAAA,gBAAA,CAAA;AAzChB,sBAAN,gBAAA;AAAA,EADN,cAAc,uBAAuB;AAAA,GACzB,mBAAA;"}
|
|
@@ -4,5 +4,5 @@ export declare enum ArrowStyle {
|
|
|
4
4
|
HDG = "HDG",
|
|
5
5
|
COG = "COG"
|
|
6
6
|
}
|
|
7
|
-
export declare function arrow(style: ArrowStyle, angle: number, priority?: Priority): SVGTemplateResult | SVGTemplateResult[];
|
|
7
|
+
export declare function arrow(style: ArrowStyle, angle: number, priority?: Priority, radiusOffset?: number): SVGTemplateResult | SVGTemplateResult[];
|
|
8
8
|
//# sourceMappingURL=arrow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/compass/arrow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAM,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAErC,oBAAY,UAAU;IACpB,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED,wBAAgB,KAAK,CACnB,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,QAA2B,
|
|
1
|
+
{"version":3,"file":"arrow.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/compass/arrow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAM,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAErC,oBAAY,UAAU;IACpB,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED,wBAAgB,KAAK,CACnB,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,QAA2B,EACrC,YAAY,SAAI,GACf,iBAAiB,GAAG,iBAAiB,EAAE,CAiCzC"}
|
|
@@ -5,11 +5,11 @@ var ArrowStyle = /* @__PURE__ */ ((ArrowStyle2) => {
|
|
|
5
5
|
ArrowStyle2["COG"] = "COG";
|
|
6
6
|
return ArrowStyle2;
|
|
7
7
|
})(ArrowStyle || {});
|
|
8
|
-
function arrow(style, angle, priority = Priority.regular) {
|
|
8
|
+
function arrow(style, angle, priority = Priority.regular, radiusOffset = 0) {
|
|
9
9
|
const colorName = priority === Priority.enhanced ? "var(--instrument-enhanced-secondary-color)" : "var(--instrument-regular-secondary-color)";
|
|
10
10
|
if (style === "HDG") {
|
|
11
11
|
return svg`
|
|
12
|
-
<g transform="rotate(${angle}) translate(-256, -256)">
|
|
12
|
+
<g transform="rotate(${angle}) translate(-256, ${-256 - radiusOffset})">
|
|
13
13
|
|
|
14
14
|
<path d="M254.654 100.32C255.219 99.1903 256.906 99.2277 257.396 100.433L272.312 137.092L272.388 137.301C273.067 139.455 270.647 141.314 268.676 140.13V140.129L256 132.582L243.323 140.129L243.324 140.13C241.289 141.352 238.777 139.332 239.688 137.092L254.604 100.433L254.654 100.32Z"
|
|
15
15
|
fill=${colorName} stroke="var(--border-silhouette-color)" stroke-width="1" vector-effect="non-scaling-stroke"/>
|
|
@@ -17,7 +17,7 @@ function arrow(style, angle, priority = Priority.regular) {
|
|
|
17
17
|
`;
|
|
18
18
|
} else if (style === "COG") {
|
|
19
19
|
return svg`
|
|
20
|
-
<g transform="rotate(${angle}) translate(-256, -256)">
|
|
20
|
+
<g transform="rotate(${angle}) translate(-256, ${-256 - radiusOffset})">
|
|
21
21
|
<mask id="path-1-outside-1_133_32856" maskUnits="userSpaceOnUse" x="238" y="99" width="36" height="42" fill="black">
|
|
22
22
|
<rect fill="white" x="238" y="99" width="36" height="42"/>
|
|
23
23
|
<path fill-rule="evenodd" clip-rule="evenodd" vector-effect="non-scaling-stroke" d="M256 127.334L265.867 133.192L256 108.941L246.133 133.192L256 127.334ZM255.067 100.621C255.404 99.7929 256.596 99.7929 256.933 100.621L271.849 137.28C272.567 139.046 270.584 140.693 268.933 139.701L256 132L243.067 139.701C241.416 140.693 239.433 139.046 240.151 137.28L255.067 100.621Z"/>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow.js","sources":["../../../src/navigation-instruments/compass/arrow.ts"],"sourcesContent":["import {SVGTemplateResult, svg} from 'lit';\nimport {Priority} from '../types.js';\n\nexport enum ArrowStyle {\n HDG = 'HDG',\n COG = 'COG',\n}\n\nexport function arrow(\n style: ArrowStyle,\n angle: number,\n priority: Priority = Priority.regular\n): SVGTemplateResult | SVGTemplateResult[] {\n const colorName =\n priority === Priority.enhanced\n ? 'var(--instrument-enhanced-secondary-color)'\n : 'var(--instrument-regular-secondary-color)';\n\n if (style === ArrowStyle.HDG) {\n return svg`\n <g transform=\"rotate(${angle}) translate(-256, -256)\">\n\n<path d=\"M254.654 100.32C255.219 99.1903 256.906 99.2277 257.396 100.433L272.312 137.092L272.388 137.301C273.067 139.455 270.647 141.314 268.676 140.13V140.129L256 132.582L243.323 140.129L243.324 140.13C241.289 141.352 238.777 139.332 239.688 137.092L254.604 100.433L254.654 100.32Z\"\n fill=${colorName} stroke=\"var(--border-silhouette-color)\" stroke-width=\"1\" vector-effect=\"non-scaling-stroke\"/>\n </g>\n `;\n } else if (style === ArrowStyle.COG) {\n return svg`\n <g transform=\"rotate(${angle}) translate(-256, -256)\">\n<mask id=\"path-1-outside-1_133_32856\" maskUnits=\"userSpaceOnUse\" x=\"238\" y=\"99\" width=\"36\" height=\"42\" fill=\"black\">\n<rect fill=\"white\" x=\"238\" y=\"99\" width=\"36\" height=\"42\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" vector-effect=\"non-scaling-stroke\" d=\"M256 127.334L265.867 133.192L256 108.941L246.133 133.192L256 127.334ZM255.067 100.621C255.404 99.7929 256.596 99.7929 256.933 100.621L271.849 137.28C272.567 139.046 270.584 140.693 268.933 139.701L256 132L243.067 139.701C241.416 140.693 239.433 139.046 240.151 137.28L255.067 100.621Z\"/>\n</mask>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M256 127.334L265.867 133.192L256 108.941L246.133 133.192L256 127.334ZM255.067 100.621C255.404 99.7929 256.596 99.7929 256.933 100.621L271.849 137.28C272.567 139.046 270.584 140.693 268.933 139.701L256 132L243.067 139.701C241.416 140.693 239.433 139.046 240.151 137.28L255.067 100.621Z\"\n fill=${colorName} />\n<path d=\"M256 127.334L256.511 126.474L256 126.171L255.489 126.474L256 127.334ZM265.867 133.192L265.357 134.052L267.914 135.571L266.793 132.816L265.867 133.192ZM256 108.941L256.926 108.564L256 106.288L255.074 108.564L256 108.941ZM246.133 133.192L245.207 132.816L244.086 135.571L246.643 134.052L246.133 133.192ZM255.067 100.621L254.14 100.244L255.067 100.621ZM256.933 100.621L257.86 100.244L256.933 100.621ZM271.849 137.28L270.922 137.657L271.849 137.28ZM268.933 139.701L269.448 138.844L269.445 138.842L268.933 139.701ZM256 132L256.512 131.141L256 130.836L255.488 131.141L256 132ZM243.067 139.701L242.555 138.842L242.552 138.844L243.067 139.701ZM240.151 137.28L241.078 137.657L240.151 137.28ZM255.489 128.193L265.357 134.052L266.378 132.333L256.511 126.474L255.489 128.193ZM266.793 132.816L256.926 108.564L255.074 109.318L264.941 133.569L266.793 132.816ZM255.074 108.564L245.207 132.816L247.059 133.569L256.926 109.318L255.074 108.564ZM246.643 134.052L256.511 128.193L255.489 126.474L245.622 132.333L246.643 134.052ZM255.993 100.998C255.994 100.994 255.996 100.992 255.996 100.992C255.996 100.992 255.995 100.993 255.994 100.994C255.991 100.997 255.988 101 255.986 101.002C255.984 101.003 255.984 101.002 255.987 101.002C255.99 101.001 255.994 101 256 101C256.006 101 256.01 101.001 256.013 101.002C256.016 101.002 256.016 101.003 256.014 101.002C256.012 101 256.009 100.997 256.006 100.994C256.005 100.993 256.004 100.992 256.004 100.992C256.004 100.992 256.006 100.994 256.007 100.998L257.86 100.244C257.185 98.5852 254.815 98.5852 254.14 100.244L255.993 100.998ZM256.007 100.998L270.922 137.657L272.775 136.903L257.86 100.244L256.007 100.998ZM270.922 137.657C271.255 138.473 270.33 139.373 269.448 138.844L268.418 140.558C270.838 142.012 273.879 139.618 272.775 136.903L270.922 137.657ZM269.445 138.842L256.512 131.141L255.488 132.859L268.422 140.56L269.445 138.842ZM255.488 131.141L242.555 138.842L243.578 140.56L256.512 132.859L255.488 131.141ZM242.552 138.844C241.67 139.373 240.745 138.473 241.078 137.657L239.225 136.903C238.121 139.618 241.162 142.012 243.582 140.558L242.552 138.844ZM241.078 137.657L255.993 100.998L254.14 100.244L239.225 136.903L241.078 137.657Z\" \nfill=\"var(--border-silhouette-color)\" vector-effect=\"non-scaling-stroke\" mask=\"url(#path-1-outside-1_133_32856)\"/>\n\n </g>\n `;\n } else {\n return [];\n }\n\n // return [...shaft, circle, arrowTip];\n}\n"],"names":["ArrowStyle"],"mappings":";;AAGO,IAAK,+BAAAA,gBAAL;AACLA,cAAA,KAAA,IAAM;AACNA,cAAA,KAAA,IAAM;AAFI,SAAAA;AAAA,GAAA,cAAA,CAAA,CAAA;AAKL,SAAS,MACd,OACA,OACA,WAAqB,SAAS,
|
|
1
|
+
{"version":3,"file":"arrow.js","sources":["../../../src/navigation-instruments/compass/arrow.ts"],"sourcesContent":["import {SVGTemplateResult, svg} from 'lit';\nimport {Priority} from '../types.js';\n\nexport enum ArrowStyle {\n HDG = 'HDG',\n COG = 'COG',\n}\n\nexport function arrow(\n style: ArrowStyle,\n angle: number,\n priority: Priority = Priority.regular,\n radiusOffset = 0\n): SVGTemplateResult | SVGTemplateResult[] {\n const colorName =\n priority === Priority.enhanced\n ? 'var(--instrument-enhanced-secondary-color)'\n : 'var(--instrument-regular-secondary-color)';\n\n if (style === ArrowStyle.HDG) {\n return svg`\n <g transform=\"rotate(${angle}) translate(-256, ${-256 - radiusOffset})\">\n\n<path d=\"M254.654 100.32C255.219 99.1903 256.906 99.2277 257.396 100.433L272.312 137.092L272.388 137.301C273.067 139.455 270.647 141.314 268.676 140.13V140.129L256 132.582L243.323 140.129L243.324 140.13C241.289 141.352 238.777 139.332 239.688 137.092L254.604 100.433L254.654 100.32Z\"\n fill=${colorName} stroke=\"var(--border-silhouette-color)\" stroke-width=\"1\" vector-effect=\"non-scaling-stroke\"/>\n </g>\n `;\n } else if (style === ArrowStyle.COG) {\n return svg`\n <g transform=\"rotate(${angle}) translate(-256, ${-256 - radiusOffset})\">\n<mask id=\"path-1-outside-1_133_32856\" maskUnits=\"userSpaceOnUse\" x=\"238\" y=\"99\" width=\"36\" height=\"42\" fill=\"black\">\n<rect fill=\"white\" x=\"238\" y=\"99\" width=\"36\" height=\"42\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" vector-effect=\"non-scaling-stroke\" d=\"M256 127.334L265.867 133.192L256 108.941L246.133 133.192L256 127.334ZM255.067 100.621C255.404 99.7929 256.596 99.7929 256.933 100.621L271.849 137.28C272.567 139.046 270.584 140.693 268.933 139.701L256 132L243.067 139.701C241.416 140.693 239.433 139.046 240.151 137.28L255.067 100.621Z\"/>\n</mask>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M256 127.334L265.867 133.192L256 108.941L246.133 133.192L256 127.334ZM255.067 100.621C255.404 99.7929 256.596 99.7929 256.933 100.621L271.849 137.28C272.567 139.046 270.584 140.693 268.933 139.701L256 132L243.067 139.701C241.416 140.693 239.433 139.046 240.151 137.28L255.067 100.621Z\"\n fill=${colorName} />\n<path d=\"M256 127.334L256.511 126.474L256 126.171L255.489 126.474L256 127.334ZM265.867 133.192L265.357 134.052L267.914 135.571L266.793 132.816L265.867 133.192ZM256 108.941L256.926 108.564L256 106.288L255.074 108.564L256 108.941ZM246.133 133.192L245.207 132.816L244.086 135.571L246.643 134.052L246.133 133.192ZM255.067 100.621L254.14 100.244L255.067 100.621ZM256.933 100.621L257.86 100.244L256.933 100.621ZM271.849 137.28L270.922 137.657L271.849 137.28ZM268.933 139.701L269.448 138.844L269.445 138.842L268.933 139.701ZM256 132L256.512 131.141L256 130.836L255.488 131.141L256 132ZM243.067 139.701L242.555 138.842L242.552 138.844L243.067 139.701ZM240.151 137.28L241.078 137.657L240.151 137.28ZM255.489 128.193L265.357 134.052L266.378 132.333L256.511 126.474L255.489 128.193ZM266.793 132.816L256.926 108.564L255.074 109.318L264.941 133.569L266.793 132.816ZM255.074 108.564L245.207 132.816L247.059 133.569L256.926 109.318L255.074 108.564ZM246.643 134.052L256.511 128.193L255.489 126.474L245.622 132.333L246.643 134.052ZM255.993 100.998C255.994 100.994 255.996 100.992 255.996 100.992C255.996 100.992 255.995 100.993 255.994 100.994C255.991 100.997 255.988 101 255.986 101.002C255.984 101.003 255.984 101.002 255.987 101.002C255.99 101.001 255.994 101 256 101C256.006 101 256.01 101.001 256.013 101.002C256.016 101.002 256.016 101.003 256.014 101.002C256.012 101 256.009 100.997 256.006 100.994C256.005 100.993 256.004 100.992 256.004 100.992C256.004 100.992 256.006 100.994 256.007 100.998L257.86 100.244C257.185 98.5852 254.815 98.5852 254.14 100.244L255.993 100.998ZM256.007 100.998L270.922 137.657L272.775 136.903L257.86 100.244L256.007 100.998ZM270.922 137.657C271.255 138.473 270.33 139.373 269.448 138.844L268.418 140.558C270.838 142.012 273.879 139.618 272.775 136.903L270.922 137.657ZM269.445 138.842L256.512 131.141L255.488 132.859L268.422 140.56L269.445 138.842ZM255.488 131.141L242.555 138.842L243.578 140.56L256.512 132.859L255.488 131.141ZM242.552 138.844C241.67 139.373 240.745 138.473 241.078 137.657L239.225 136.903C238.121 139.618 241.162 142.012 243.582 140.558L242.552 138.844ZM241.078 137.657L255.993 100.998L254.14 100.244L239.225 136.903L241.078 137.657Z\" \nfill=\"var(--border-silhouette-color)\" vector-effect=\"non-scaling-stroke\" mask=\"url(#path-1-outside-1_133_32856)\"/>\n\n </g>\n `;\n } else {\n return [];\n }\n\n // return [...shaft, circle, arrowTip];\n}\n"],"names":["ArrowStyle"],"mappings":";;AAGO,IAAK,+BAAAA,gBAAL;AACLA,cAAA,KAAA,IAAM;AACNA,cAAA,KAAA,IAAM;AAFI,SAAAA;AAAA,GAAA,cAAA,CAAA,CAAA;AAKL,SAAS,MACd,OACA,OACA,WAAqB,SAAS,SAC9B,eAAe,GAC0B;AACzC,QAAM,YACJ,aAAa,SAAS,WAClB,+CACA;AAEN,MAAI,UAAU,OAAgB;AAC5B,WAAO;AAAA,6BACkB,KAAK,qBAAqB,OAAO,YAAY;AAAA;AAAA;AAAA,QAGlE,SAAS;AAAA;AAAA;AAAA,EAGf,WAAW,UAAU,OAAgB;AACnC,WAAO;AAAA,6BACkB,KAAK,qBAAqB,OAAO,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAMhE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMjB,OAAO;AACL,WAAO,CAAA;AAAA,EACT;AAGF;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from 'lit';
|
|
2
2
|
import { AngleAdvice } from '../watch/advice.js';
|
|
3
|
-
import { VesselImage } from '../watch/watch.js';
|
|
3
|
+
import { VesselImage, RotType, RotPosition } from '../watch/watch.js';
|
|
4
4
|
import { InstrumentState, Priority } from '../types.js';
|
|
5
5
|
import '../watch/watch.js';
|
|
6
|
+
export { RotType };
|
|
6
7
|
export declare enum CompassDirection {
|
|
7
8
|
NorthUp = "northUp",
|
|
8
9
|
HeadingUp = "headingUp",
|
|
@@ -37,7 +38,10 @@ export declare enum CompassPriorityElement {
|
|
|
37
38
|
* - **Advice zones**: Pass `headingAdvices` to render caution/alert arcs;
|
|
38
39
|
* triggered state is derived from whether the current heading falls
|
|
39
40
|
* inside the advice range.
|
|
40
|
-
* - **Rate of turn**: Animated ROT
|
|
41
|
+
* - **Rate of turn**: Animated ROT indicator driven by `rotationsPerMinute`.
|
|
42
|
+
* Supports spinning dots (`rotType="dots"`) and a banana-shaped arc bar
|
|
43
|
+
* (`rotType="bar"`) showing the HDG→COG span. Position on the outer
|
|
44
|
+
* scale ring or inner circle via `rotPosition`.
|
|
41
45
|
* - **Environmental overlays**: Wind speed/direction and current
|
|
42
46
|
* speed/direction indicators on the watch face.
|
|
43
47
|
* - **Vessel image**: Configurable vessel silhouette centered on the
|
|
@@ -84,6 +88,8 @@ export declare enum CompassPriorityElement {
|
|
|
84
88
|
* @property {number | null} currentFromDirection - The direction the current is coming from in degrees.
|
|
85
89
|
* @property {VesselImage} vesselImage - The image of the vessel.
|
|
86
90
|
* @property {number} rotationsPerMinute - The number of rotations per minute for the rate of turn controller.
|
|
91
|
+
* @property {RotType} rotType - ROT display mode: `'dots'` (spinning dots, default) or `'bar'` (arc bar from HDG to COG).
|
|
92
|
+
* @property {RotPosition} rotPosition - ROT track position: `'innerCircle'` (default) or `'scale'` (on the outer ring).
|
|
87
93
|
* @property {Priority} priority - Color priority: `Priority.enhanced` uses the blue/enhanced color palette, `Priority.regular` (default) uses the standard palette.
|
|
88
94
|
*
|
|
89
95
|
* @ignition-base-height: 512px
|
|
@@ -108,6 +114,10 @@ export declare class ObcCompass extends LitElement {
|
|
|
108
114
|
currentFromDirection: number | null;
|
|
109
115
|
vesselImage: VesselImage;
|
|
110
116
|
rotationsPerMinute: number;
|
|
117
|
+
rotType: RotType;
|
|
118
|
+
rotPosition: RotPosition;
|
|
119
|
+
rotMaxValue: number;
|
|
120
|
+
rotArcExtent: number;
|
|
111
121
|
direction: CompassDirection;
|
|
112
122
|
state: InstrumentState;
|
|
113
123
|
priority: Priority;
|
|
@@ -116,13 +126,9 @@ export declare class ObcCompass extends LitElement {
|
|
|
116
126
|
showLabels: boolean;
|
|
117
127
|
/** When true, labels and north arrow are placed inside the outer ring. */
|
|
118
128
|
tickmarksInside: boolean;
|
|
119
|
-
protected updated(_changedProperties: PropertyValues): void;
|
|
120
129
|
private _headingSp;
|
|
121
130
|
willUpdate(changed: PropertyValues): void;
|
|
122
131
|
disconnectedCallback(): void;
|
|
123
|
-
private rot;
|
|
124
|
-
private rateOfTurnController?;
|
|
125
|
-
firstUpdated(): void;
|
|
126
132
|
private _resizeController;
|
|
127
133
|
private getPadding;
|
|
128
134
|
private get angleAdviceRaw();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compass.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/compass/compass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,cAAc,EAAY,MAAM,KAAK,CAAC;AAE1D,OAAO,mBAAmB,CAAC;AAG3B,OAAO,EAAc,WAAW,EAAiB,MAAM,oBAAoB,CAAC;AAE5E,OAAO,
|
|
1
|
+
{"version":3,"file":"compass.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/compass/compass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,cAAc,EAAY,MAAM,KAAK,CAAC;AAE1D,OAAO,mBAAmB,CAAC;AAG3B,OAAO,EAAc,WAAW,EAAiB,MAAM,oBAAoB,CAAC;AAE5E,OAAO,EACL,WAAW,EAGX,OAAO,EACP,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,MAAM,aAAa,CAAC;AACtD,OAAO,EAAC,OAAO,EAAC,CAAC;AAEjB,oBAAY,gBAAgB;IAC1B,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,QAAQ,aAAa;CACtB;AAED,oBAAY,sBAAsB;IAChC,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,GAUzB;IAED,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,WAAW;IAWV,MAAM;IAyEf,OAAgB,MAAM,0BAwBpB;CACH;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { css, LitElement, html } from "lit";
|
|
2
|
-
import { property
|
|
2
|
+
import { property } from "lit/decorators.js";
|
|
3
3
|
import { WatchCircleType } from "../watch/watch.js";
|
|
4
4
|
import { TickmarkType } from "../watch/tickmark.js";
|
|
5
5
|
import { arrow, ArrowStyle } from "./arrow.js";
|
|
6
6
|
import { AdviceState } from "../watch/advice.js";
|
|
7
7
|
import { ResizeController } from "@lit-labs/observers/resize-controller.js";
|
|
8
8
|
import { SetpointBundle } from "../../svghelpers/setpoint-bundle.js";
|
|
9
|
-
import { rot } from "./rot.js";
|
|
10
|
-
import { RateOfTurnController } from "../rate-of-turn/rate-of-turn.controller.js";
|
|
11
9
|
import { customElement } from "../../decorator.js";
|
|
12
10
|
import { InstrumentState, Priority } from "../types.js";
|
|
13
11
|
import { VesselImage, VesselImageSize } from "../watch/vessel.js";
|
|
12
|
+
import { RotType, RotPosition } from "../rate-of-turn/rot-renderer.js";
|
|
14
13
|
var __defProp = Object.defineProperty;
|
|
15
14
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
16
15
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -55,6 +54,10 @@ let ObcCompass = class extends LitElement {
|
|
|
55
54
|
this.currentFromDirection = null;
|
|
56
55
|
this.vesselImage = VesselImage.genericTop;
|
|
57
56
|
this.rotationsPerMinute = 1;
|
|
57
|
+
this.rotType = RotType.dots;
|
|
58
|
+
this.rotPosition = RotPosition.innerCircle;
|
|
59
|
+
this.rotMaxValue = 10;
|
|
60
|
+
this.rotArcExtent = 60;
|
|
58
61
|
this.direction = "northUp";
|
|
59
62
|
this.state = InstrumentState.active;
|
|
60
63
|
this.priority = Priority.regular;
|
|
@@ -70,12 +73,6 @@ let ObcCompass = class extends LitElement {
|
|
|
70
73
|
});
|
|
71
74
|
this._resizeController = new ResizeController(this, {});
|
|
72
75
|
}
|
|
73
|
-
updated(_changedProperties) {
|
|
74
|
-
super.updated(_changedProperties);
|
|
75
|
-
if (_changedProperties.has("rotationsPerMinute") && this.rateOfTurnController) {
|
|
76
|
-
this.rateOfTurnController.rotationsPerMinute = this.rotationsPerMinute;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
76
|
willUpdate(changed) {
|
|
80
77
|
super.willUpdate(changed);
|
|
81
78
|
this._headingSp.sync({
|
|
@@ -94,13 +91,6 @@ let ObcCompass = class extends LitElement {
|
|
|
94
91
|
super.disconnectedCallback();
|
|
95
92
|
this._headingSp.dispose();
|
|
96
93
|
}
|
|
97
|
-
firstUpdated() {
|
|
98
|
-
this.rateOfTurnController = new RateOfTurnController(
|
|
99
|
-
this,
|
|
100
|
-
this.rot,
|
|
101
|
-
this.rotationsPerMinute
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
94
|
getPadding() {
|
|
105
95
|
const size = Math.min(this.clientHeight, this.clientWidth);
|
|
106
96
|
const deltaWidth = 512 - size;
|
|
@@ -186,6 +176,15 @@ let ObcCompass = class extends LitElement {
|
|
|
186
176
|
/* current */
|
|
187
177
|
)}
|
|
188
178
|
.rotation=${this.getRotation()}
|
|
179
|
+
.rotType=${this.rotType}
|
|
180
|
+
.rotPosition=${this.rotPosition}
|
|
181
|
+
.rotStartAngle=${this.heading + (this.getRotation() ?? 0)}
|
|
182
|
+
.rotEndAngle=${this.heading + this.rotationsPerMinute / (this.rotMaxValue || 1) * this.rotArcExtent + (this.getRotation() ?? 0)}
|
|
183
|
+
.rotPriority=${this.priorityFor(
|
|
184
|
+
"rot"
|
|
185
|
+
/* rot */
|
|
186
|
+
)}
|
|
187
|
+
.rotationsPerMinute=${this.rotationsPerMinute}
|
|
189
188
|
>
|
|
190
189
|
</obc-watch>
|
|
191
190
|
<svg viewBox="${viewBox}">
|
|
@@ -205,10 +204,6 @@ let ObcCompass = class extends LitElement {
|
|
|
205
204
|
/* cog */
|
|
206
205
|
)
|
|
207
206
|
)}
|
|
208
|
-
<g id="rot">${rot(this.colorFor(
|
|
209
|
-
"rot"
|
|
210
|
-
/* rot */
|
|
211
|
-
))}</g>
|
|
212
207
|
</svg>
|
|
213
208
|
</div>
|
|
214
209
|
`;
|
|
@@ -293,6 +288,18 @@ __decorateClass([
|
|
|
293
288
|
__decorateClass([
|
|
294
289
|
property({ type: Number })
|
|
295
290
|
], ObcCompass.prototype, "rotationsPerMinute", 2);
|
|
291
|
+
__decorateClass([
|
|
292
|
+
property({ type: String })
|
|
293
|
+
], ObcCompass.prototype, "rotType", 2);
|
|
294
|
+
__decorateClass([
|
|
295
|
+
property({ type: String })
|
|
296
|
+
], ObcCompass.prototype, "rotPosition", 2);
|
|
297
|
+
__decorateClass([
|
|
298
|
+
property({ type: Number })
|
|
299
|
+
], ObcCompass.prototype, "rotMaxValue", 2);
|
|
300
|
+
__decorateClass([
|
|
301
|
+
property({ type: Number })
|
|
302
|
+
], ObcCompass.prototype, "rotArcExtent", 2);
|
|
296
303
|
__decorateClass([
|
|
297
304
|
property({ type: String })
|
|
298
305
|
], ObcCompass.prototype, "direction", 2);
|
|
@@ -311,15 +318,13 @@ __decorateClass([
|
|
|
311
318
|
__decorateClass([
|
|
312
319
|
property({ type: Boolean })
|
|
313
320
|
], ObcCompass.prototype, "tickmarksInside", 2);
|
|
314
|
-
__decorateClass([
|
|
315
|
-
query("#rot")
|
|
316
|
-
], ObcCompass.prototype, "rot", 2);
|
|
317
321
|
ObcCompass = __decorateClass([
|
|
318
322
|
customElement("obc-compass")
|
|
319
323
|
], ObcCompass);
|
|
320
324
|
export {
|
|
321
325
|
CompassDirection,
|
|
322
326
|
CompassPriorityElement,
|
|
323
|
-
ObcCompass
|
|
327
|
+
ObcCompass,
|
|
328
|
+
RotType
|
|
324
329
|
};
|
|
325
330
|
//# sourceMappingURL=compass.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compass.js","sources":["../../../src/navigation-instruments/compass/compass.ts"],"sourcesContent":["import {LitElement, PropertyValues, css, html} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport '../watch/watch.js';\nimport {Tickmark, TickmarkType} from '../watch/tickmark.js';\nimport {arrow, ArrowStyle} from './arrow.js';\nimport {AdviceState, AngleAdvice, AngleAdviceRaw} from '../watch/advice.js';\nimport {ResizeController} from '@lit-labs/observers/resize-controller.js';\nimport {VesselImage, VesselImageSize, WatchCircleType} from '../watch/watch.js';\nimport {SetpointBundle} from '../../svghelpers/setpoint-bundle.js';\nimport {rot} from './rot.js';\nimport {RateOfTurnController} from '../rate-of-turn/rate-of-turn.controller.js';\nimport {customElement} from '../../decorator.js';\nimport {InstrumentState, Priority} from '../types.js';\n\nexport enum CompassDirection {\n NorthUp = 'northUp',\n HeadingUp = 'headingUp',\n CourseUp = 'courseUp',\n}\n\nexport enum CompassPriorityElement {\n hdg = 'hdg',\n cog = 'cog',\n rot = 'rot',\n wind = 'wind',\n current = 'current',\n}\n\n/**\n * `<obc-compass>` – Full-featured compass with HDG/COG arrows, rate-of-turn indicator, and environmental overlays.\n *\n * Renders a circular compass instrument that displays heading (HDG) and\n * course-over-ground (COG) as rotating arrows over a triple-ring watch face.\n * It supports wind and current indicators, a vessel silhouette, heading\n * setpoint with auto at-setpoint detection, advice zones, and a rate-of-turn\n * (ROT) dot indicator. The compass can be oriented north-up, heading-up, or\n * course-up.\n *\n * ## Features\n *\n * - **Direction modes**: `northUp` (default), `headingUp`, or `courseUp`\n * via the `direction` property.\n * - **HDG / COG arrows**: Two styled arrows overlay the watch face,\n * rotating independently.\n * - **Heading setpoint**: Optional setpoint marker with auto at-setpoint\n * detection via `headingSetpoint`, `atHeadingSetpoint`, and deadband\n * tuning properties.\n * - **Advice zones**: Pass `headingAdvices` to render caution/alert arcs;\n * triggered state is derived from whether the current heading falls\n * inside the advice range.\n * - **Rate of turn**: Animated ROT dot driven by `rotationsPerMinute`.\n * - **Environmental overlays**: Wind speed/direction and current\n * speed/direction indicators on the watch face.\n * - **Vessel image**: Configurable vessel silhouette centered on the\n * compass, rotating with heading.\n * - **Color priority**: Set `priority` to `Priority.enhanced` to use the\n * blue/enhanced color palette instead of the default gray/regular palette\n * (default: `Priority.regular`).\n *\n * ## Usage Guidelines\n *\n * - Set `heading` and `courseOverGround` to the current sensor values\n * in degrees.\n * - Use `direction` to control the compass orientation mode.\n * - Use `headingSetpoint` to show a target heading marker.\n * - Pass `headingAdvices` as an array of `AngleAdvice` objects for\n * caution/alert zones.\n * - Set `windSpeed` / `windFromDirection` and `currentSpeed` /\n * `currentFromDirection` to display environmental indicators.\n *\n * ## Example\n *\n * ```html\n * <obc-compass\n * heading=\"45\"\n * courseOverGround=\"50\"\n * direction=\"northUp\"\n * headingSetpoint=\"90\"\n * priority=\"regular\"\n * vesselImage=\"genericTop\"\n * ></obc-compass>\n * ```\n *\n * @property {number} heading - The current heading of the vessel in degrees.\n * @property {number} courseOverGround - The current course over ground in degrees.\n * @property {number | null} headingSetpoint - The set point for the heading in degrees.\n * @property {boolean} atHeadingSetpoint - Indicates if the vessel is at the heading set point.\n * @property {boolean} autoAtHeadingSetpoint - Enables automatic at heading set point calculation.\n * @property {number} autoAtHeadingSetpointDeadband - The deadband for the heading set point in degrees.\n * @property {boolean} touching - Indicates if the compass is being touched.\n * @property {Array<AngleAdvice>} headingAdvices - An array of angle advices for the compass.\n * @property {number | null} windSpeed - The wind speed in beaufort scale number.\n * @property {number | null} windFromDirection - The direction the wind is coming from in degrees.\n * @property {number | null} currentSpeed - The current speed, number of arrows.\n * @property {number | null} currentFromDirection - The direction the current is coming from in degrees.\n * @property {VesselImage} vesselImage - The image of the vessel.\n * @property {number} rotationsPerMinute - The number of rotations per minute for the rate of turn controller.\n * @property {Priority} priority - Color priority: `Priority.enhanced` uses the blue/enhanced color palette, `Priority.regular` (default) uses the standard palette.\n *\n * @ignition-base-height: 512px\n * @ignition-base-width: 512px\n */\n@customElement('obc-compass')\nexport class ObcCompass extends LitElement {\n @property({type: Number}) heading = 0;\n @property({type: Number}) courseOverGround = 0;\n\n @property({type: Number}) headingSetpoint: number | null = null;\n @property({type: Number}) newHeadingSetpoint: number | undefined;\n @property({type: Boolean}) atHeadingSetpoint: boolean = false;\n @property({type: Number}) headingSetpointAtZeroDeadband: number = 0.5;\n @property({type: Boolean}) headingSetpointOverride: boolean = false;\n @property({type: Boolean, attribute: false}) autoAtHeadingSetpoint: boolean =\n true;\n @property({type: Number}) autoAtHeadingSetpointDeadband: number = 2;\n @property({type: Boolean}) animateSetpoint: boolean = false;\n @property({type: Boolean}) touching: boolean = false;\n @property({type: Array, attribute: false}) headingAdvices: AngleAdvice[] = [];\n @property({type: Number}) windSpeed: number | null = null;\n @property({type: Number}) windFromDirection: number | null = null;\n @property({type: Number}) currentSpeed: number | null = null;\n @property({type: Number}) currentFromDirection: number | null = null;\n @property({type: String}) vesselImage: VesselImage = VesselImage.genericTop;\n @property({type: Number}) rotationsPerMinute: number = 1;\n @property({type: String}) direction: CompassDirection =\n CompassDirection.NorthUp;\n @property({type: String}) state: InstrumentState = InstrumentState.active;\n @property({type: String}) priority: Priority = Priority.regular;\n @property({type: Array, attribute: false})\n priorityElements: CompassPriorityElement[] = [CompassPriorityElement.hdg];\n /** Show compass NSEW labels and north arrow. */\n @property({type: Boolean}) showLabels: boolean = false;\n /** When true, labels and north arrow are placed inside the outer ring. */\n @property({type: Boolean}) tickmarksInside: boolean = false;\n\n protected override updated(_changedProperties: PropertyValues): void {\n super.updated(_changedProperties);\n if (\n _changedProperties.has('rotationsPerMinute') &&\n this.rateOfTurnController\n ) {\n this.rateOfTurnController.rotationsPerMinute = this.rotationsPerMinute;\n }\n }\n\n private _headingSp = new SetpointBundle({\n angularWraparound: true,\n onAnimationEnd: () => this.requestUpdate(),\n });\n\n override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this._headingSp.sync({\n setpoint: this.headingSetpoint ?? undefined,\n newSetpoint: this.newHeadingSetpoint,\n atSetpoint: this.atHeadingSetpoint,\n touching: this.touching,\n autoAtSetpoint: this.autoAtHeadingSetpoint,\n autoAtSetpointDeadband: this.autoAtHeadingSetpointDeadband,\n setpointAtZeroDeadband: this.headingSetpointAtZeroDeadband,\n setpointOverride: this.headingSetpointOverride,\n animateSetpoint: this.animateSetpoint,\n });\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._headingSp.dispose();\n }\n\n @query('#rot')\n private rot!: HTMLElement;\n\n private rateOfTurnController?: RateOfTurnController;\n\n override firstUpdated() {\n this.rateOfTurnController = new RateOfTurnController(\n this,\n this.rot,\n this.rotationsPerMinute\n );\n }\n\n // @ts-expect-error TS6133: The controller ensures that the render\n // function is called on resize of the element\n private _resizeController = new ResizeController(this, {});\n\n private getPadding() {\n const size = Math.min(this.clientHeight, this.clientWidth);\n const deltaWidth = 512 - size;\n const steps = deltaWidth / 128;\n let deltaPadding;\n if (deltaWidth > 0) {\n deltaPadding = steps * 48;\n } else {\n deltaPadding = steps * 6;\n }\n\n return 72 + deltaPadding;\n }\n\n private get angleAdviceRaw(): AngleAdviceRaw[] {\n return this.headingAdvices.map(({minAngle, maxAngle, hinted, type}) => {\n const state =\n this.heading >= minAngle && this.heading <= maxAngle\n ? AdviceState.triggered\n : hinted\n ? AdviceState.hinted\n : AdviceState.regular;\n return {minAngle, maxAngle, type, state};\n });\n }\n\n private priorityFor(element: CompassPriorityElement): Priority {\n const selected = Array.isArray(this.priorityElements)\n ? this.priorityElements\n : [];\n return selected.includes(element) ? this.priority : Priority.regular;\n }\n\n private colorFor(element: CompassPriorityElement): string | undefined {\n return this.priorityFor(element) === Priority.enhanced\n ? 'var(--instrument-enhanced-secondary-color)'\n : undefined;\n }\n\n private getRotation(): number | undefined {\n if (this.direction === CompassDirection.NorthUp) {\n return undefined;\n } else if (this.direction === CompassDirection.HeadingUp) {\n return -this.heading;\n } else if (this.direction === CompassDirection.CourseUp) {\n return -this.courseOverGround;\n }\n return undefined;\n }\n\n override render() {\n const tickmarks: Tickmark[] = [\n {angle: 0, type: TickmarkType.main},\n {angle: 90, type: TickmarkType.main},\n {angle: 180, type: TickmarkType.main},\n {angle: 270, type: TickmarkType.main},\n ];\n\n const padding = this.getPadding();\n const width = (176 + padding) * 2;\n const viewBox = `-${width / 2} -${width / 2} ${width} ${width}`;\n\n return html`\n <div class=\"container\">\n <obc-watch\n .touching=${this.touching}\n .padding=${padding}\n .advices=${this.angleAdviceRaw}\n .tickmarks=${tickmarks}\n .state=${this.state}\n .watchCircleType=${WatchCircleType.triple}\n .showLabels=${this.showLabels}\n .tickmarksInside=${this.tickmarksInside}\n .crosshairEnabled=${true}\n .northArrow=${true}\n .angleSetpoint=${this.headingSetpoint ?? undefined}\n .newAngleSetpoint=${this.newHeadingSetpoint}\n .atAngleSetpoint=${this._headingSp.computeAtSetpoint(this.heading)}\n .angleSetpointAtZeroDeadband=${this.headingSetpointAtZeroDeadband}\n .setpointOverride=${this.headingSetpointOverride}\n .priority=${this.priority}\n .animateSetpoint=${this.animateSetpoint}\n .vessels=${[\n {\n size: VesselImageSize.medium,\n vesselImage: this.vesselImage,\n transform: `rotate(${this.heading}deg)`,\n },\n ]}\n .wind=${this.windSpeed}\n .windFromDirectionDeg=${this.windFromDirection}\n .windColor=${this.colorFor(CompassPriorityElement.wind)}\n .current=${this.currentSpeed}\n .currentFromDirectionDeg=${this.currentFromDirection}\n .currentColor=${this.colorFor(CompassPriorityElement.current)}\n .rotation=${this.getRotation()}\n >\n </obc-watch>\n <svg viewBox=\"${viewBox}\">\n ${arrow(\n ArrowStyle.HDG,\n this.heading + (this.getRotation() ?? 0),\n this.priorityFor(CompassPriorityElement.hdg)\n )}\n ${arrow(\n ArrowStyle.COG,\n this.courseOverGround + (this.getRotation() ?? 0),\n this.priorityFor(CompassPriorityElement.cog)\n )}\n <g id=\"rot\">${rot(this.colorFor(CompassPriorityElement.rot))}</g>\n </svg>\n </div>\n `;\n }\n\n static override styles = css`\n * {\n box-sizing: border-box;\n }\n\n .container {\n position: relative;\n width: 100%;\n height: 100%;\n }\n\n .container > * {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n }\n\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n `;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-compass': ObcCompass;\n }\n}\n"],"names":["CompassDirection","CompassPriorityElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAcO,IAAK,qCAAAA,sBAAL;AACLA,oBAAA,SAAA,IAAU;AACVA,oBAAA,WAAA,IAAY;AACZA,oBAAA,UAAA,IAAW;AAHD,SAAAA;AAAA,GAAA,oBAAA,CAAA,CAAA;AAML,IAAK,2CAAAC,4BAAL;AACLA,0BAAA,KAAA,IAAM;AACNA,0BAAA,KAAA,IAAM;AACNA,0BAAA,KAAA,IAAM;AACNA,0BAAA,MAAA,IAAO;AACPA,0BAAA,SAAA,IAAU;AALA,SAAAA;AAAA,GAAA,0BAAA,CAAA,CAAA;AAmFL,IAAM,aAAN,cAAyB,WAAW;AAAA,EAApC,cAAA;AAAA,UAAA,GAAA,SAAA;AACqB,SAAA,UAAU;AACV,SAAA,mBAAmB;AAEnB,SAAA,kBAAiC;AAEhC,SAAA,oBAA6B;AAC9B,SAAA,gCAAwC;AACvC,SAAA,0BAAmC;AACjB,SAAA,wBAC3C;AACwB,SAAA,gCAAwC;AACvC,SAAA,kBAA2B;AAC3B,SAAA,WAAoB;AACJ,SAAA,iBAAgC,CAAA;AACjD,SAAA,YAA2B;AAC3B,SAAA,oBAAmC;AACnC,SAAA,eAA8B;AAC9B,SAAA,uBAAsC;AACtC,SAAA,cAA2B,YAAY;AACvC,SAAA,qBAA6B;AAC7B,SAAA,YACxB;AACwB,SAAA,QAAyB,gBAAgB;AACzC,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EG,aAAN,gBAAA;AAAA,EADN,cAAc,aAAa;AAAA,GACf,UAAA;"}
|
|
1
|
+
{"version":3,"file":"compass.js","sources":["../../../src/navigation-instruments/compass/compass.ts"],"sourcesContent":["import {LitElement, PropertyValues, css, html} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport '../watch/watch.js';\nimport {Tickmark, TickmarkType} from '../watch/tickmark.js';\nimport {arrow, ArrowStyle} from './arrow.js';\nimport {AdviceState, AngleAdvice, AngleAdviceRaw} from '../watch/advice.js';\nimport {ResizeController} from '@lit-labs/observers/resize-controller.js';\nimport {\n VesselImage,\n VesselImageSize,\n WatchCircleType,\n RotType,\n RotPosition,\n} from '../watch/watch.js';\nimport {SetpointBundle} from '../../svghelpers/setpoint-bundle.js';\nimport {customElement} from '../../decorator.js';\nimport {InstrumentState, Priority} from '../types.js';\nexport {RotType};\n\nexport enum CompassDirection {\n NorthUp = 'northUp',\n HeadingUp = 'headingUp',\n CourseUp = 'courseUp',\n}\n\nexport enum CompassPriorityElement {\n hdg = 'hdg',\n cog = 'cog',\n rot = 'rot',\n wind = 'wind',\n current = 'current',\n}\n\n/**\n * `<obc-compass>` – Full-featured compass with HDG/COG arrows, rate-of-turn indicator, and environmental overlays.\n *\n * Renders a circular compass instrument that displays heading (HDG) and\n * course-over-ground (COG) as rotating arrows over a triple-ring watch face.\n * It supports wind and current indicators, a vessel silhouette, heading\n * setpoint with auto at-setpoint detection, advice zones, and a rate-of-turn\n * (ROT) dot indicator. The compass can be oriented north-up, heading-up, or\n * course-up.\n *\n * ## Features\n *\n * - **Direction modes**: `northUp` (default), `headingUp`, or `courseUp`\n * via the `direction` property.\n * - **HDG / COG arrows**: Two styled arrows overlay the watch face,\n * rotating independently.\n * - **Heading setpoint**: Optional setpoint marker with auto at-setpoint\n * detection via `headingSetpoint`, `atHeadingSetpoint`, and deadband\n * tuning properties.\n * - **Advice zones**: Pass `headingAdvices` to render caution/alert arcs;\n * triggered state is derived from whether the current heading falls\n * inside the advice range.\n * - **Rate of turn**: Animated ROT indicator driven by `rotationsPerMinute`.\n * Supports spinning dots (`rotType=\"dots\"`) and a banana-shaped arc bar\n * (`rotType=\"bar\"`) showing the HDG→COG span. Position on the outer\n * scale ring or inner circle via `rotPosition`.\n * - **Environmental overlays**: Wind speed/direction and current\n * speed/direction indicators on the watch face.\n * - **Vessel image**: Configurable vessel silhouette centered on the\n * compass, rotating with heading.\n * - **Color priority**: Set `priority` to `Priority.enhanced` to use the\n * blue/enhanced color palette instead of the default gray/regular palette\n * (default: `Priority.regular`).\n *\n * ## Usage Guidelines\n *\n * - Set `heading` and `courseOverGround` to the current sensor values\n * in degrees.\n * - Use `direction` to control the compass orientation mode.\n * - Use `headingSetpoint` to show a target heading marker.\n * - Pass `headingAdvices` as an array of `AngleAdvice` objects for\n * caution/alert zones.\n * - Set `windSpeed` / `windFromDirection` and `currentSpeed` /\n * `currentFromDirection` to display environmental indicators.\n *\n * ## Example\n *\n * ```html\n * <obc-compass\n * heading=\"45\"\n * courseOverGround=\"50\"\n * direction=\"northUp\"\n * headingSetpoint=\"90\"\n * priority=\"regular\"\n * vesselImage=\"genericTop\"\n * ></obc-compass>\n * ```\n *\n * @property {number} heading - The current heading of the vessel in degrees.\n * @property {number} courseOverGround - The current course over ground in degrees.\n * @property {number | null} headingSetpoint - The set point for the heading in degrees.\n * @property {boolean} atHeadingSetpoint - Indicates if the vessel is at the heading set point.\n * @property {boolean} autoAtHeadingSetpoint - Enables automatic at heading set point calculation.\n * @property {number} autoAtHeadingSetpointDeadband - The deadband for the heading set point in degrees.\n * @property {boolean} touching - Indicates if the compass is being touched.\n * @property {Array<AngleAdvice>} headingAdvices - An array of angle advices for the compass.\n * @property {number | null} windSpeed - The wind speed in beaufort scale number.\n * @property {number | null} windFromDirection - The direction the wind is coming from in degrees.\n * @property {number | null} currentSpeed - The current speed, number of arrows.\n * @property {number | null} currentFromDirection - The direction the current is coming from in degrees.\n * @property {VesselImage} vesselImage - The image of the vessel.\n * @property {number} rotationsPerMinute - The number of rotations per minute for the rate of turn controller.\n * @property {RotType} rotType - ROT display mode: `'dots'` (spinning dots, default) or `'bar'` (arc bar from HDG to COG).\n * @property {RotPosition} rotPosition - ROT track position: `'innerCircle'` (default) or `'scale'` (on the outer ring).\n * @property {Priority} priority - Color priority: `Priority.enhanced` uses the blue/enhanced color palette, `Priority.regular` (default) uses the standard palette.\n *\n * @ignition-base-height: 512px\n * @ignition-base-width: 512px\n */\n@customElement('obc-compass')\nexport class ObcCompass extends LitElement {\n @property({type: Number}) heading = 0;\n @property({type: Number}) courseOverGround = 0;\n\n @property({type: Number}) headingSetpoint: number | null = null;\n @property({type: Number}) newHeadingSetpoint: number | undefined;\n @property({type: Boolean}) atHeadingSetpoint: boolean = false;\n @property({type: Number}) headingSetpointAtZeroDeadband: number = 0.5;\n @property({type: Boolean}) headingSetpointOverride: boolean = false;\n @property({type: Boolean, attribute: false}) autoAtHeadingSetpoint: boolean =\n true;\n @property({type: Number}) autoAtHeadingSetpointDeadband: number = 2;\n @property({type: Boolean}) animateSetpoint: boolean = false;\n @property({type: Boolean}) touching: boolean = false;\n @property({type: Array, attribute: false}) headingAdvices: AngleAdvice[] = [];\n @property({type: Number}) windSpeed: number | null = null;\n @property({type: Number}) windFromDirection: number | null = null;\n @property({type: Number}) currentSpeed: number | null = null;\n @property({type: Number}) currentFromDirection: number | null = null;\n @property({type: String}) vesselImage: VesselImage = VesselImage.genericTop;\n @property({type: Number}) rotationsPerMinute: number = 1;\n @property({type: String}) rotType: RotType = RotType.dots;\n @property({type: String}) rotPosition: RotPosition = RotPosition.innerCircle;\n @property({type: Number}) rotMaxValue: number = 10;\n @property({type: Number}) rotArcExtent: number = 60;\n @property({type: String}) direction: CompassDirection =\n CompassDirection.NorthUp;\n @property({type: String}) state: InstrumentState = InstrumentState.active;\n @property({type: String}) priority: Priority = Priority.regular;\n @property({type: Array, attribute: false})\n priorityElements: CompassPriorityElement[] = [CompassPriorityElement.hdg];\n /** Show compass NSEW labels and north arrow. */\n @property({type: Boolean}) showLabels: boolean = false;\n /** When true, labels and north arrow are placed inside the outer ring. */\n @property({type: Boolean}) tickmarksInside: boolean = false;\n\n private _headingSp = new SetpointBundle({\n angularWraparound: true,\n onAnimationEnd: () => this.requestUpdate(),\n });\n\n override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this._headingSp.sync({\n setpoint: this.headingSetpoint ?? undefined,\n newSetpoint: this.newHeadingSetpoint,\n atSetpoint: this.atHeadingSetpoint,\n touching: this.touching,\n autoAtSetpoint: this.autoAtHeadingSetpoint,\n autoAtSetpointDeadband: this.autoAtHeadingSetpointDeadband,\n setpointAtZeroDeadband: this.headingSetpointAtZeroDeadband,\n setpointOverride: this.headingSetpointOverride,\n animateSetpoint: this.animateSetpoint,\n });\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._headingSp.dispose();\n }\n\n // @ts-expect-error TS6133: The controller ensures that the render\n // function is called on resize of the element\n private _resizeController = new ResizeController(this, {});\n\n private getPadding() {\n const size = Math.min(this.clientHeight, this.clientWidth);\n const deltaWidth = 512 - size;\n const steps = deltaWidth / 128;\n let deltaPadding;\n if (deltaWidth > 0) {\n deltaPadding = steps * 48;\n } else {\n deltaPadding = steps * 6;\n }\n\n return 72 + deltaPadding;\n }\n\n private get angleAdviceRaw(): AngleAdviceRaw[] {\n return this.headingAdvices.map(({minAngle, maxAngle, hinted, type}) => {\n const state =\n this.heading >= minAngle && this.heading <= maxAngle\n ? AdviceState.triggered\n : hinted\n ? AdviceState.hinted\n : AdviceState.regular;\n return {minAngle, maxAngle, type, state};\n });\n }\n\n private priorityFor(element: CompassPriorityElement): Priority {\n const selected = Array.isArray(this.priorityElements)\n ? this.priorityElements\n : [];\n return selected.includes(element) ? this.priority : Priority.regular;\n }\n\n private colorFor(element: CompassPriorityElement): string | undefined {\n return this.priorityFor(element) === Priority.enhanced\n ? 'var(--instrument-enhanced-secondary-color)'\n : undefined;\n }\n\n private getRotation(): number | undefined {\n if (this.direction === CompassDirection.NorthUp) {\n return undefined;\n } else if (this.direction === CompassDirection.HeadingUp) {\n return -this.heading;\n } else if (this.direction === CompassDirection.CourseUp) {\n return -this.courseOverGround;\n }\n return undefined;\n }\n\n override render() {\n const tickmarks: Tickmark[] = [\n {angle: 0, type: TickmarkType.main},\n {angle: 90, type: TickmarkType.main},\n {angle: 180, type: TickmarkType.main},\n {angle: 270, type: TickmarkType.main},\n ];\n\n const padding = this.getPadding();\n const width = (176 + padding) * 2;\n const viewBox = `-${width / 2} -${width / 2} ${width} ${width}`;\n\n return html`\n <div class=\"container\">\n <obc-watch\n .touching=${this.touching}\n .padding=${padding}\n .advices=${this.angleAdviceRaw}\n .tickmarks=${tickmarks}\n .state=${this.state}\n .watchCircleType=${WatchCircleType.triple}\n .showLabels=${this.showLabels}\n .tickmarksInside=${this.tickmarksInside}\n .crosshairEnabled=${true}\n .northArrow=${true}\n .angleSetpoint=${this.headingSetpoint ?? undefined}\n .newAngleSetpoint=${this.newHeadingSetpoint}\n .atAngleSetpoint=${this._headingSp.computeAtSetpoint(this.heading)}\n .angleSetpointAtZeroDeadband=${this.headingSetpointAtZeroDeadband}\n .setpointOverride=${this.headingSetpointOverride}\n .priority=${this.priority}\n .animateSetpoint=${this.animateSetpoint}\n .vessels=${[\n {\n size: VesselImageSize.medium,\n vesselImage: this.vesselImage,\n transform: `rotate(${this.heading}deg)`,\n },\n ]}\n .wind=${this.windSpeed}\n .windFromDirectionDeg=${this.windFromDirection}\n .windColor=${this.colorFor(CompassPriorityElement.wind)}\n .current=${this.currentSpeed}\n .currentFromDirectionDeg=${this.currentFromDirection}\n .currentColor=${this.colorFor(CompassPriorityElement.current)}\n .rotation=${this.getRotation()}\n .rotType=${this.rotType}\n .rotPosition=${this.rotPosition}\n .rotStartAngle=${this.heading + (this.getRotation() ?? 0)}\n .rotEndAngle=${this.heading +\n (this.rotationsPerMinute / (this.rotMaxValue || 1)) *\n this.rotArcExtent +\n (this.getRotation() ?? 0)}\n .rotPriority=${this.priorityFor(CompassPriorityElement.rot)}\n .rotationsPerMinute=${this.rotationsPerMinute}\n >\n </obc-watch>\n <svg viewBox=\"${viewBox}\">\n ${arrow(\n ArrowStyle.HDG,\n this.heading + (this.getRotation() ?? 0),\n this.priorityFor(CompassPriorityElement.hdg)\n )}\n ${arrow(\n ArrowStyle.COG,\n this.courseOverGround + (this.getRotation() ?? 0),\n this.priorityFor(CompassPriorityElement.cog)\n )}\n </svg>\n </div>\n `;\n }\n\n static override styles = css`\n * {\n box-sizing: border-box;\n }\n\n .container {\n position: relative;\n width: 100%;\n height: 100%;\n }\n\n .container > * {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n }\n\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n `;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-compass': ObcCompass;\n }\n}\n"],"names":["CompassDirection","CompassPriorityElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmBO,IAAK,qCAAAA,sBAAL;AACLA,oBAAA,SAAA,IAAU;AACVA,oBAAA,WAAA,IAAY;AACZA,oBAAA,UAAA,IAAW;AAHD,SAAAA;AAAA,GAAA,oBAAA,CAAA,CAAA;AAML,IAAK,2CAAAC,4BAAL;AACLA,0BAAA,KAAA,IAAM;AACNA,0BAAA,KAAA,IAAM;AACNA,0BAAA,KAAA,IAAM;AACNA,0BAAA,MAAA,IAAO;AACPA,0BAAA,SAAA,IAAU;AALA,SAAAA;AAAA,GAAA,0BAAA,CAAA,CAAA;AAwFL,IAAM,aAAN,cAAyB,WAAW;AAAA,EAApC,cAAA;AAAA,UAAA,GAAA,SAAA;AACqB,SAAA,UAAU;AACV,SAAA,mBAAmB;AAEnB,SAAA,kBAAiC;AAEhC,SAAA,oBAA6B;AAC9B,SAAA,gCAAwC;AACvC,SAAA,0BAAmC;AACjB,SAAA,wBAC3C;AACwB,SAAA,gCAAwC;AACvC,SAAA,kBAA2B;AAC3B,SAAA,WAAoB;AACJ,S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