@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.55 → 2.0.0-next.57
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/bundle/openbridge-webcomponents.bundle.js +395 -123
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +326 -2
- package/dist/automation/automation-tank/automation-tank.d.ts +11 -0
- package/dist/automation/automation-tank/automation-tank.d.ts.map +1 -1
- package/dist/automation/automation-tank/automation-tank.js.map +1 -1
- package/dist/navigation-instruments/compass-sector/compass-sector.css.js +12 -0
- package/dist/navigation-instruments/compass-sector/compass-sector.css.js.map +1 -1
- package/dist/navigation-instruments/compass-sector/compass-sector.d.ts +23 -0
- package/dist/navigation-instruments/compass-sector/compass-sector.d.ts.map +1 -1
- package/dist/navigation-instruments/compass-sector/compass-sector.js +47 -0
- package/dist/navigation-instruments/compass-sector/compass-sector.js.map +1 -1
- package/dist/navigation-instruments/pitch/pitch.d.ts +37 -0
- package/dist/navigation-instruments/pitch/pitch.d.ts.map +1 -1
- package/dist/navigation-instruments/pitch/pitch.js +130 -62
- package/dist/navigation-instruments/pitch/pitch.js.map +1 -1
- package/dist/navigation-instruments/pitch-roll/pitch-roll.d.ts +7 -0
- package/dist/navigation-instruments/pitch-roll/pitch-roll.d.ts.map +1 -1
- package/dist/navigation-instruments/pitch-roll/pitch-roll.js +58 -2
- package/dist/navigation-instruments/pitch-roll/pitch-roll.js.map +1 -1
- package/dist/navigation-instruments/roll/roll.d.ts +37 -0
- package/dist/navigation-instruments/roll/roll.d.ts.map +1 -1
- package/dist/navigation-instruments/roll/roll.js +119 -63
- package/dist/navigation-instruments/roll/roll.js.map +1 -1
- package/dist/navigation-instruments/rot-sector/rot-sector.d.ts +15 -0
- package/dist/navigation-instruments/rot-sector/rot-sector.d.ts.map +1 -1
- package/dist/navigation-instruments/rot-sector/rot-sector.js +53 -1
- package/dist/navigation-instruments/rot-sector/rot-sector.js.map +1 -1
- package/package.json +1 -1
- package/src/automation/automation-tank/automation-tank.ts +11 -0
- package/src/navigation-instruments/compass-sector/compass-sector.css +12 -0
- package/src/navigation-instruments/compass-sector/compass-sector.stories.ts +7 -0
- package/src/navigation-instruments/compass-sector/compass-sector.ts +52 -0
- package/src/navigation-instruments/pitch/pitch.stories.ts +23 -1
- package/src/navigation-instruments/pitch/pitch.ts +184 -86
- package/src/navigation-instruments/pitch-roll/pitch-roll.stories.ts +13 -0
- package/src/navigation-instruments/pitch-roll/pitch-roll.ts +80 -13
- package/src/navigation-instruments/roll/roll.stories.ts +23 -1
- package/src/navigation-instruments/roll/roll.ts +171 -87
- package/src/navigation-instruments/rot-sector/rot-sector.stories.ts +15 -0
- package/src/navigation-instruments/rot-sector/rot-sector.ts +59 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { LitElement, html } from "lit";
|
|
1
|
+
import { LitElement, nothing, html, css } from "lit";
|
|
2
2
|
import { customElement } from "../../decorator.js";
|
|
3
3
|
import { property } from "lit/decorators.js";
|
|
4
4
|
import { Priority } from "../types.js";
|
|
5
5
|
import { SetpointMixin } from "../../svghelpers/setpoint-mixin.js";
|
|
6
6
|
import "../../building-blocks/instrument-radial/instrument-radial.js";
|
|
7
|
+
import { ReadoutVariant, ReadoutDirection } from "../readout/readout.js";
|
|
7
8
|
import { TickmarkStyle } from "../watch/tickmark.js";
|
|
8
9
|
var __defProp = Object.defineProperty;
|
|
9
10
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -37,6 +38,7 @@ let ObcRotSector = class extends SetpointMixin(LitElement) {
|
|
|
37
38
|
this.advices = [];
|
|
38
39
|
this.zoomToFitArc = false;
|
|
39
40
|
this.rotArcExtent = 60;
|
|
41
|
+
this.hasReadout = false;
|
|
40
42
|
this.getAngle = (v) => {
|
|
41
43
|
if (!this.maxValue) return 0;
|
|
42
44
|
return v / this.maxValue * this.rotArcExtent;
|
|
@@ -71,6 +73,22 @@ let ObcRotSector = class extends SetpointMixin(LitElement) {
|
|
|
71
73
|
}
|
|
72
74
|
return "var(--instrument-enhanced-tertiary-color)";
|
|
73
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Vertical position of the readout, in % of the host. In the zoomed view the
|
|
78
|
+
* arc's lower edge shifts with `rotArcExtent`, so the position is interpolated
|
|
79
|
+
* between the narrow- and wide-arc anchors to keep a roughly constant gap
|
|
80
|
+
* between the arc and the readout. The static (unzoomed) arc uses a fixed
|
|
81
|
+
* position.
|
|
82
|
+
*/
|
|
83
|
+
get _readoutTopPercent() {
|
|
84
|
+
if (!this.zoomToFitArc) {
|
|
85
|
+
return 60;
|
|
86
|
+
}
|
|
87
|
+
const narrowTop = 70;
|
|
88
|
+
const wideTop = 66;
|
|
89
|
+
const extent = Math.min(60, Math.max(10, this.rotArcExtent));
|
|
90
|
+
return narrowTop + (wideTop - narrowTop) * (extent - 10) / (60 - 10);
|
|
91
|
+
}
|
|
74
92
|
render() {
|
|
75
93
|
const barColor = this._barColor;
|
|
76
94
|
return html`
|
|
@@ -101,6 +119,19 @@ let ObcRotSector = class extends SetpointMixin(LitElement) {
|
|
|
101
119
|
.zoomToFitArc=${this.zoomToFitArc}
|
|
102
120
|
>
|
|
103
121
|
</obc-instrument-radial>
|
|
122
|
+
${this.hasReadout ? html`<div class="readout" style="top: ${this._readoutTopPercent}%">
|
|
123
|
+
<obc-readout
|
|
124
|
+
.variant=${ReadoutVariant.enhanced}
|
|
125
|
+
.direction=${ReadoutDirection.vertical}
|
|
126
|
+
.hasSetpoint=${false}
|
|
127
|
+
.hasAdvice=${false}
|
|
128
|
+
.value=${this.value}
|
|
129
|
+
.fractionDigits=${0}
|
|
130
|
+
.valuePriority=${this.priority}
|
|
131
|
+
label="ROT"
|
|
132
|
+
unit="DEG/min"
|
|
133
|
+
></obc-readout>
|
|
134
|
+
</div>` : nothing}
|
|
104
135
|
`;
|
|
105
136
|
}
|
|
106
137
|
get _needleColor() {
|
|
@@ -119,6 +150,24 @@ let ObcRotSector = class extends SetpointMixin(LitElement) {
|
|
|
119
150
|
return "var(--instrument-enhanced-secondary-color)";
|
|
120
151
|
}
|
|
121
152
|
};
|
|
153
|
+
ObcRotSector.styles = css`
|
|
154
|
+
:host {
|
|
155
|
+
position: relative;
|
|
156
|
+
display: block;
|
|
157
|
+
height: 100%;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.readout {
|
|
161
|
+
position: absolute;
|
|
162
|
+
left: 50%;
|
|
163
|
+
transform: translate(-50%, -50%);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* Center the value over the label/unit row instead of right-aligning it. */
|
|
167
|
+
obc-readout::part(value-wrapper) {
|
|
168
|
+
justify-self: center;
|
|
169
|
+
}
|
|
170
|
+
`;
|
|
122
171
|
__decorateClass([
|
|
123
172
|
property({ type: Number })
|
|
124
173
|
], ObcRotSector.prototype, "value", 2);
|
|
@@ -164,6 +213,9 @@ __decorateClass([
|
|
|
164
213
|
__decorateClass([
|
|
165
214
|
property({ type: Number })
|
|
166
215
|
], ObcRotSector.prototype, "rotArcExtent", 2);
|
|
216
|
+
__decorateClass([
|
|
217
|
+
property({ type: Boolean })
|
|
218
|
+
], ObcRotSector.prototype, "hasReadout", 2);
|
|
167
219
|
ObcRotSector = __decorateClass([
|
|
168
220
|
customElement("obc-rot-sector")
|
|
169
221
|
], ObcRotSector);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rot-sector.js","sources":["../../../src/navigation-instruments/rot-sector/rot-sector.ts"],"sourcesContent":["import {LitElement, html} from 'lit';\nimport {customElement} from '../../decorator.js';\nimport {property} from 'lit/decorators.js';\nimport {AdviceType} from '../watch/advice.js';\nimport {Priority} from '../types.js';\nimport {SetpointMixin} from '../../svghelpers/setpoint-mixin.js';\nimport '../../building-blocks/instrument-radial/instrument-radial.js';\nimport {TickmarkStyle} from '../watch/tickmark.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\n/**\n * `<obc-rot-sector>` — Rate-of-turn sector gauge for rotational velocity.\n *\n * `ObcRotSector` is a thin wrapper around `<obc-instrument-radial>` that\n * displays a bipolar sector gauge showing rate of turn. The arc extent is\n * configurable via `rotArcExtent` (default 60°), mapping the value range\n * (−maxValue to +maxValue) to ±rotArcExtent degrees. The bottom 50% of the\n * circle is clipped, producing a compact sector arc. When `zoomToFitArc`\n * is enabled, clipping is bypassed and the arc is enlarged to fill the\n * available space. It inherits\n * a full setpoint property bundle from {@link SetpointMixin}, including\n * auto at-setpoint detection, dual-marker adjustment preview, and deadband\n * tuning.\n *\n * ## Features\n *\n * - **Bipolar sector**: Value range is symmetric around zero (−maxValue to\n * +maxValue), mapped to a ±`rotArcExtent`° arc (default 60°).\n * - **Port/starboard coloring**: When `portStarboard` is true, positive\n * values render in starboard (green) and negative in port (red).\n * - **Bar display**: Always renders as a `bar` type — no needle or filled\n * variants.\n * - **Setpoint via mixin**: `setpoint`, `newSetpoint`, `touching`,\n * `autoAtSetpointDeadband`, `setpointOverride`, and all other setpoint\n * properties are provided by `SetpointMixin` and forwarded to the inner\n * `<obc-instrument-radial>`.\n * - **Advice zones**: Pass an array of {@link GaugeRadialAdvice} objects to\n * render caution/alert arcs on the gauge.\n *\n * ## Usage Guidelines\n *\n * - Set `maxValue` to define the symmetric ± range.\n * - Use `priority` to switch between regular and enhanced color palettes.\n * - Enable `portStarboard` to show directional coloring.\n * - Provide `primaryTickmarkInterval` and `secondaryTickmarkInterval` to\n * control tickmark density.\n * - Enable `showLabels` to show numeric labels at primary tickmarks.\n *\n * ## Best Practices\n *\n * - Prefer `SetpointMixin` properties (`setpoint`, `touching`, etc.) over\n * any legacy aliases — the mixin is the single source of truth.\n * - The sector is always bottom-clipped at 50%; do not change `clipBottom`\n * externally.\n *\n * ## Example\n *\n * ```html\n * <obc-rot-sector\n * value=\"15\"\n * maxValue=\"60\"\n * enhanced\n * portStarboard\n * showLabels\n * primaryTickmarkInterval=\"20\"\n * secondaryTickmarkInterval=\"10\"\n * setpoint=\"30\"\n * ></obc-rot-sector>\n * ```\n *\n * @element obc-rot-sector\n * @typedef {import('./rot-sector.js').GaugeRadialAdvice} GaugeRadialAdvice\n */\n@customElement('obc-rot-sector')\nexport class ObcRotSector extends SetpointMixin(LitElement) {\n @property({type: Number}) value = 0;\n @property({type: Number}) maxValue = 100;\n\n /**\n * Measured rate of turn in degrees per minute (positive = starboard).\n * Alias for `value` provided for cross-component consistency with\n * `obc-compass`, `obc-compass-sector`, `obc-compass-flat`, and\n * `obc-rate-of-turn`. Setting this updates `value`.\n */\n @property({type: Number})\n set rateOfTurn(v: number) {\n this.value = v;\n }\n get rateOfTurn(): number {\n return this.value;\n }\n\n /**\n * Maximum measured rate of turn in degrees per minute. Alias for\n * `maxValue` provided for cross-component consistency. Setting this\n * updates `maxValue`.\n */\n @property({type: Number})\n set rateOfTurnMax(v: number) {\n this.maxValue = v;\n }\n get rateOfTurnMax(): number {\n return this.maxValue;\n }\n @property({type: Boolean}) showLabels: boolean = false;\n /** Whether to render tickmarks inside the ring. */\n @property({type: Boolean}) tickmarksInside: 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}) priority: Priority = Priority.regular;\n @property({type: Boolean}) portStarboard: boolean = false;\n @property({type: String}) tickmarkStyle: TickmarkStyle =\n TickmarkStyle.regular;\n @property({type: Array, attribute: false}) advices: GaugeRadialAdvice[] = [];\n @property({type: Boolean}) zoomToFitArc: boolean = false;\n @property({type: Number}) rotArcExtent: number = 60;\n\n getAngle = (v: number): number => {\n if (!this.maxValue) return 0;\n return (v / this.maxValue) * this.rotArcExtent;\n };\n\n get _type(): ObcGaugeRadialType {\n return ObcGaugeRadialType.bar;\n }\n\n private get _barColor(): string {\n if (this.portStarboard) {\n if (this.value > 0) {\n return 'var(--instrument-starboard-secondary-color)';\n }\n if (this.value < 0) {\n return 'var(--instrument-port-secondary-color)';\n }\n }\n\n if (this.priority !== Priority.enhanced) {\n return 'var(--instrument-regular-tertiary-color)';\n }\n\n return 'var(--instrument-enhanced-tertiary-color)';\n }\n\n override render() {\n const barColor = this._barColor;\n\n return html`\n <obc-instrument-radial\n .value=${this.value}\n .setpoint=${this.setpoint}\n .newSetpoint=${this.newSetpoint}\n .setpointAtZeroDeadband=${this.setpointAtZeroDeadband}\n .setpointOverride=${this.setpointOverride}\n .touching=${this.touching}\n .autoAtSetpoint=${this.autoAtSetpoint}\n .autoAtSetpointDeadband=${this.autoAtSetpointDeadband}\n .maxValue=${this.maxValue}\n .minValue=${-this.maxValue}\n .getAngle=${this.getAngle}\n .needleColor=${this._needleColor}\n .barColor=${barColor}\n .showLabels=${this.showLabels}\n .tickmarksInside=${this.tickmarksInside}\n .tickmarkStyle=${this.tickmarkStyle}\n .primaryTickmarkInterval=${this.primaryTickmarkInterval}\n .secondaryTickmarkInterval=${this.secondaryTickmarkInterval}\n .tertiaryTickmarkInterval=${this.tertiaryTickmarkInterval}\n .type=${this._type}\n .needleType=${this._type}\n .advices=${this.advices}\n .clipBottom=${50}\n .zoomToFitArc=${this.zoomToFitArc}\n >\n </obc-instrument-radial>\n `;\n }\n\n private get _needleColor(): string {\n if (this.portStarboard) {\n if (this.value > 0) {\n return 'var(--instrument-starboard-primary-color)';\n }\n if (this.value < 0) {\n return 'var(--instrument-port-primary-color)';\n }\n return 'var(--instrument-regular-secondary-color)';\n }\n\n if (this.priority !== Priority.enhanced) {\n return 'var(--instrument-regular-secondary-color)';\n }\n\n return 'var(--instrument-enhanced-secondary-color)';\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-rot-sector': ObcRotSector;\n }\n}\n"],"names":["ObcGaugeRadialType"],"mappings":";;;;;;;;;;;;;;;;;AASO,IAAK,uCAAAA,wBAAL;AACLA,sBAAA,QAAA,IAAS;AACTA,sBAAA,KAAA,IAAM;AACNA,sBAAA,QAAA,IAAS;AAHC,SAAAA;AAAA,GAAA,sBAAA,CAAA,CAAA;AA6EL,IAAM,eAAN,cAA2B,cAAc,UAAU,EAAE;AAAA,EAArD,cAAA;AAAA,UAAA,GAAA,SAAA;AACqB,SAAA,QAAQ;AACR,SAAA,WAAW;AA4BV,SAAA,aAAsB;AAEtB,SAAA,kBAA2B;AAK5B,SAAA,0BAA8C;AAK9C,SAAA,4BAAgD;AAKhD,SAAA,2BACxB;AACwB,SAAA,WAAqB,SAAS;AAC7B,SAAA,gBAAyB;AAC1B,SAAA,gBACxB,cAAc;AAC2B,SAAA,UAA+B,CAAA;AAC/C,SAAA,eAAwB;AACzB,SAAA,eAAuB;AAEjD,SAAA,WAAW,CAAC,MAAsB;AAChC,UAAI,CAAC,KAAK,SAAU,QAAO;AAC3B,aAAQ,IAAI,KAAK,WAAY,KAAK;AAAA,IACpC;AAAA,EAAA;AAAA,EAjDA,IAAI,WAAW,GAAW;AACxB,SAAK,QAAQ;AAAA,EACf;AAAA,EACA,IAAI,aAAqB;AACvB,WAAO,KAAK;AAAA,EACd;AAAA,EAQA,IAAI,cAAc,GAAW;AAC3B,SAAK,WAAW;AAAA,EAClB;AAAA,EACA,IAAI,gBAAwB;AAC1B,WAAO,KAAK;AAAA,EACd;AAAA,EAiCA,IAAI,QAA4B;AAC9B,WAAO;AAAA,EACT;AAAA,EAEA,IAAY,YAAoB;AAC9B,QAAI,KAAK,eAAe;AACtB,UAAI,KAAK,QAAQ,GAAG;AAClB,eAAO;AAAA,MACT;AACA,UAAI,K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EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAvDb,aAuDe,WAAA,gBAAA,CAAA;AAvDf,eAAN,gBAAA;AAAA,EADN,cAAc,gBAAgB;AAAA,GAClB,YAAA;"}
|
|
1
|
+
{"version":3,"file":"rot-sector.js","sources":["../../../src/navigation-instruments/rot-sector/rot-sector.ts"],"sourcesContent":["import {LitElement, html, css, nothing} from 'lit';\nimport {customElement} from '../../decorator.js';\nimport {property} from 'lit/decorators.js';\nimport {AdviceType} from '../watch/advice.js';\nimport {Priority} from '../types.js';\nimport {SetpointMixin} from '../../svghelpers/setpoint-mixin.js';\nimport '../../building-blocks/instrument-radial/instrument-radial.js';\nimport '../readout/readout.js';\nimport {ReadoutDirection, ReadoutVariant} from '../readout/readout.js';\nimport {TickmarkStyle} from '../watch/tickmark.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\n/**\n * `<obc-rot-sector>` — Rate-of-turn sector gauge for rotational velocity.\n *\n * `ObcRotSector` is a thin wrapper around `<obc-instrument-radial>` that\n * displays a bipolar sector gauge showing rate of turn. The arc extent is\n * configurable via `rotArcExtent` (default 60°), mapping the value range\n * (−maxValue to +maxValue) to ±rotArcExtent degrees. The bottom 50% of the\n * circle is clipped, producing a compact sector arc. When `zoomToFitArc`\n * is enabled, clipping is bypassed and the arc is enlarged to fill the\n * available space. It inherits\n * a full setpoint property bundle from {@link SetpointMixin}, including\n * auto at-setpoint detection, dual-marker adjustment preview, and deadband\n * tuning.\n *\n * ## Features\n *\n * - **Bipolar sector**: Value range is symmetric around zero (−maxValue to\n * +maxValue), mapped to a ±`rotArcExtent`° arc (default 60°).\n * - **Port/starboard coloring**: When `portStarboard` is true, positive\n * values render in starboard (green) and negative in port (red).\n * - **Bar display**: Always renders as a `bar` type — no needle or filled\n * variants.\n * - **Setpoint via mixin**: `setpoint`, `newSetpoint`, `touching`,\n * `autoAtSetpointDeadband`, `setpointOverride`, and all other setpoint\n * properties are provided by `SetpointMixin` and forwarded to the inner\n * `<obc-instrument-radial>`.\n * - **Advice zones**: Pass an array of {@link GaugeRadialAdvice} objects to\n * render caution/alert arcs on the gauge.\n *\n * ## Usage Guidelines\n *\n * - Set `maxValue` to define the symmetric ± range.\n * - Use `priority` to switch between regular and enhanced color palettes.\n * - Enable `portStarboard` to show directional coloring.\n * - Provide `primaryTickmarkInterval` and `secondaryTickmarkInterval` to\n * control tickmark density.\n * - Enable `showLabels` to show numeric labels at primary tickmarks.\n *\n * ## Best Practices\n *\n * - Prefer `SetpointMixin` properties (`setpoint`, `touching`, etc.) over\n * any legacy aliases — the mixin is the single source of truth.\n * - The sector is always bottom-clipped at 50%; do not change `clipBottom`\n * externally.\n *\n * ## Example\n *\n * ```html\n * <obc-rot-sector\n * value=\"15\"\n * maxValue=\"60\"\n * enhanced\n * portStarboard\n * showLabels\n * primaryTickmarkInterval=\"20\"\n * secondaryTickmarkInterval=\"10\"\n * setpoint=\"30\"\n * ></obc-rot-sector>\n * ```\n *\n * @element obc-rot-sector\n * @typedef {import('./rot-sector.js').GaugeRadialAdvice} GaugeRadialAdvice\n */\n@customElement('obc-rot-sector')\nexport class ObcRotSector extends SetpointMixin(LitElement) {\n @property({type: Number}) value = 0;\n @property({type: Number}) maxValue = 100;\n\n /**\n * Measured rate of turn in degrees per minute (positive = starboard).\n * Alias for `value` provided for cross-component consistency with\n * `obc-compass`, `obc-compass-sector`, `obc-compass-flat`, and\n * `obc-rate-of-turn`. Setting this updates `value`.\n */\n @property({type: Number})\n set rateOfTurn(v: number) {\n this.value = v;\n }\n get rateOfTurn(): number {\n return this.value;\n }\n\n /**\n * Maximum measured rate of turn in degrees per minute. Alias for\n * `maxValue` provided for cross-component consistency. Setting this\n * updates `maxValue`.\n */\n @property({type: Number})\n set rateOfTurnMax(v: number) {\n this.maxValue = v;\n }\n get rateOfTurnMax(): number {\n return this.maxValue;\n }\n @property({type: Boolean}) showLabels: boolean = false;\n /** Whether to render tickmarks inside the ring. */\n @property({type: Boolean}) tickmarksInside: 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}) priority: Priority = Priority.regular;\n @property({type: Boolean}) portStarboard: boolean = false;\n @property({type: String}) tickmarkStyle: TickmarkStyle =\n TickmarkStyle.regular;\n @property({type: Array, attribute: false}) advices: GaugeRadialAdvice[] = [];\n @property({type: Boolean}) zoomToFitArc: boolean = false;\n @property({type: Number}) rotArcExtent: number = 60;\n /**\n * When `true`, shows a centered `<obc-readout>` (label `ROT`, unit `DEG/min`)\n * under the arc with the current rate-of-turn value. Default `false`.\n */\n @property({type: Boolean}) hasReadout: boolean = false;\n\n getAngle = (v: number): number => {\n if (!this.maxValue) return 0;\n return (v / this.maxValue) * this.rotArcExtent;\n };\n\n get _type(): ObcGaugeRadialType {\n return ObcGaugeRadialType.bar;\n }\n\n private get _barColor(): string {\n if (this.portStarboard) {\n if (this.value > 0) {\n return 'var(--instrument-starboard-secondary-color)';\n }\n if (this.value < 0) {\n return 'var(--instrument-port-secondary-color)';\n }\n }\n\n if (this.priority !== Priority.enhanced) {\n return 'var(--instrument-regular-tertiary-color)';\n }\n\n return 'var(--instrument-enhanced-tertiary-color)';\n }\n\n /**\n * Vertical position of the readout, in % of the host. In the zoomed view the\n * arc's lower edge shifts with `rotArcExtent`, so the position is interpolated\n * between the narrow- and wide-arc anchors to keep a roughly constant gap\n * between the arc and the readout. The static (unzoomed) arc uses a fixed\n * position.\n */\n private get _readoutTopPercent(): number {\n if (!this.zoomToFitArc) {\n return 60;\n }\n const narrowTop = 70; // rotArcExtent ~10\n const wideTop = 66; // rotArcExtent ~60\n const extent = Math.min(60, Math.max(10, this.rotArcExtent));\n return narrowTop + ((wideTop - narrowTop) * (extent - 10)) / (60 - 10);\n }\n\n override render() {\n const barColor = this._barColor;\n\n return html`\n <obc-instrument-radial\n .value=${this.value}\n .setpoint=${this.setpoint}\n .newSetpoint=${this.newSetpoint}\n .setpointAtZeroDeadband=${this.setpointAtZeroDeadband}\n .setpointOverride=${this.setpointOverride}\n .touching=${this.touching}\n .autoAtSetpoint=${this.autoAtSetpoint}\n .autoAtSetpointDeadband=${this.autoAtSetpointDeadband}\n .maxValue=${this.maxValue}\n .minValue=${-this.maxValue}\n .getAngle=${this.getAngle}\n .needleColor=${this._needleColor}\n .barColor=${barColor}\n .showLabels=${this.showLabels}\n .tickmarksInside=${this.tickmarksInside}\n .tickmarkStyle=${this.tickmarkStyle}\n .primaryTickmarkInterval=${this.primaryTickmarkInterval}\n .secondaryTickmarkInterval=${this.secondaryTickmarkInterval}\n .tertiaryTickmarkInterval=${this.tertiaryTickmarkInterval}\n .type=${this._type}\n .needleType=${this._type}\n .advices=${this.advices}\n .clipBottom=${50}\n .zoomToFitArc=${this.zoomToFitArc}\n >\n </obc-instrument-radial>\n ${this.hasReadout\n ? html`<div class=\"readout\" style=\"top: ${this._readoutTopPercent}%\">\n <obc-readout\n .variant=${ReadoutVariant.enhanced}\n .direction=${ReadoutDirection.vertical}\n .hasSetpoint=${false}\n .hasAdvice=${false}\n .value=${this.value}\n .fractionDigits=${0}\n .valuePriority=${this.priority}\n label=\"ROT\"\n unit=\"DEG/min\"\n ></obc-readout>\n </div>`\n : nothing}\n `;\n }\n\n private get _needleColor(): string {\n if (this.portStarboard) {\n if (this.value > 0) {\n return 'var(--instrument-starboard-primary-color)';\n }\n if (this.value < 0) {\n return 'var(--instrument-port-primary-color)';\n }\n return 'var(--instrument-regular-secondary-color)';\n }\n\n if (this.priority !== Priority.enhanced) {\n return 'var(--instrument-regular-secondary-color)';\n }\n\n return 'var(--instrument-enhanced-secondary-color)';\n }\n\n static override styles = css`\n :host {\n position: relative;\n display: block;\n height: 100%;\n }\n\n .readout {\n position: absolute;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n\n /* Center the value over the label/unit row instead of right-aligning it. */\n obc-readout::part(value-wrapper) {\n justify-self: center;\n }\n `;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-rot-sector': ObcRotSector;\n }\n}\n"],"names":["ObcGaugeRadialType"],"mappings":";;;;;;;;;;;;;;;;;;AAWO,IAAK,uCAAAA,wBAAL;AACLA,sBAAA,QAAA,IAAS;AACTA,sBAAA,KAAA,IAAM;AACNA,sBAAA,QAAA,IAAS;AAHC,SAAAA;AAAA,GAAA,sBAAA,CAAA,CAAA;AA6EL,IAAM,eAAN,cAA2B,cAAc,UAAU,EAAE;AAAA,EAArD,cAAA;AAAA,UAAA,GAAA,SAAA;AACqB,SAAA,QAAQ;AACR,SAAA,WAAW;AA4BV,SAAA,aAAsB;AAEtB,SAAA,kBAA2B;AAK5B,SAAA,0BAA8C;AAK9C,SAAA,4BAAgD;AAKhD,SAAA,2BACxB;AACwB,SAAA,WAAqB,SAAS;AAC7B,SAAA,gBAAyB;AAC1B,SAAA,gBACxB,cAAc;AAC2B,SAAA,UAA+B,CAAA;AAC/C,SAAA,eAAwB;AACzB,SAAA,eAAuB;AAKtB,SAAA,aAAsB;AAEjD,SAAA,WAAW,CAAC,MAAsB;AAChC,UAAI,CAAC,KAAK,SAAU,QAAO;AAC3B,aAAQ,IAAI,KAAK,WAAY,KAAK;AAAA,IACpC;AAAA,EAAA;AAAA,EAtDA,IAAI,WAAW,GAAW;AACxB,SAAK,QAAQ;AAAA,EACf;AAAA,EACA,IAAI,aAAqB;AACvB,WAAO,KAAK;AAAA,EACd;AAAA,EAQA,IAAI,cAAc,GAAW;AAC3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
|
117
117
|
*
|
|
118
118
|
*
|
|
119
|
+
* @slot badges - Custom badges to be displayed in the badge area.
|
|
120
|
+
* @slot tag - Text or element for the tank's tag/label.
|
|
121
|
+
* @slot readout - Replaces the entire readout content block.
|
|
122
|
+
* @slot max-value - Content for the capacity value.
|
|
123
|
+
* @slot unit - Content for the unit of measurement.
|
|
124
|
+
* @slot current-value - Content for the current level value.
|
|
125
|
+
* @slot rich - Content for additional detail rows.
|
|
126
|
+
* @slot alert-icon - Custom icon for the alert frame.
|
|
127
|
+
* @slot alert-label - Label for the alert frame.
|
|
128
|
+
* @slot alert-timer - Timer for the alert frame.
|
|
129
|
+
*
|
|
119
130
|
* @ignition-base-height: 173px
|
|
120
131
|
* @ignition-base-width: 168px
|
|
121
132
|
* @ignition-center-horizontal
|
|
@@ -16,6 +16,18 @@
|
|
|
16
16
|
height: 100%;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
.container > .readout {
|
|
20
|
+
left: 50%;
|
|
21
|
+
width: auto;
|
|
22
|
+
height: auto;
|
|
23
|
+
transform: translate(-50%, -50%);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
obc-readout::part(value-wrapper),
|
|
27
|
+
obc-readout::part(meta-wrapper) {
|
|
28
|
+
justify-self: center;
|
|
29
|
+
}
|
|
30
|
+
|
|
19
31
|
:host {
|
|
20
32
|
display: block;
|
|
21
33
|
width: 100%;
|
|
@@ -133,6 +133,13 @@ export const WithSetpoint: Story = {
|
|
|
133
133
|
},
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
+
export const WithReadout: Story = {
|
|
137
|
+
args: {
|
|
138
|
+
headingSetpoint: 311,
|
|
139
|
+
hasReadout: true,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
|
|
136
143
|
export const TickmarksInside: Story = {
|
|
137
144
|
args: {
|
|
138
145
|
headingSetpoint: 311,
|
|
@@ -2,6 +2,8 @@ import {LitElement, PropertyValues, html, svg, unsafeCSS, nothing} from 'lit';
|
|
|
2
2
|
import {property} from 'lit/decorators.js';
|
|
3
3
|
import componentStyle from './compass-sector.css?inline';
|
|
4
4
|
import '../watch/watch.js';
|
|
5
|
+
import '../readout/readout.js';
|
|
6
|
+
import {ReadoutDirection, ReadoutVariant} from '../readout/readout.js';
|
|
5
7
|
import {Tickmark, TickmarkType, TickmarkStyle} from '../watch/tickmark.js';
|
|
6
8
|
import {arrow, ArrowStyle} from '../compass/arrow.js';
|
|
7
9
|
import {AdviceState, AngleAdvice, AngleAdviceRaw} from '../watch/advice.js';
|
|
@@ -155,6 +157,12 @@ export class ObcCompassSector extends LitElement {
|
|
|
155
157
|
];
|
|
156
158
|
@property({type: Boolean}) tickmarksInside: boolean = false;
|
|
157
159
|
@property({type: Boolean}) zoomToFitArc: boolean = false;
|
|
160
|
+
/**
|
|
161
|
+
* When `true`, shows a centered `<obc-readout>` under the arc displaying the
|
|
162
|
+
* heading (label `HDG`, unit `DEG`). The value color follows the HDG entry in
|
|
163
|
+
* `priorityElements`, matching the HDG arrow.
|
|
164
|
+
*/
|
|
165
|
+
@property({type: Boolean}) hasReadout: boolean = false;
|
|
158
166
|
|
|
159
167
|
private _headingSp = new SetpointBundle({
|
|
160
168
|
angularWraparound: true,
|
|
@@ -396,6 +404,33 @@ export class ObcCompassSector extends LitElement {
|
|
|
396
404
|
return selected.includes(element) ? this.priority : Priority.regular;
|
|
397
405
|
}
|
|
398
406
|
|
|
407
|
+
/**
|
|
408
|
+
* Vertical placement of the readout as a percentage of the host height.
|
|
409
|
+
*
|
|
410
|
+
* With `zoomToFitArc` the arc is reframed by `computeZoomToFitArcFrame`, whose
|
|
411
|
+
* `radiusOffset`/`viewBox` depend on the arc's *absolute* orientation (which
|
|
412
|
+
* cardinal axes its bounding box crosses), not just its bend. The arc itself
|
|
413
|
+
* is always rotated back to the top, so it stays put on screen — but a
|
|
414
|
+
* frame-derived offset would swing wildly as `heading` rotates the bbox around
|
|
415
|
+
* the circle. So in zoom we use a fixed offset, which keeps the readout steady
|
|
416
|
+
* under the (stationary) arc regardless of heading.
|
|
417
|
+
*
|
|
418
|
+
* Without zoom the viewBox is the fixed, origin-symmetric 120° framing, so the
|
|
419
|
+
* geometry is orientation-independent: place the readout halfway down the inner
|
|
420
|
+
* radius from the watch center toward the arc's inner edge.
|
|
421
|
+
*/
|
|
422
|
+
private get _readoutTopPercent(): number {
|
|
423
|
+
if (this.zoomToFitArc) {
|
|
424
|
+
return 70;
|
|
425
|
+
}
|
|
426
|
+
const [, vy, , vh] = this._cachedViewBox.split(' ').map(Number);
|
|
427
|
+
if (!vh || Number.isNaN(vy)) {
|
|
428
|
+
return 50;
|
|
429
|
+
}
|
|
430
|
+
const anchorY = -INNER_RADIUS * 0.5;
|
|
431
|
+
return Math.round(((anchorY - vy) / vh) * 1000) / 10;
|
|
432
|
+
}
|
|
433
|
+
|
|
399
434
|
// ---------------------------------------------------------------------------
|
|
400
435
|
// Render
|
|
401
436
|
// ---------------------------------------------------------------------------
|
|
@@ -477,6 +512,23 @@ export class ObcCompassSector extends LitElement {
|
|
|
477
512
|
rOff
|
|
478
513
|
)}
|
|
479
514
|
</svg>
|
|
515
|
+
${this.hasReadout
|
|
516
|
+
? html`<div class="readout" style="top: ${this._readoutTopPercent}%">
|
|
517
|
+
<obc-readout
|
|
518
|
+
.variant=${ReadoutVariant.enhanced}
|
|
519
|
+
.direction=${ReadoutDirection.vertical}
|
|
520
|
+
.hasSetpoint=${false}
|
|
521
|
+
.hasAdvice=${false}
|
|
522
|
+
.value=${this.heading}
|
|
523
|
+
.fractionDigits=${0}
|
|
524
|
+
.valuePriority=${this.priorityFor(
|
|
525
|
+
CompassSectorPriorityElement.hdg
|
|
526
|
+
)}
|
|
527
|
+
label="HDG"
|
|
528
|
+
unit="DEG"
|
|
529
|
+
></obc-readout>
|
|
530
|
+
</div>`
|
|
531
|
+
: nothing}
|
|
480
532
|
</div>
|
|
481
533
|
`;
|
|
482
534
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type {Meta, StoryObj} from '@storybook/web-components-vite';
|
|
2
|
-
import {ObcPitch} from './pitch.js';
|
|
2
|
+
import {ObcPitch, ObcPitchType} from './pitch.js';
|
|
3
3
|
import './pitch.js';
|
|
4
|
+
import {Priority} from '../types.js';
|
|
4
5
|
import {widthDecorator} from '../../storybook-util.js';
|
|
5
6
|
import {sideVessels} from '../watch/vessels/storybook-helper.js';
|
|
6
7
|
|
|
@@ -23,6 +24,8 @@ const meta: Meta<typeof ObcPitch> = {
|
|
|
23
24
|
control: 'select',
|
|
24
25
|
options: sideVessels,
|
|
25
26
|
},
|
|
27
|
+
type: {control: 'select', options: Object.values(ObcPitchType)},
|
|
28
|
+
priority: {control: 'select', options: Object.values(Priority)},
|
|
26
29
|
},
|
|
27
30
|
decorators: [widthDecorator],
|
|
28
31
|
} satisfies Meta<ObcPitch>;
|
|
@@ -50,3 +53,22 @@ export const ZoomedInNarrow: Story = {
|
|
|
50
53
|
maxPitchAdvice: 10,
|
|
51
54
|
},
|
|
52
55
|
};
|
|
56
|
+
|
|
57
|
+
export const WithReadout: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
hasReadout: true,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const DualScale: Story = {
|
|
64
|
+
args: {
|
|
65
|
+
type: ObcPitchType.dualScale,
|
|
66
|
+
hasReadout: true,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const Enhanced: Story = {
|
|
71
|
+
args: {
|
|
72
|
+
priority: Priority.enhanced,
|
|
73
|
+
},
|
|
74
|
+
};
|