@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.161 → 2.0.0-next.162
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 +437 -324
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +134 -34
- package/dist/navigation-instruments/compass-sector/compass-sector.css.js +20 -11
- package/dist/navigation-instruments/compass-sector/compass-sector.css.js.map +1 -1
- package/dist/navigation-instruments/compass-sector/compass-sector.d.ts +18 -17
- package/dist/navigation-instruments/compass-sector/compass-sector.d.ts.map +1 -1
- package/dist/navigation-instruments/compass-sector/compass-sector.js +85 -52
- package/dist/navigation-instruments/compass-sector/compass-sector.js.map +1 -1
- package/dist/navigation-instruments/gauge-radial/gauge-radial.css.js +2 -6
- package/dist/navigation-instruments/gauge-radial/gauge-radial.css.js.map +1 -1
- package/dist/navigation-instruments/rudder/rudder.css.js +40 -0
- package/dist/navigation-instruments/rudder/rudder.css.js.map +1 -0
- package/dist/navigation-instruments/rudder/rudder.d.ts +9 -0
- package/dist/navigation-instruments/rudder/rudder.d.ts.map +1 -1
- package/dist/navigation-instruments/rudder/rudder.js +40 -23
- package/dist/navigation-instruments/rudder/rudder.js.map +1 -1
- package/dist/navigation-instruments/watch/watch.css.js +6 -0
- package/dist/navigation-instruments/watch/watch.css.js.map +1 -1
- package/dist/navigation-instruments/watch/watch.d.ts.map +1 -1
- package/dist/navigation-instruments/watch/watch.js +11 -1
- package/dist/navigation-instruments/watch/watch.js.map +1 -1
- package/dist/svghelpers/arc-frame.d.ts +8 -0
- package/dist/svghelpers/arc-frame.d.ts.map +1 -1
- package/dist/svghelpers/arc-frame.js +16 -6
- package/dist/svghelpers/arc-frame.js.map +1 -1
- package/dist/svghelpers/radial-frame.d.ts +14 -1
- package/dist/svghelpers/radial-frame.d.ts.map +1 -1
- package/dist/svghelpers/radial-frame.js +3 -1
- package/dist/svghelpers/radial-frame.js.map +1 -1
- package/package.json +1 -1
- package/src/mixins/contain-aspect.css +14 -0
- package/src/navigation-instruments/compass-sector/compass-sector.css +17 -11
- package/src/navigation-instruments/compass-sector/compass-sector.spec.ts +57 -0
- package/src/navigation-instruments/compass-sector/compass-sector.stories.ts +23 -0
- package/src/navigation-instruments/compass-sector/compass-sector.ts +127 -60
- package/src/navigation-instruments/gauge-radial/gauge-radial.css +3 -10
- package/src/navigation-instruments/rudder/rudder.css +27 -0
- package/src/navigation-instruments/rudder/rudder.ts +52 -22
- package/src/navigation-instruments/watch/watch.css +6 -0
- package/src/navigation-instruments/watch/watch.ts +16 -1
- package/src/svghelpers/arc-frame.ts +19 -5
- package/src/svghelpers/radial-frame.spec.ts +51 -0
- package/src/svghelpers/radial-frame.ts +15 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { unsafeCSS, LitElement, nothing, svg, html } from "lit";
|
|
2
2
|
import { property } from "lit/decorators.js";
|
|
3
|
+
import { ResizeController } from "@lit-labs/observers/resize-controller.js";
|
|
3
4
|
import componentStyle from "./compass-sector.css.js";
|
|
4
5
|
import { WatchCircleType, innerRingRadiusFor, OUTER_RING_RADIUS } from "../watch/watch.js";
|
|
5
6
|
import { centerReadoutStyles, renderCenterReadouts } from "../readout/center-readout.js";
|
|
@@ -9,11 +10,11 @@ import { TickmarkType, TickmarkStyle } from "../watch/tickmark.js";
|
|
|
9
10
|
import { arrow, ArrowStyle } from "../compass/arrow.js";
|
|
10
11
|
import { AdviceState } from "../watch/advice.js";
|
|
11
12
|
import { SetpointBundle } from "../../svghelpers/setpoint-bundle.js";
|
|
12
|
-
import {
|
|
13
|
+
import { observeInnerBox, computeRadialFrame, measureContainerPx, estimateLabelWidthPx } from "../../svghelpers/radial-frame.js";
|
|
13
14
|
import { RotPosition, ROT_ZERO_DEADBAND_DEG } from "../rate-of-turn/rot-renderer.js";
|
|
14
15
|
import { RotType } from "../rate-of-turn/rot-renderer.js";
|
|
15
16
|
import { customElement } from "../../decorator.js";
|
|
16
|
-
import { normalizeAngle } from "../../svghelpers/math.js";
|
|
17
|
+
import { degToRad, normalizeAngle } from "../../svghelpers/math.js";
|
|
17
18
|
import { InstrumentState, Priority } from "../types.js";
|
|
18
19
|
var __defProp = Object.defineProperty;
|
|
19
20
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -31,7 +32,12 @@ var CompassSectorPriorityElement = /* @__PURE__ */ ((CompassSectorPriorityElemen
|
|
|
31
32
|
CompassSectorPriorityElement2["rot"] = "rot";
|
|
32
33
|
return CompassSectorPriorityElement2;
|
|
33
34
|
})(CompassSectorPriorityElement || {});
|
|
34
|
-
const
|
|
35
|
+
const BASE_PADDING = 48;
|
|
36
|
+
const SECTOR_CLIP_BOTTOM = 51.5;
|
|
37
|
+
const SECTOR_CLIP_BOTTOM_ROT = 50.4;
|
|
38
|
+
const SECTOR_CLIP_BOTTOM_INSIDE_LABELS = 47.3;
|
|
39
|
+
const SECTOR_CLIP_BOTTOM_READOUT = 44;
|
|
40
|
+
const SECTOR_SIDE_MARGIN = 0;
|
|
35
41
|
const WATCH_TYPE = WatchCircleType.triple;
|
|
36
42
|
const INNER_RADIUS = innerRingRadiusFor(WATCH_TYPE);
|
|
37
43
|
const ARC_HALF_EXTENT = 60;
|
|
@@ -87,11 +93,16 @@ let ObcCompassSector = class extends LitElement {
|
|
|
87
93
|
this._halfFOV = 30;
|
|
88
94
|
this._arcHalfExtent = ARC_HALF_EXTENT;
|
|
89
95
|
this._scale = 1;
|
|
90
|
-
this._radiusOffset = 0;
|
|
91
|
-
this._cachedViewBox = "";
|
|
92
96
|
this._cachedAreas = [];
|
|
93
97
|
this._cachedTickmarks = [];
|
|
94
98
|
this._cachedAdvices = [];
|
|
99
|
+
this._resizeController = new ResizeController(this, {});
|
|
100
|
+
this._aspectWidth = 448;
|
|
101
|
+
this._aspectHeight = 217.28;
|
|
102
|
+
}
|
|
103
|
+
firstUpdated(changed) {
|
|
104
|
+
super.firstUpdated(changed);
|
|
105
|
+
observeInnerBox(this._resizeController, this.renderRoot);
|
|
95
106
|
}
|
|
96
107
|
willUpdate(changed) {
|
|
97
108
|
super.willUpdate(changed);
|
|
@@ -137,13 +148,19 @@ let ObcCompassSector = class extends LitElement {
|
|
|
137
148
|
roundOutsideCut: true
|
|
138
149
|
}
|
|
139
150
|
];
|
|
140
|
-
this._computeViewBox();
|
|
141
151
|
this._cachedTickmarks = this._buildTickmarks();
|
|
142
152
|
}
|
|
143
153
|
if (arcInputsChanged || changed.has("headingAdvices")) {
|
|
144
154
|
this._cachedAdvices = this._buildAdvices();
|
|
145
155
|
}
|
|
146
156
|
}
|
|
157
|
+
updated(changed) {
|
|
158
|
+
super.updated(changed);
|
|
159
|
+
this.style.setProperty(
|
|
160
|
+
"--obc-compass-sector-aspect",
|
|
161
|
+
`${this._aspectWidth} / ${this._aspectHeight}`
|
|
162
|
+
);
|
|
163
|
+
}
|
|
147
164
|
disconnectedCallback() {
|
|
148
165
|
super.disconnectedCallback();
|
|
149
166
|
this._headingSp.dispose();
|
|
@@ -197,25 +214,45 @@ let ObcCompassSector = class extends LitElement {
|
|
|
197
214
|
// ---------------------------------------------------------------------------
|
|
198
215
|
// ViewBox
|
|
199
216
|
// ---------------------------------------------------------------------------
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
this._cachedViewBox = frame.viewBox;
|
|
212
|
-
this._cachedArcFrame = frame;
|
|
213
|
-
} else {
|
|
214
|
-
this._radiusOffset = 0;
|
|
215
|
-
const width = (176 + PADDING) * 2;
|
|
216
|
-
this._cachedViewBox = `-${width / 2} -${width / 2} ${width} ${width}`;
|
|
217
|
-
this._cachedArcFrame = void 0;
|
|
217
|
+
/** Deepest crop the active features need, so none of them is shaved. */
|
|
218
|
+
_clipBottom() {
|
|
219
|
+
const clips = [SECTOR_CLIP_BOTTOM];
|
|
220
|
+
if (this.rotType !== void 0 && this.rotPosition === RotPosition.innerCircle) {
|
|
221
|
+
clips.push(SECTOR_CLIP_BOTTOM_ROT);
|
|
222
|
+
}
|
|
223
|
+
if (this.tickmarksInside) {
|
|
224
|
+
clips.push(SECTOR_CLIP_BOTTOM_INSIDE_LABELS);
|
|
225
|
+
}
|
|
226
|
+
if (this.hasReadout) {
|
|
227
|
+
clips.push(SECTOR_CLIP_BOTTOM_READOUT);
|
|
218
228
|
}
|
|
229
|
+
return Math.min(...clips);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* One frame per render, feeding both layers: the shared sector box cropped
|
|
233
|
+
* to the arc. Zoom enlarges the arc rather than the window, so the window
|
|
234
|
+
* only slides outward by the radius offset and the canvas holds still.
|
|
235
|
+
*/
|
|
236
|
+
_buildFrame() {
|
|
237
|
+
const frame = computeRadialFrame({
|
|
238
|
+
basePadding: BASE_PADDING,
|
|
239
|
+
labelWidthPx: this.tickmarksInside ? 0 : estimateLabelWidthPx(this._cachedTickmarks.map((t) => t.text)),
|
|
240
|
+
clips: { top: 0, bottom: this._clipBottom(), left: 0, right: 0 },
|
|
241
|
+
containerPx: measureContainerPx(this)
|
|
242
|
+
});
|
|
243
|
+
if (!this.zoomToFitArc) {
|
|
244
|
+
return frame;
|
|
245
|
+
}
|
|
246
|
+
const halfWidth = frame.width / 2 - SECTOR_SIDE_MARGIN;
|
|
247
|
+
const sin = Math.sin(degToRad(this._arcHalfExtent));
|
|
248
|
+
const radiusOffset = Math.max(0, halfWidth / sin - OUTER_RING_RADIUS);
|
|
249
|
+
const y = frame.y - radiusOffset;
|
|
250
|
+
return {
|
|
251
|
+
...frame,
|
|
252
|
+
y,
|
|
253
|
+
radiusOffset,
|
|
254
|
+
viewBox: `${frame.x} ${y} ${frame.width} ${frame.height}`
|
|
255
|
+
};
|
|
219
256
|
}
|
|
220
257
|
// ---------------------------------------------------------------------------
|
|
221
258
|
// North arrow — rendered in overlay at mapped 0° position
|
|
@@ -268,38 +305,32 @@ let ObcCompassSector = class extends LitElement {
|
|
|
268
305
|
return selected.includes(element) ? this.priority : Priority.regular;
|
|
269
306
|
}
|
|
270
307
|
/**
|
|
271
|
-
* Vertical placement of the readout as a percentage of the
|
|
308
|
+
* Vertical placement of the readout as a percentage of the frame height.
|
|
272
309
|
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
* is always rotated back to the top, so it stays put on screen — but a
|
|
277
|
-
* frame-derived offset would swing wildly as `heading` rotates the bbox around
|
|
278
|
-
* the circle. So in zoom we use a fixed offset, which keeps the readout steady
|
|
279
|
-
* under the (stationary) arc regardless of heading.
|
|
280
|
-
*
|
|
281
|
-
* Without zoom the viewBox is the fixed, origin-symmetric 120° framing, so the
|
|
282
|
-
* geometry is orientation-independent: place the readout halfway down the inner
|
|
283
|
-
* radius from the watch center toward the arc's inner edge.
|
|
310
|
+
* The anchor sits halfway down the inner radius, below the arc's inner edge.
|
|
311
|
+
* Zoom pushes that edge out by the radius offset, so the anchor follows it
|
|
312
|
+
* and the gap under the arc reads the same in both modes.
|
|
284
313
|
*/
|
|
285
|
-
|
|
286
|
-
if (
|
|
287
|
-
return 70;
|
|
288
|
-
}
|
|
289
|
-
const [, vy, , vh] = this._cachedViewBox.split(" ").map(Number);
|
|
290
|
-
if (!vh || Number.isNaN(vy)) {
|
|
314
|
+
_readoutTopPercent(frame) {
|
|
315
|
+
if (!frame.height) {
|
|
291
316
|
return 50;
|
|
292
317
|
}
|
|
293
|
-
const anchorY = -INNER_RADIUS * 0.5;
|
|
294
|
-
return Math.round((anchorY -
|
|
318
|
+
const anchorY = -INNER_RADIUS * 0.5 - frame.radiusOffset;
|
|
319
|
+
return Math.round((anchorY - frame.y) / frame.height * 1e3) / 10;
|
|
295
320
|
}
|
|
296
321
|
// ---------------------------------------------------------------------------
|
|
297
322
|
// Render
|
|
298
323
|
// ---------------------------------------------------------------------------
|
|
299
324
|
render() {
|
|
300
325
|
const rotation = -this.heading;
|
|
301
|
-
const
|
|
302
|
-
const
|
|
326
|
+
const frame = this._buildFrame();
|
|
327
|
+
const viewBox = frame.viewBox;
|
|
328
|
+
const rOff = frame.radiusOffset;
|
|
329
|
+
const pivotX = -frame.x / frame.width * 100;
|
|
330
|
+
const pivotY = -frame.y / frame.height * 100;
|
|
331
|
+
this._aspectWidth = frame.width;
|
|
332
|
+
this._aspectHeight = frame.height;
|
|
333
|
+
const tickmarks = frame.labelsHidden ? this._cachedTickmarks.map((t) => ({ ...t, text: void 0 })) : this._cachedTickmarks;
|
|
303
334
|
const mappedCOG = this._mapAngle(this.courseOverGround);
|
|
304
335
|
const mappedSetpoint = this.headingSetpoint != null ? this._mapAngle(this.headingSetpoint) : void 0;
|
|
305
336
|
const mappedNewSetpoint = this.newHeadingSetpoint != null ? this._mapAngle(this.newHeadingSetpoint) : void 0;
|
|
@@ -307,17 +338,15 @@ let ObcCompassSector = class extends LitElement {
|
|
|
307
338
|
<div class="container">
|
|
308
339
|
<obc-watch
|
|
309
340
|
.touching=${this.touching}
|
|
310
|
-
.padding=${PADDING}
|
|
311
341
|
.advices=${this._cachedAdvices}
|
|
312
|
-
.tickmarks=${
|
|
342
|
+
.tickmarks=${tickmarks}
|
|
313
343
|
.tickmarkStyle=${TickmarkStyle.regular}
|
|
314
344
|
.tickmarksInside=${this.tickmarksInside}
|
|
315
345
|
.state=${this.state}
|
|
316
346
|
.watchCircleType=${WATCH_TYPE}
|
|
317
347
|
.northArrow=${false}
|
|
318
348
|
.areas=${this._cachedAreas}
|
|
319
|
-
.arcFrame=${
|
|
320
|
-
.zoomToFitArc=${this.zoomToFitArc}
|
|
349
|
+
.arcFrame=${frame}
|
|
321
350
|
.tickFadeAngle=${this._arcHalfExtent * 0.2}
|
|
322
351
|
.rotation=${rotation}
|
|
323
352
|
.angleSetpoint=${mappedSetpoint}
|
|
@@ -342,7 +371,11 @@ let ObcCompassSector = class extends LitElement {
|
|
|
342
371
|
.rotationsPerMinute=${this.rotationsPerMinute}
|
|
343
372
|
>
|
|
344
373
|
</obc-watch>
|
|
345
|
-
<svg
|
|
374
|
+
<svg
|
|
375
|
+
viewBox="${viewBox}"
|
|
376
|
+
transform="rotate(${rotation})"
|
|
377
|
+
style="transform-origin: ${pivotX}% ${pivotY}%"
|
|
378
|
+
>
|
|
346
379
|
<g transform="rotate(${this.heading})">
|
|
347
380
|
<line
|
|
348
381
|
x1="0"
|
|
@@ -376,7 +409,7 @@ let ObcCompassSector = class extends LitElement {
|
|
|
376
409
|
</svg>
|
|
377
410
|
${this.hasReadout ? html`<div
|
|
378
411
|
class="readout"
|
|
379
|
-
style="top: ${this._readoutTopPercent}%"
|
|
412
|
+
style="top: ${this._readoutTopPercent(frame)}%"
|
|
380
413
|
>
|
|
381
414
|
${renderCenterReadouts([
|
|
382
415
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compass-sector.js","sources":["../../../src/navigation-instruments/compass-sector/compass-sector.ts"],"sourcesContent":["import {LitElement, PropertyValues, html, svg, unsafeCSS, nothing} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport componentStyle from './compass-sector.css?inline';\nimport '../watch/watch.js';\nimport {\n centerReadoutStyles,\n renderCenterReadouts,\n} from '../readout/center-readout.js';\nimport {ReadoutSize} from '../readout/readout.js';\nimport instrumentReadoutStyle from '../readout/instrument-readout.css?inline';\nimport {Tickmark, TickmarkType, TickmarkStyle} from '../watch/tickmark.js';\nimport {arrow, ArrowStyle} from '../compass/arrow.js';\nimport {AdviceState, AngleAdvice, AngleAdviceRaw} from '../watch/advice.js';\nimport {\n WatchCircleType,\n WatchArea,\n OUTER_RING_RADIUS,\n innerRingRadiusFor,\n RotType,\n RotPosition,\n} from '../watch/watch.js';\nimport {SetpointBundle} from '../../svghelpers/setpoint-bundle.js';\nimport {\n computeZoomToFitArcFrame,\n type ZoomToFitArcFrame,\n} from '../../svghelpers/arc-frame.js';\nimport {ROT_ZERO_DEADBAND_DEG} from '../rate-of-turn/rot-renderer.js';\nimport {customElement} from '../../decorator.js';\nimport {normalizeAngle} from '../../svghelpers/math.js';\nimport {InstrumentState, Priority} from '../types.js';\nexport {RotType, RotPosition};\n\nexport enum CompassSectorPriorityElement {\n hdg = 'hdg',\n cog = 'cog',\n rot = 'rot',\n}\n\n// Fixed frame padding for the zoomed and un-zoomed paths alike. The bespoke\n// FOV-compression geometry stays instead of svghelpers/radial-frame.ts: the\n// viewBox is cached per FOV, which a container-size-dependent label reserve\n// would invalidate, and 72 units covers the 3-char degree labels.\n// TODO(#1021): adopt computeRadialFrame if degree labels ever clip.\nconst PADDING = 72;\nconst WATCH_TYPE = WatchCircleType.triple;\nconst INNER_RADIUS = innerRingRadiusFor(WATCH_TYPE);\n/** Half of the fixed 120° arc on the watch face. */\nconst ARC_HALF_EXTENT = 60;\nconst SCALE_INNER_RADIUS = innerRingRadiusFor(WatchCircleType.single);\n\ninterface TickDensity {\n mainInterval: number;\n primaryInterval: number;\n secondaryInterval: number | undefined;\n}\n\nfunction tickDensityForFOV(fov: number): TickDensity {\n if (fov <= 30) {\n return {mainInterval: 10, primaryInterval: 5, secondaryInterval: 1};\n } else if (fov <= 60) {\n return {mainInterval: 10, primaryInterval: 5, secondaryInterval: undefined};\n } else if (fov <= 120) {\n return {mainInterval: 30, primaryInterval: 10, secondaryInterval: 5};\n } else {\n return {mainInterval: 90, primaryInterval: 30, secondaryInterval: 10};\n }\n}\n\n/**\n * `<obc-compass-sector>` — Curved compass strip that auto‑scales to keep HDG and COG visible.\n *\n * Renders a fixed 120° arc of a triple‑ring compass face. The visible\n * compass range (field of view) adjusts automatically so that both the\n * heading (HDG) and course‑over‑ground (COG) arrows are always in view.\n * This is the radial equivalent of `<obc-compass-flat>`: the arc shape\n * never changes — only the scale (compass‑degrees per arc‑degree) changes.\n *\n * ## Features\n *\n * - **Fixed 120° arc**: The watch face is always a 120° sector (±60° from\n * center), identical in shape to `<obc-rot-sector>`.\n * - **FOV auto‑scaling**: The field of view widens when the HDG–COG\n * angular difference grows, compressing more compass degrees into the\n * fixed arc. Tickmark density adjusts automatically.\n * - **HDG / COG arrows**: Solid (HDG) arrow is always at the arc center.\n * Hollow (COG) arrow is positioned proportionally within the arc.\n * - **North arrow**: A gray triangle in the outer scale band indicates\n * north when it falls within the visible FOV.\n * - **Heading setpoint**: Optional setpoint marker with auto at‑setpoint\n * detection and confirm animation, positioned at the mapped arc angle.\n * - **Advice zones**: Pass `headingAdvices` to render caution/alert arcs,\n * mapped into the scaled arc.\n * - **Rate of turn**: Animated ROT indicator (dots or bar) spanning from\n * HDG to the mapped COG position, clipped to the arc.\n * - **Zoom to fit**: When `zoomToFitArc` is `true`, the fixed 120° arc is\n * enlarged to fill the available space.\n *\n * ## Usage Guidelines\n *\n * - Set `heading` and `courseOverGround` to sensor values in degrees.\n * - Adjust `minFOV` to control the minimum zoom level (default 30°).\n * - Enable `zoomToFitArc` to enlarge the arc to fill the viewport.\n * - For a full‑circle compass, use `<obc-compass>` instead.\n *\n * @availableWhen newHeadingSetpoint headingSetpoint!=null\n * @availableWhen atHeadingSetpoint headingSetpoint!=null && autoAtHeadingSetpoint==false\n * @availableWhen headingSetpointAtZeroDeadband headingSetpoint!=null\n * @availableWhen headingSetpointOverride headingSetpoint!=null\n * @availableWhen autoAtHeadingSetpoint headingSetpoint!=null\n * @availableWhen autoAtHeadingSetpointDeadband headingSetpoint!=null && autoAtHeadingSetpoint==true\n * @availableWhen animateSetpoint headingSetpoint!=null\n * @availableWhen touching headingSetpoint!=null\n * @availableWhen rotPosition rotType!=undefined\n * @property rateOfTurnDegreesPerMinute - Measured rate of turn in degrees per minute (positive = starboard).\n * Drives both the bar extent and (after multiplication by\n * `rotDotAnimationFactor`) the spinning dot animation. When `undefined`,\n * falls back to the deprecated `rotationsPerMinute`.\n * @availableWhen rateOfTurnDegreesPerMinute rotType!=undefined\n * @property rotDotAnimationFactor - Visual amplification applied only to the spinning dot animation\n * (not to the bar extent). Default `18` keeps the legacy visual feel\n * (≈1 rpm at 20°/min).\n * @availableWhen rotDotAnimationFactor rotType!=undefined\n * @availableWhen rotPortStarboard rotType!=undefined\n * @availableWhen rotAtZeroDeadband rotType==bar\n * @availableWhen priorityElements priority==enhanced\n * @property hasReadout - When `true`, shows a centered `<obc-readout>` under the arc displaying the\n * heading (label `HDG`, unit `DEG`). The value color follows the HDG entry in\n * `priorityElements`, matching the HDG arrow.\n * @property label - Readout label. Default `HDG`.\n * @availableWhen label hasReadout==true\n * @property unit - Readout unit. Default `DEG`.\n * @availableWhen unit hasReadout==true\n * @property fractionDigits - Number of fraction digits shown in the readout. Default `0`.\n * @availableWhen fractionDigits hasReadout==true\n * @property rotMaxValue - Bar-extent reference value in degrees per minute: the bar fills the full\n * ±`ARC_HALF_EXTENT` arc when the measured rate of turn reaches\n * ±`rotMaxValue`. The default `60` aligns with ES-TRIN 2025/1 Art. 3.02.\n * @availableWhen rotMaxValue rotType==bar\n * @stable\n */\n@customElement('obc-compass-sector')\nexport class ObcCompassSector 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 = 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\n @property({type: Number}) minFOV: number = 30;\n\n @property({type: String}) rotType: RotType | undefined;\n @property({type: String}) rotPosition: RotPosition = RotPosition.innerCircle;\n @property({type: Number}) rateOfTurnDegreesPerMinute: number | undefined;\n @property({type: Number}) rotDotAnimationFactor: number = 18;\n /**\n * @deprecated Use `rateOfTurnDegreesPerMinute` (and optionally\n * `rotDotAnimationFactor`) instead. Takes effect only when\n * `rateOfTurnDegreesPerMinute` is `undefined`.\n * @availableWhen rotType!=undefined && rateOfTurnDegreesPerMinute==undefined\n */\n @property({type: Number}) rotationsPerMinute: number = 1;\n @property({type: Number}) rotMaxValue: number = 60;\n @property({type: Boolean}) rotPortStarboard: boolean = false;\n @property({type: Number}) rotAtZeroDeadband: number = ROT_ZERO_DEADBAND_DEG;\n\n @property({type: String}) state: InstrumentState = InstrumentState.active;\n @property({type: String}) priority: Priority = Priority.regular;\n @property({type: Array, attribute: false})\n priorityElements: CompassSectorPriorityElement[] = [\n CompassSectorPriorityElement.hdg,\n ];\n @property({type: Boolean}) tickmarksInside: boolean = false;\n @property({type: Boolean}) zoomToFitArc: boolean = false;\n @property({type: Boolean}) hasReadout: boolean = false;\n @property({type: String}) label = 'HDG';\n @property({type: String}) unit = 'DEG';\n @property({type: Number}) fractionDigits = 0;\n\n private _headingSp = new SetpointBundle({\n angularWraparound: true,\n onAnimationEnd: () => this.requestUpdate(),\n });\n\n // Cached computed values — updated in willUpdate()\n private _halfFOV = 30;\n private _arcHalfExtent = ARC_HALF_EXTENT;\n private _scale = 1;\n private _radiusOffset = 0;\n private _cachedViewBox = '';\n private _cachedArcFrame: ZoomToFitArcFrame | undefined;\n private _cachedAreas: WatchArea[] = [];\n private _cachedTickmarks: Tickmark[] = [];\n private _cachedAdvices: AngleAdviceRaw[] = [];\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 const arcInputsChanged =\n changed.has('heading') ||\n changed.has('courseOverGround') ||\n changed.has('minFOV') ||\n changed.has('zoomToFitArc');\n\n if (arcInputsChanged) {\n let diff = this.courseOverGround - this.heading;\n if (diff > 180) diff -= 360;\n else if (diff < -180) diff += 360;\n const minFov = Math.max(1, this.minFOV);\n const MARGIN = 15;\n\n if (this.zoomToFitArc) {\n const needed = Math.max(minFov, Math.abs(diff) + MARGIN);\n if (needed <= ARC_HALF_EXTENT) {\n this._halfFOV = needed;\n this._arcHalfExtent = needed;\n this._scale = 1;\n } else {\n this._halfFOV = needed;\n this._arcHalfExtent = ARC_HALF_EXTENT;\n this._scale = ARC_HALF_EXTENT / needed;\n }\n } else {\n this._halfFOV = Math.max(minFov, Math.abs(diff));\n this._arcHalfExtent = ARC_HALF_EXTENT;\n this._scale = ARC_HALF_EXTENT / this._halfFOV;\n }\n\n this._cachedAreas = [\n {\n startAngle: this.heading - this._arcHalfExtent,\n endAngle: this.heading + this._arcHalfExtent,\n roundInsideCut: true,\n roundOutsideCut: true,\n },\n ];\n\n this._computeViewBox();\n this._cachedTickmarks = this._buildTickmarks();\n }\n\n if (arcInputsChanged || changed.has('headingAdvices')) {\n this._cachedAdvices = this._buildAdvices();\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._headingSp.dispose();\n }\n\n // ---------------------------------------------------------------------------\n // Angle mapping — maps compass degrees to arc positions\n // ---------------------------------------------------------------------------\n\n private _mapAngle(compassDeg: number): number {\n let diff = compassDeg - this.heading;\n if (diff > 180) diff -= 360;\n else if (diff < -180) diff += 360;\n return this.heading + diff * this._scale;\n }\n\n // ---------------------------------------------------------------------------\n // Areas — fixed 120° arc centered on heading (built in willUpdate)\n // ---------------------------------------------------------------------------\n\n // ---------------------------------------------------------------------------\n // Tickmarks — compass-degree labels at mapped arc positions\n // ---------------------------------------------------------------------------\n\n private _buildTickmarks(): Tickmark[] {\n const fov = this._halfFOV * 2;\n const {mainInterval, primaryInterval, secondaryInterval} =\n tickDensityForFOV(fov);\n const halfFov = this._halfFOV;\n const compassStart = this.heading - halfFov;\n const compassEnd = this.heading + halfFov;\n\n const tickmarks: Tickmark[] = [];\n const added = new Set<number>();\n\n const addTick = (\n arcAngle: number,\n type: TickmarkType,\n text?: string\n ): void => {\n const key = Math.round(arcAngle * 1000);\n if (added.has(key)) return;\n added.add(key);\n tickmarks.push({angle: arcAngle, type, text});\n };\n\n const step = secondaryInterval ?? primaryInterval;\n const firstTick = Math.ceil(compassStart / step) * step;\n\n for (\n let compassDeg = firstTick;\n compassDeg <= compassEnd;\n compassDeg += step\n ) {\n const norm = normalizeAngle(compassDeg);\n const arcAngle = this._mapAngle(compassDeg);\n const isMain = norm % mainInterval === 0;\n const isPrimary = norm % primaryInterval === 0;\n\n if (isMain) {\n addTick(arcAngle, TickmarkType.main, Math.round(norm).toString());\n } else if (isPrimary) {\n addTick(arcAngle, TickmarkType.primary);\n } else {\n addTick(arcAngle, TickmarkType.secondary);\n }\n }\n\n return tickmarks;\n }\n\n // ---------------------------------------------------------------------------\n // ViewBox\n // ---------------------------------------------------------------------------\n\n private _computeViewBox(): void {\n if (this.zoomToFitArc) {\n const targetSize = (176 + PADDING) * 2;\n const frame = computeZoomToFitArcFrame({\n areas: this._cachedAreas,\n outerRadius: OUTER_RING_RADIUS,\n innerRadius: INNER_RADIUS,\n extension: PADDING,\n targetSize,\n });\n this._radiusOffset = frame.radiusOffset;\n this._cachedViewBox = frame.viewBox;\n this._cachedArcFrame = frame;\n } else {\n this._radiusOffset = 0;\n const width = (176 + PADDING) * 2;\n this._cachedViewBox = `-${width / 2} -${width / 2} ${width} ${width}`;\n this._cachedArcFrame = undefined;\n }\n }\n\n // ---------------------------------------------------------------------------\n // North arrow — rendered in overlay at mapped 0° position\n // ---------------------------------------------------------------------------\n\n private _renderNorthArrow(rOff: number) {\n let northOffset = -this.heading;\n if (northOffset > 180) northOffset -= 360;\n else if (northOffset < -180) northOffset += 360;\n if (Math.abs(northOffset) > this._halfFOV) return nothing;\n\n const northArcAngle = this._mapAngle(0);\n const radius = OUTER_RING_RADIUS + rOff;\n return svg`\n <g transform=\"rotate(${northArcAngle}) translate(0, ${-radius})\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M-17.8457 24.984 0 0 17.8458 24.984C11.9868 24.3338 6.0324 24 0 24-6.0323 24-11.9867 24.3338-17.8457 24.984Z\"\n fill=\"var(--instrument-frame-tertiary-color)\"/>\n </g>\n `;\n }\n\n // ---------------------------------------------------------------------------\n // Priority & advice helpers\n // ---------------------------------------------------------------------------\n\n private _angleInRange(value: number, min: number, max: number): boolean {\n const v = normalizeAngle(value);\n const start = normalizeAngle(min);\n const end = normalizeAngle(max);\n return start <= end ? v >= start && v <= end : v >= start || v <= end;\n }\n\n private _buildAdvices(): AngleAdviceRaw[] {\n return this.headingAdvices.map(({minAngle, maxAngle, hinted, type}) => {\n const state = this._angleInRange(this.heading, minAngle, maxAngle)\n ? AdviceState.triggered\n : hinted\n ? AdviceState.hinted\n : AdviceState.regular;\n return {\n minAngle: this._mapAngle(minAngle),\n maxAngle: this._mapAngle(maxAngle),\n type,\n state,\n };\n });\n }\n\n private get _effectiveRotDegPerMin(): number {\n return this.rateOfTurnDegreesPerMinute ?? this.rotationsPerMinute;\n }\n\n private get _rotEndAngle(): number {\n const maxVal = this.rotMaxValue || 1;\n const barCompassDeg =\n (this._effectiveRotDegPerMin / maxVal) * ARC_HALF_EXTENT;\n return this._mapAngle(this.heading + barCompassDeg);\n }\n\n private priorityFor(element: CompassSectorPriorityElement): Priority {\n const selected = Array.isArray(this.priorityElements)\n ? this.priorityElements\n : [];\n return selected.includes(element) ? this.priority : Priority.regular;\n }\n\n /**\n * Vertical placement of the readout as a percentage of the host height.\n *\n * With `zoomToFitArc` the arc is reframed by `computeZoomToFitArcFrame`, whose\n * `radiusOffset`/`viewBox` depend on the arc's *absolute* orientation (which\n * cardinal axes its bounding box crosses), not just its bend. The arc itself\n * is always rotated back to the top, so it stays put on screen — but a\n * frame-derived offset would swing wildly as `heading` rotates the bbox around\n * the circle. So in zoom we use a fixed offset, which keeps the readout steady\n * under the (stationary) arc regardless of heading.\n *\n * Without zoom the viewBox is the fixed, origin-symmetric 120° framing, so the\n * geometry is orientation-independent: place the readout halfway down the inner\n * radius from the watch center toward the arc's inner edge.\n */\n private get _readoutTopPercent(): number {\n if (this.zoomToFitArc) {\n return 70;\n }\n const [, vy, , vh] = this._cachedViewBox.split(' ').map(Number);\n if (!vh || Number.isNaN(vy)) {\n return 50;\n }\n const anchorY = -INNER_RADIUS * 0.5;\n return Math.round(((anchorY - vy) / vh) * 1000) / 10;\n }\n\n // ---------------------------------------------------------------------------\n // Render\n // ---------------------------------------------------------------------------\n\n override render() {\n const rotation = -this.heading;\n const viewBox = this._cachedViewBox;\n const rOff = this._radiusOffset;\n\n const mappedCOG = this._mapAngle(this.courseOverGround);\n const mappedSetpoint =\n this.headingSetpoint != null\n ? this._mapAngle(this.headingSetpoint)\n : undefined;\n const mappedNewSetpoint =\n this.newHeadingSetpoint != null\n ? this._mapAngle(this.newHeadingSetpoint)\n : undefined;\n\n return html`\n <div class=\"container\">\n <obc-watch\n .touching=${this.touching}\n .padding=${PADDING}\n .advices=${this._cachedAdvices}\n .tickmarks=${this._cachedTickmarks}\n .tickmarkStyle=${TickmarkStyle.regular}\n .tickmarksInside=${this.tickmarksInside}\n .state=${this.state}\n .watchCircleType=${WATCH_TYPE}\n .northArrow=${false}\n .areas=${this._cachedAreas}\n .arcFrame=${this._cachedArcFrame}\n .zoomToFitArc=${this.zoomToFitArc}\n .tickFadeAngle=${this._arcHalfExtent * 0.2}\n .rotation=${rotation}\n .angleSetpoint=${mappedSetpoint}\n .newAngleSetpoint=${mappedNewSetpoint}\n .atAngleSetpoint=${this._headingSp.computeAtSetpoint(this.heading)}\n .angleSetpointAtZeroDeadband=${this.headingSetpointAtZeroDeadband}\n .setpointOverride=${this.headingSetpointOverride}\n .priority=${this.priority}\n .animateSetpoint=${this.animateSetpoint}\n .rotType=${this.rotType}\n .rotPosition=${this.rotPosition}\n .rotStartAngle=${this.heading}\n .rotEndAngle=${this._rotEndAngle}\n .rotPriority=${this.priorityFor(CompassSectorPriorityElement.rot)}\n .rotPortStarboard=${this.rotPortStarboard}\n .rotAtZeroDeadband=${this.rotAtZeroDeadband}\n .rateOfTurnDegreesPerMinute=${this.rateOfTurnDegreesPerMinute}\n .rotDotAnimationFactor=${this.rotDotAnimationFactor}\n .rotationsPerMinute=${this.rotationsPerMinute}\n >\n </obc-watch>\n <svg viewBox=\"${viewBox}\" transform=\"rotate(${rotation})\">\n <g transform=\"rotate(${this.heading})\">\n <line\n x1=\"0\"\n y1=\"${-(SCALE_INNER_RADIUS + rOff)}\"\n x2=\"0\"\n y2=\"${-(INNER_RADIUS + rOff)}\"\n stroke=\"var(--instrument-frame-tertiary-color)\"\n stroke-width=\"1\"\n vector-effect=\"non-scaling-stroke\"\n />\n </g>\n ${this._renderNorthArrow(rOff)}\n ${arrow(\n ArrowStyle.HDG,\n this.heading,\n this.priorityFor(CompassSectorPriorityElement.hdg),\n rOff\n )}\n ${arrow(\n ArrowStyle.COG,\n mappedCOG,\n this.priorityFor(CompassSectorPriorityElement.cog),\n rOff\n )}\n </svg>\n ${\n this.hasReadout\n ? html`<div\n class=\"readout\"\n style=\"top: ${this._readoutTopPercent}%\"\n >\n ${renderCenterReadouts([\n {\n value: this.heading,\n label: this.label,\n unit: this.unit,\n fractionDigits: this.fractionDigits,\n size: ReadoutSize.large,\n priority: this.priorityFor(\n CompassSectorPriorityElement.hdg\n ),\n centerValue: true,\n centerMeta: true,\n },\n ])}\n </div>`\n : nothing\n }\n </div>\n `;\n }\n\n static override styles = [\n unsafeCSS(instrumentReadoutStyle),\n centerReadoutStyles,\n unsafeCSS(componentStyle),\n ];\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-compass-sector': ObcCompassSector;\n }\n}\n"],"names":["CompassSectorPriorityElement"],"mappings":";;;;;;;;;;;;;;;;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Q;AAAA,GAvCd,iBAuCgB,WAAA,gBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAxCd,iBAwCgB,WAAA,cAAA,CAAA;AACD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAzCb,iBAyCe,WAAA,SAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GA1Cb,iBA0Ce,WAAA,QAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GA3Cb,iBA2Ce,WAAA,kBAAA,CAAA;AA3Cf,mBAAN,gBAAA;AAAA,EADN,cAAc,oBAAoB;AAAA,GACtB,gBAAA;"}
|
|
1
|
+
{"version":3,"file":"compass-sector.js","sources":["../../../src/navigation-instruments/compass-sector/compass-sector.ts"],"sourcesContent":["import {LitElement, PropertyValues, html, svg, unsafeCSS, nothing} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {ResizeController} from '@lit-labs/observers/resize-controller.js';\nimport componentStyle from './compass-sector.css?inline';\nimport '../watch/watch.js';\nimport {\n centerReadoutStyles,\n renderCenterReadouts,\n} from '../readout/center-readout.js';\nimport {ReadoutSize} from '../readout/readout.js';\nimport instrumentReadoutStyle from '../readout/instrument-readout.css?inline';\nimport {Tickmark, TickmarkType, TickmarkStyle} from '../watch/tickmark.js';\nimport {arrow, ArrowStyle} from '../compass/arrow.js';\nimport {AdviceState, AngleAdvice, AngleAdviceRaw} from '../watch/advice.js';\nimport {\n WatchCircleType,\n WatchArea,\n OUTER_RING_RADIUS,\n innerRingRadiusFor,\n RotType,\n RotPosition,\n} from '../watch/watch.js';\nimport {SetpointBundle} from '../../svghelpers/setpoint-bundle.js';\nimport {\n computeRadialFrame,\n estimateLabelWidthPx,\n measureContainerPx,\n observeInnerBox,\n type RadialFrame,\n} from '../../svghelpers/radial-frame.js';\nimport {ROT_ZERO_DEADBAND_DEG} from '../rate-of-turn/rot-renderer.js';\nimport {customElement} from '../../decorator.js';\nimport {degToRad, normalizeAngle} from '../../svghelpers/math.js';\nimport {InstrumentState, Priority} from '../types.js';\nexport {RotType, RotPosition};\n\nexport enum CompassSectorPriorityElement {\n hdg = 'hdg',\n cog = 'cog',\n rot = 'rot',\n}\n\n/** The sector instruments' shared box: 40 units around the outer ring. */\nconst BASE_PADDING = 48;\n/**\n * Bottom crops, % of the 448 box, one per feature that hangs below the band.\n * Each leaves its lowest paint the same 40-unit margin the ring gets above —\n * `100 · (184 − y) / 448` — and `_clipBottom()` takes the deepest in play.\n * The band's own floor is the filleted inner corner at ±60°, y ≈ −47.\n */\nconst SECTOR_CLIP_BOTTOM = 51.5;\n/** ROT dots and bar ride the inner-circle track, ~5 units below the band. */\nconst SECTOR_CLIP_BOTTOM_ROT = 50.4;\n/** Inside labels sit under the inner ring, far below the band's floor. */\nconst SECTOR_CLIP_BOTTOM_INSIDE_LABELS = 47.3;\n/** The readout is px-sized, so it needs the room obc-gauge-radial's 180° sector reserves. */\nconst SECTOR_CLIP_BOTTOM_READOUT = 44;\n/**\n * Clearance the zoom flattens the arc out to. Zero puts the arc ends on the\n * side edges, which is the point of zooming; the un-zoomed 120° arc stops\n * well short of them because the box keeps the whole circle's width.\n */\nconst SECTOR_SIDE_MARGIN = 0;\nconst WATCH_TYPE = WatchCircleType.triple;\nconst INNER_RADIUS = innerRingRadiusFor(WATCH_TYPE);\n/** Half of the fixed 120° arc on the watch face. */\nconst ARC_HALF_EXTENT = 60;\nconst SCALE_INNER_RADIUS = innerRingRadiusFor(WatchCircleType.single);\n\ninterface TickDensity {\n mainInterval: number;\n primaryInterval: number;\n secondaryInterval: number | undefined;\n}\n\nfunction tickDensityForFOV(fov: number): TickDensity {\n if (fov <= 30) {\n return {mainInterval: 10, primaryInterval: 5, secondaryInterval: 1};\n } else if (fov <= 60) {\n return {mainInterval: 10, primaryInterval: 5, secondaryInterval: undefined};\n } else if (fov <= 120) {\n return {mainInterval: 30, primaryInterval: 10, secondaryInterval: 5};\n } else {\n return {mainInterval: 90, primaryInterval: 30, secondaryInterval: 10};\n }\n}\n\n/**\n * `<obc-compass-sector>` — Curved compass strip that auto‑scales to keep HDG and COG visible.\n *\n * Renders a fixed 120° arc of a triple‑ring compass face. The visible\n * compass range (field of view) adjusts automatically so that both the\n * heading (HDG) and course‑over‑ground (COG) arrows are always in view.\n * This is the radial equivalent of `<obc-compass-flat>`: the arc shape\n * never changes — only the scale (compass‑degrees per arc‑degree) changes.\n *\n * ## Features\n *\n * - **Fixed 120° arc**: The watch face is always a 120° sector (±60° from\n * center), identical in shape to `<obc-rot-sector>`.\n * - **FOV auto‑scaling**: The field of view widens when the HDG–COG\n * angular difference grows, compressing more compass degrees into the\n * fixed arc. Tickmark density adjusts automatically.\n * - **HDG / COG arrows**: Solid (HDG) arrow is always at the arc center.\n * Hollow (COG) arrow is positioned proportionally within the arc.\n * - **North arrow**: A gray triangle in the outer scale band indicates\n * north when it falls within the visible FOV.\n * - **Heading setpoint**: Optional setpoint marker with auto at‑setpoint\n * detection and confirm animation, positioned at the mapped arc angle.\n * - **Advice zones**: Pass `headingAdvices` to render caution/alert arcs,\n * mapped into the scaled arc.\n * - **Rate of turn**: Animated ROT indicator (dots or bar) spanning from\n * HDG to the mapped COG position, clipped to the arc.\n * - **Zoom to fit**: When `zoomToFitArc` is `true`, the fixed 120° arc is\n * enlarged to fill the available space.\n *\n * ## Usage Guidelines\n *\n * - Set `heading` and `courseOverGround` to sensor values in degrees.\n * - Adjust `minFOV` to control the minimum zoom level (default 30°).\n * - Enable `zoomToFitArc` to enlarge the arc to fill the viewport.\n * - For a full‑circle compass, use `<obc-compass>` instead.\n *\n * @availableWhen newHeadingSetpoint headingSetpoint!=null\n * @availableWhen atHeadingSetpoint headingSetpoint!=null && autoAtHeadingSetpoint==false\n * @availableWhen headingSetpointAtZeroDeadband headingSetpoint!=null\n * @availableWhen headingSetpointOverride headingSetpoint!=null\n * @availableWhen autoAtHeadingSetpoint headingSetpoint!=null\n * @availableWhen autoAtHeadingSetpointDeadband headingSetpoint!=null && autoAtHeadingSetpoint==true\n * @availableWhen animateSetpoint headingSetpoint!=null\n * @availableWhen touching headingSetpoint!=null\n * @availableWhen rotPosition rotType!=undefined\n * @property rateOfTurnDegreesPerMinute - Measured rate of turn in degrees per minute (positive = starboard).\n * Drives both the bar extent and (after multiplication by\n * `rotDotAnimationFactor`) the spinning dot animation. When `undefined`,\n * falls back to the deprecated `rotationsPerMinute`.\n * @availableWhen rateOfTurnDegreesPerMinute rotType!=undefined\n * @property rotDotAnimationFactor - Visual amplification applied only to the spinning dot animation\n * (not to the bar extent). Default `18` keeps the legacy visual feel\n * (≈1 rpm at 20°/min).\n * @availableWhen rotDotAnimationFactor rotType!=undefined\n * @availableWhen rotPortStarboard rotType!=undefined\n * @availableWhen rotAtZeroDeadband rotType==bar\n * @availableWhen priorityElements priority==enhanced\n * @property hasReadout - When `true`, shows a centered `<obc-readout>` under the arc displaying the\n * heading (label `HDG`, unit `DEG`). The value color follows the HDG entry in\n * `priorityElements`, matching the HDG arrow.\n * @property label - Readout label. Default `HDG`.\n * @availableWhen label hasReadout==true\n * @property unit - Readout unit. Default `DEG`.\n * @availableWhen unit hasReadout==true\n * @property fractionDigits - Number of fraction digits shown in the readout. Default `0`.\n * @availableWhen fractionDigits hasReadout==true\n * @property rotMaxValue - Bar-extent reference value in degrees per minute: the bar fills the full\n * ±`ARC_HALF_EXTENT` arc when the measured rate of turn reaches\n * ±`rotMaxValue`. The default `60` aligns with ES-TRIN 2025/1 Art. 3.02.\n * @availableWhen rotMaxValue rotType==bar\n * @stable\n */\n@customElement('obc-compass-sector')\nexport class ObcCompassSector 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 = 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\n @property({type: Number}) minFOV: number = 30;\n\n @property({type: String}) rotType: RotType | undefined;\n @property({type: String}) rotPosition: RotPosition = RotPosition.innerCircle;\n @property({type: Number}) rateOfTurnDegreesPerMinute: number | undefined;\n @property({type: Number}) rotDotAnimationFactor: number = 18;\n /**\n * @deprecated Use `rateOfTurnDegreesPerMinute` (and optionally\n * `rotDotAnimationFactor`) instead. Takes effect only when\n * `rateOfTurnDegreesPerMinute` is `undefined`.\n * @availableWhen rotType!=undefined && rateOfTurnDegreesPerMinute==undefined\n */\n @property({type: Number}) rotationsPerMinute: number = 1;\n @property({type: Number}) rotMaxValue: number = 60;\n @property({type: Boolean}) rotPortStarboard: boolean = false;\n @property({type: Number}) rotAtZeroDeadband: number = ROT_ZERO_DEADBAND_DEG;\n\n @property({type: String}) state: InstrumentState = InstrumentState.active;\n @property({type: String}) priority: Priority = Priority.regular;\n @property({type: Array, attribute: false})\n priorityElements: CompassSectorPriorityElement[] = [\n CompassSectorPriorityElement.hdg,\n ];\n @property({type: Boolean}) tickmarksInside: boolean = false;\n @property({type: Boolean}) zoomToFitArc: boolean = false;\n @property({type: Boolean}) hasReadout: boolean = false;\n @property({type: String}) label = 'HDG';\n @property({type: String}) unit = 'DEG';\n @property({type: Number}) fractionDigits = 0;\n\n private _headingSp = new SetpointBundle({\n angularWraparound: true,\n onAnimationEnd: () => this.requestUpdate(),\n });\n\n // Cached computed values — updated in willUpdate()\n private _halfFOV = 30;\n private _arcHalfExtent = ARC_HALF_EXTENT;\n private _scale = 1;\n private _cachedAreas: WatchArea[] = [];\n private _cachedTickmarks: Tickmark[] = [];\n private _cachedAdvices: AngleAdviceRaw[] = [];\n\n // The frame follows the host box, which no property change announces.\n private _resizeController = new ResizeController(this, {});\n\n private _aspectWidth = 448;\n private _aspectHeight = 217.28;\n\n override firstUpdated(changed: PropertyValues): void {\n super.firstUpdated(changed);\n observeInnerBox(this._resizeController, this.renderRoot);\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 const arcInputsChanged =\n changed.has('heading') ||\n changed.has('courseOverGround') ||\n changed.has('minFOV') ||\n changed.has('zoomToFitArc');\n\n if (arcInputsChanged) {\n let diff = this.courseOverGround - this.heading;\n if (diff > 180) diff -= 360;\n else if (diff < -180) diff += 360;\n const minFov = Math.max(1, this.minFOV);\n const MARGIN = 15;\n\n if (this.zoomToFitArc) {\n const needed = Math.max(minFov, Math.abs(diff) + MARGIN);\n if (needed <= ARC_HALF_EXTENT) {\n this._halfFOV = needed;\n this._arcHalfExtent = needed;\n this._scale = 1;\n } else {\n this._halfFOV = needed;\n this._arcHalfExtent = ARC_HALF_EXTENT;\n this._scale = ARC_HALF_EXTENT / needed;\n }\n } else {\n this._halfFOV = Math.max(minFov, Math.abs(diff));\n this._arcHalfExtent = ARC_HALF_EXTENT;\n this._scale = ARC_HALF_EXTENT / this._halfFOV;\n }\n\n this._cachedAreas = [\n {\n startAngle: this.heading - this._arcHalfExtent,\n endAngle: this.heading + this._arcHalfExtent,\n roundInsideCut: true,\n roundOutsideCut: true,\n },\n ];\n\n this._cachedTickmarks = this._buildTickmarks();\n }\n\n if (arcInputsChanged || changed.has('headingAdvices')) {\n this._cachedAdvices = this._buildAdvices();\n }\n }\n\n override updated(changed: PropertyValues): void {\n super.updated(changed);\n // The host IS the canvas, so its box follows the frame the render used.\n this.style.setProperty(\n '--obc-compass-sector-aspect',\n `${this._aspectWidth} / ${this._aspectHeight}`\n );\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._headingSp.dispose();\n }\n\n // ---------------------------------------------------------------------------\n // Angle mapping — maps compass degrees to arc positions\n // ---------------------------------------------------------------------------\n\n private _mapAngle(compassDeg: number): number {\n let diff = compassDeg - this.heading;\n if (diff > 180) diff -= 360;\n else if (diff < -180) diff += 360;\n return this.heading + diff * this._scale;\n }\n\n // ---------------------------------------------------------------------------\n // Areas — fixed 120° arc centered on heading (built in willUpdate)\n // ---------------------------------------------------------------------------\n\n // ---------------------------------------------------------------------------\n // Tickmarks — compass-degree labels at mapped arc positions\n // ---------------------------------------------------------------------------\n\n private _buildTickmarks(): Tickmark[] {\n const fov = this._halfFOV * 2;\n const {mainInterval, primaryInterval, secondaryInterval} =\n tickDensityForFOV(fov);\n const halfFov = this._halfFOV;\n const compassStart = this.heading - halfFov;\n const compassEnd = this.heading + halfFov;\n\n const tickmarks: Tickmark[] = [];\n const added = new Set<number>();\n\n const addTick = (\n arcAngle: number,\n type: TickmarkType,\n text?: string\n ): void => {\n const key = Math.round(arcAngle * 1000);\n if (added.has(key)) return;\n added.add(key);\n tickmarks.push({angle: arcAngle, type, text});\n };\n\n const step = secondaryInterval ?? primaryInterval;\n const firstTick = Math.ceil(compassStart / step) * step;\n\n for (\n let compassDeg = firstTick;\n compassDeg <= compassEnd;\n compassDeg += step\n ) {\n const norm = normalizeAngle(compassDeg);\n const arcAngle = this._mapAngle(compassDeg);\n const isMain = norm % mainInterval === 0;\n const isPrimary = norm % primaryInterval === 0;\n\n if (isMain) {\n addTick(arcAngle, TickmarkType.main, Math.round(norm).toString());\n } else if (isPrimary) {\n addTick(arcAngle, TickmarkType.primary);\n } else {\n addTick(arcAngle, TickmarkType.secondary);\n }\n }\n\n return tickmarks;\n }\n\n // ---------------------------------------------------------------------------\n // ViewBox\n // ---------------------------------------------------------------------------\n\n /** Deepest crop the active features need, so none of them is shaved. */\n private _clipBottom(): number {\n const clips = [SECTOR_CLIP_BOTTOM];\n if (\n this.rotType !== undefined &&\n this.rotPosition === RotPosition.innerCircle\n ) {\n clips.push(SECTOR_CLIP_BOTTOM_ROT);\n }\n if (this.tickmarksInside) {\n clips.push(SECTOR_CLIP_BOTTOM_INSIDE_LABELS);\n }\n if (this.hasReadout) {\n clips.push(SECTOR_CLIP_BOTTOM_READOUT);\n }\n return Math.min(...clips);\n }\n\n /**\n * One frame per render, feeding both layers: the shared sector box cropped\n * to the arc. Zoom enlarges the arc rather than the window, so the window\n * only slides outward by the radius offset and the canvas holds still.\n */\n private _buildFrame(): RadialFrame {\n const frame = computeRadialFrame({\n basePadding: BASE_PADDING,\n labelWidthPx: this.tickmarksInside\n ? 0\n : estimateLabelWidthPx(this._cachedTickmarks.map((t) => t.text)),\n clips: {top: 0, bottom: this._clipBottom(), left: 0, right: 0},\n containerPx: measureContainerPx(this),\n });\n\n if (!this.zoomToFitArc) {\n return frame;\n }\n\n // Flatten the arc until its ends reach the same margin the 120° arc keeps,\n // measured off the window rather than the live heading — a frame fitted\n // where the arc currently points swings its box around the circle and the\n // arc drifts with it (#1152).\n const halfWidth = frame.width / 2 - SECTOR_SIDE_MARGIN;\n const sin = Math.sin(degToRad(this._arcHalfExtent));\n const radiusOffset = Math.max(0, halfWidth / sin - OUTER_RING_RADIUS);\n const y = frame.y - radiusOffset;\n return {\n ...frame,\n y,\n radiusOffset,\n viewBox: `${frame.x} ${y} ${frame.width} ${frame.height}`,\n };\n }\n\n // ---------------------------------------------------------------------------\n // North arrow — rendered in overlay at mapped 0° position\n // ---------------------------------------------------------------------------\n\n private _renderNorthArrow(rOff: number) {\n let northOffset = -this.heading;\n if (northOffset > 180) northOffset -= 360;\n else if (northOffset < -180) northOffset += 360;\n if (Math.abs(northOffset) > this._halfFOV) return nothing;\n\n const northArcAngle = this._mapAngle(0);\n const radius = OUTER_RING_RADIUS + rOff;\n return svg`\n <g transform=\"rotate(${northArcAngle}) translate(0, ${-radius})\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M-17.8457 24.984 0 0 17.8458 24.984C11.9868 24.3338 6.0324 24 0 24-6.0323 24-11.9867 24.3338-17.8457 24.984Z\"\n fill=\"var(--instrument-frame-tertiary-color)\"/>\n </g>\n `;\n }\n\n // ---------------------------------------------------------------------------\n // Priority & advice helpers\n // ---------------------------------------------------------------------------\n\n private _angleInRange(value: number, min: number, max: number): boolean {\n const v = normalizeAngle(value);\n const start = normalizeAngle(min);\n const end = normalizeAngle(max);\n return start <= end ? v >= start && v <= end : v >= start || v <= end;\n }\n\n private _buildAdvices(): AngleAdviceRaw[] {\n return this.headingAdvices.map(({minAngle, maxAngle, hinted, type}) => {\n const state = this._angleInRange(this.heading, minAngle, maxAngle)\n ? AdviceState.triggered\n : hinted\n ? AdviceState.hinted\n : AdviceState.regular;\n return {\n minAngle: this._mapAngle(minAngle),\n maxAngle: this._mapAngle(maxAngle),\n type,\n state,\n };\n });\n }\n\n private get _effectiveRotDegPerMin(): number {\n return this.rateOfTurnDegreesPerMinute ?? this.rotationsPerMinute;\n }\n\n private get _rotEndAngle(): number {\n const maxVal = this.rotMaxValue || 1;\n const barCompassDeg =\n (this._effectiveRotDegPerMin / maxVal) * ARC_HALF_EXTENT;\n return this._mapAngle(this.heading + barCompassDeg);\n }\n\n private priorityFor(element: CompassSectorPriorityElement): Priority {\n const selected = Array.isArray(this.priorityElements)\n ? this.priorityElements\n : [];\n return selected.includes(element) ? this.priority : Priority.regular;\n }\n\n /**\n * Vertical placement of the readout as a percentage of the frame height.\n *\n * The anchor sits halfway down the inner radius, below the arc's inner edge.\n * Zoom pushes that edge out by the radius offset, so the anchor follows it\n * and the gap under the arc reads the same in both modes.\n */\n private _readoutTopPercent(frame: RadialFrame): number {\n if (!frame.height) {\n return 50;\n }\n const anchorY = -INNER_RADIUS * 0.5 - frame.radiusOffset;\n return Math.round(((anchorY - frame.y) / frame.height) * 1000) / 10;\n }\n\n // ---------------------------------------------------------------------------\n // Render\n // ---------------------------------------------------------------------------\n\n override render() {\n const rotation = -this.heading;\n const frame = this._buildFrame();\n const viewBox = frame.viewBox;\n const rOff = frame.radiusOffset;\n // The overlay rotates its element box like obc-watch does, so it needs the\n // same pivot: the cropped frame's centre is not the compass centre.\n const pivotX = (-frame.x / frame.width) * 100;\n const pivotY = (-frame.y / frame.height) * 100;\n this._aspectWidth = frame.width;\n this._aspectHeight = frame.height;\n const tickmarks = frame.labelsHidden\n ? this._cachedTickmarks.map((t) => ({...t, text: undefined}))\n : this._cachedTickmarks;\n\n const mappedCOG = this._mapAngle(this.courseOverGround);\n const mappedSetpoint =\n this.headingSetpoint != null\n ? this._mapAngle(this.headingSetpoint)\n : undefined;\n const mappedNewSetpoint =\n this.newHeadingSetpoint != null\n ? this._mapAngle(this.newHeadingSetpoint)\n : undefined;\n\n return html`\n <div class=\"container\">\n <obc-watch\n .touching=${this.touching}\n .advices=${this._cachedAdvices}\n .tickmarks=${tickmarks}\n .tickmarkStyle=${TickmarkStyle.regular}\n .tickmarksInside=${this.tickmarksInside}\n .state=${this.state}\n .watchCircleType=${WATCH_TYPE}\n .northArrow=${false}\n .areas=${this._cachedAreas}\n .arcFrame=${frame}\n .tickFadeAngle=${this._arcHalfExtent * 0.2}\n .rotation=${rotation}\n .angleSetpoint=${mappedSetpoint}\n .newAngleSetpoint=${mappedNewSetpoint}\n .atAngleSetpoint=${this._headingSp.computeAtSetpoint(this.heading)}\n .angleSetpointAtZeroDeadband=${this.headingSetpointAtZeroDeadband}\n .setpointOverride=${this.headingSetpointOverride}\n .priority=${this.priority}\n .animateSetpoint=${this.animateSetpoint}\n .rotType=${this.rotType}\n .rotPosition=${this.rotPosition}\n .rotStartAngle=${this.heading}\n .rotEndAngle=${this._rotEndAngle}\n .rotPriority=${this.priorityFor(CompassSectorPriorityElement.rot)}\n .rotPortStarboard=${this.rotPortStarboard}\n .rotAtZeroDeadband=${this.rotAtZeroDeadband}\n .rateOfTurnDegreesPerMinute=${this.rateOfTurnDegreesPerMinute}\n .rotDotAnimationFactor=${this.rotDotAnimationFactor}\n .rotationsPerMinute=${this.rotationsPerMinute}\n >\n </obc-watch>\n <svg\n viewBox=\"${viewBox}\"\n transform=\"rotate(${rotation})\"\n style=\"transform-origin: ${pivotX}% ${pivotY}%\"\n >\n <g transform=\"rotate(${this.heading})\">\n <line\n x1=\"0\"\n y1=\"${-(SCALE_INNER_RADIUS + rOff)}\"\n x2=\"0\"\n y2=\"${-(INNER_RADIUS + rOff)}\"\n stroke=\"var(--instrument-frame-tertiary-color)\"\n stroke-width=\"1\"\n vector-effect=\"non-scaling-stroke\"\n />\n </g>\n ${this._renderNorthArrow(rOff)}\n ${arrow(\n ArrowStyle.HDG,\n this.heading,\n this.priorityFor(CompassSectorPriorityElement.hdg),\n rOff\n )}\n ${arrow(\n ArrowStyle.COG,\n mappedCOG,\n this.priorityFor(CompassSectorPriorityElement.cog),\n rOff\n )}\n </svg>\n ${\n this.hasReadout\n ? html`<div\n class=\"readout\"\n style=\"top: ${this._readoutTopPercent(frame)}%\"\n >\n ${renderCenterReadouts([\n {\n value: this.heading,\n label: this.label,\n unit: this.unit,\n fractionDigits: this.fractionDigits,\n size: ReadoutSize.large,\n priority: this.priorityFor(\n CompassSectorPriorityElement.hdg\n ),\n centerValue: true,\n centerMeta: true,\n },\n ])}\n </div>`\n : nothing\n }\n </div>\n `;\n }\n\n static override styles = [\n unsafeCSS(instrumentReadoutStyle),\n centerReadoutStyles,\n unsafeCSS(componentStyle),\n ];\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-compass-sector': ObcCompassSector;\n }\n}\n"],"names":["CompassSectorPriorityElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAo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zB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAzCb,iBAyCe,WAAA,SAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GA1Cb,iBA0Ce,WAAA,QAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GA3Cb,iBA2Ce,WAAA,kBAAA,CAAA;AA3Cf,mBAAN,gBAAA;AAAA,EADN,cAAc,oBAAoB;AAAA,GACtB,gBAAA;"}
|
|
@@ -27,12 +27,8 @@ const componentStyle = css`* {
|
|
|
27
27
|
|
|
28
28
|
position: relative;
|
|
29
29
|
|
|
30
|
-
/* The
|
|
31
|
-
|
|
32
|
-
stretches the block to the host width, then \`aspect-ratio\` + \`max-height\`
|
|
33
|
-
transfer the constraint back, shrinking it to fit a short host too — see
|
|
34
|
-
issue #992. The host always fills its container, so the gauge can be
|
|
35
|
-
positioned within the leftover space via the alignment classes below. */
|
|
30
|
+
/* The host always fills its container, so the gauge can be positioned within
|
|
31
|
+
the leftover space via the alignment classes below. */
|
|
36
32
|
width: auto;
|
|
37
33
|
height: auto;
|
|
38
34
|
max-width: 100%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gauge-radial.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gauge-radial.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
const componentStyle = css`* {
|
|
3
|
+
-webkit-tap-highlight-color: transparent;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
* {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.container {
|
|
11
|
+
position: relative;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.container > * {
|
|
17
|
+
position: absolute;
|
|
18
|
+
top: 0;
|
|
19
|
+
left: 0;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host {
|
|
25
|
+
display: block;
|
|
26
|
+
/* The element is the cropped canvas, not a square holding one, so the
|
|
27
|
+
aspect comes from the frame each render — the top crop and zoom both move
|
|
28
|
+
it. 448 / 269 is the un-zoomed box (448 wide × 448·(1 − 40%) tall); keep
|
|
29
|
+
in sync with the \`clips\` top in rudder.ts. */
|
|
30
|
+
width: auto;
|
|
31
|
+
height: auto;
|
|
32
|
+
max-width: 100%;
|
|
33
|
+
max-height: 100%;
|
|
34
|
+
aspect-ratio: var(--obc-rudder-aspect, 448 / 269);
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
export {
|
|
38
|
+
componentStyle as default
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=rudder.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rudder.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -96,6 +96,15 @@ export declare class ObcRudder extends ObcRudder_base {
|
|
|
96
96
|
private _resizeController;
|
|
97
97
|
firstUpdated(changed: PropertyValues): void;
|
|
98
98
|
updated(changed: PropertyValues): void;
|
|
99
|
+
/**
|
|
100
|
+
* Radial reach of the needle path about the watch centre, and its half
|
|
101
|
+
* width — the zoomed arc's own box stops short of the inner end.
|
|
102
|
+
*/
|
|
103
|
+
private static readonly NEEDLE_INNER_RADIUS;
|
|
104
|
+
private static readonly NEEDLE_OUTER_RADIUS;
|
|
105
|
+
private static readonly NEEDLE_HALF_WIDTH;
|
|
106
|
+
/** Box the zoomed frame must keep visible, in SVG units. */
|
|
107
|
+
private _needleIncludeBox;
|
|
99
108
|
private get _needleTransform();
|
|
100
109
|
getAngle(value: number): number;
|
|
101
110
|
get barColor(): "var(--instrument-regular-secondary-color)" | "var(--instrument-enhanced-secondary-color)" | "var(--instrument-frame-tertiary-color)" | "var(--instrument-regular-tertiary-color)" | "var(--instrument-enhanced-tertiary-color)";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rudder.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/rudder/rudder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"rudder.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/rudder/rudder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,cAAc,EAAQ,OAAO,EAAiB,MAAM,KAAK,CAAC;AAI9E,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAW,aAAa,EAAe,MAAM,sBAAsB,CAAC;AAE3E,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAc,WAAW,EAAiB,MAAM,oBAAoB,CAAC;AAa5E,oBAAY,gBAAgB;IAC1B,GAAG,QAAQ;IACX,MAAM,WAAW;CAClB;;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,qBACa,SAAU,SAAQ,cAAyB;IAC5B,KAAK,SAAK;IACV,OAAO,EAAE,gBAAgB,CAAwB;IACjD,QAAQ,SAAM;IACb,UAAU,EAAE,OAAO,CAAS;IAC5B,eAAe,EAAE,OAAO,CAAS;IAClC,KAAK,EAAE,eAAe,CAA0B;IAChD,QAAQ,EAAE,QAAQ,CAAoB;IACtC,aAAa,EAAE,aAAa,CAC9B;IACmB,OAAO,EAAE,WAAW,EAAE,CAAM;IAC5C,YAAY,EAAE,OAAO,CAAS;IAEzD,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,MAAM,CAA0B;IAExC,oEAAoE;IACpE,OAAO,CAAC,eAAe,CAAS;IAEhC,OAAO,CAAC,iBAAiB,CAAkC;IAElD,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAK3C,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAiB/C;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAS;IACpD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAU;IACrD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAQ;IAEjD,4DAA4D;IAC5D,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,KAAK,gBAAgB,GAM3B;IAED,QAAQ,CAAC,KAAK,EAAE,MAAM;IAItB,IAAI,QAAQ,qOAsBX;IAED,YAAY;IA0BH,MAAM;IA8If,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAC;KACzB;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { LitElement, nothing, svg, html,
|
|
1
|
+
import { LitElement, nothing, svg, html, unsafeCSS } from "lit";
|
|
2
2
|
import { property } from "lit/decorators.js";
|
|
3
|
+
import componentStyle from "./rudder.css.js";
|
|
3
4
|
import { ResizeController } from "@lit-labs/observers/resize-controller.js";
|
|
4
5
|
import { innerRingRadiusFor, WatchCircleType } from "../watch/watch.js";
|
|
5
6
|
import { TickmarkStyle, TickmarkType } from "../watch/tickmark.js";
|
|
@@ -7,7 +8,9 @@ import { InstrumentState, Priority } from "../types.js";
|
|
|
7
8
|
import { SetpointMixin } from "../../svghelpers/setpoint-mixin.js";
|
|
8
9
|
import { AdviceState } from "../watch/advice.js";
|
|
9
10
|
import { customElement } from "../../decorator.js";
|
|
10
|
-
import {
|
|
11
|
+
import { degToRad } from "../../svghelpers/math.js";
|
|
12
|
+
import { ArcFrameFit } from "../../svghelpers/arc-frame.js";
|
|
13
|
+
import { observeInnerBox, applyPinnedHostSize, measureContainerPx, estimateLabelWidthPx, computeRadialFrame } from "../../svghelpers/radial-frame.js";
|
|
11
14
|
var __defProp = Object.defineProperty;
|
|
12
15
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
16
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -46,12 +49,36 @@ let ObcRudder = class extends SetpointMixin(LitElement) {
|
|
|
46
49
|
}
|
|
47
50
|
updated(changed) {
|
|
48
51
|
super.updated(changed);
|
|
52
|
+
const frame = this._frame;
|
|
53
|
+
if (frame) {
|
|
54
|
+
this.style.setProperty(
|
|
55
|
+
"--obc-rudder-aspect",
|
|
56
|
+
`${frame.width} / ${frame.height}`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
49
59
|
this._hostSizePinned = applyPinnedHostSize(
|
|
50
60
|
this,
|
|
51
61
|
this._frame,
|
|
52
62
|
this._hostSizePinned
|
|
53
63
|
);
|
|
54
64
|
}
|
|
65
|
+
/** Box the zoomed frame must keep visible, in SVG units. */
|
|
66
|
+
_needleIncludeBox(radiusOffset) {
|
|
67
|
+
if (this.variant !== "needle") {
|
|
68
|
+
return void 0;
|
|
69
|
+
}
|
|
70
|
+
const rad = degToRad(this.getAngle(this.angle));
|
|
71
|
+
const u = { x: Math.sin(rad), y: -Math.cos(rad) };
|
|
72
|
+
const inner = ObcRudder.NEEDLE_INNER_RADIUS + radiusOffset;
|
|
73
|
+
const outer = ObcRudder.NEEDLE_OUTER_RADIUS + radiusOffset;
|
|
74
|
+
const w = ObcRudder.NEEDLE_HALF_WIDTH;
|
|
75
|
+
return {
|
|
76
|
+
xMin: Math.min(inner * u.x, outer * u.x) - w,
|
|
77
|
+
xMax: Math.max(inner * u.x, outer * u.x) + w,
|
|
78
|
+
yMin: Math.min(inner * u.y, outer * u.y) - w,
|
|
79
|
+
yMax: Math.max(inner * u.y, outer * u.y) + w
|
|
80
|
+
};
|
|
81
|
+
}
|
|
55
82
|
get _needleTransform() {
|
|
56
83
|
const rOff = this._radiusOffset;
|
|
57
84
|
if (rOff > 0) {
|
|
@@ -165,16 +192,21 @@ let ObcRudder = class extends SetpointMixin(LitElement) {
|
|
|
165
192
|
state
|
|
166
193
|
};
|
|
167
194
|
});
|
|
168
|
-
const
|
|
195
|
+
const frameOptions = {
|
|
169
196
|
basePadding: 48,
|
|
170
197
|
labelWidthPx: this.tickmarksInside ? 0 : estimateLabelWidthPx(tickmarks.map((t) => t.text)),
|
|
171
198
|
clips: this.zoomToFitArc ? void 0 : { top: 40, bottom: 0, left: 0, right: 0 },
|
|
172
199
|
containerPx: measureContainerPx(this),
|
|
173
200
|
faceDiameter: this.faceDiameter,
|
|
174
201
|
zoomToFitArc: this.zoomToFitArc,
|
|
202
|
+
// The zoomed arc is flat; a square box would be mostly empty height.
|
|
203
|
+
zoomFit: ArcFrameFit.bbox,
|
|
175
204
|
areas,
|
|
176
205
|
innerRadius: innerRingRadiusFor(WatchCircleType.double)
|
|
177
|
-
}
|
|
206
|
+
};
|
|
207
|
+
const probe = computeRadialFrame(frameOptions);
|
|
208
|
+
const zoomIncludeBox = this.zoomToFitArc ? this._needleIncludeBox(probe.radiusOffset) : void 0;
|
|
209
|
+
const frame = zoomIncludeBox ? computeRadialFrame({ ...frameOptions, zoomIncludeBox }) : probe;
|
|
178
210
|
this._radiusOffset = frame.radiusOffset;
|
|
179
211
|
this._frame = frame;
|
|
180
212
|
const shownTickmarks = frame.labelsHidden ? tickmarks.map((t) => ({ ...t, text: void 0 })) : tickmarks;
|
|
@@ -205,25 +237,10 @@ let ObcRudder = class extends SetpointMixin(LitElement) {
|
|
|
205
237
|
`;
|
|
206
238
|
}
|
|
207
239
|
};
|
|
208
|
-
ObcRudder.
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
.container {
|
|
214
|
-
position: relative;
|
|
215
|
-
width: 100%;
|
|
216
|
-
height: 100%;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.container > * {
|
|
220
|
-
position: absolute;
|
|
221
|
-
top: 0;
|
|
222
|
-
left: 0;
|
|
223
|
-
width: 100%;
|
|
224
|
-
height: 100%;
|
|
225
|
-
}
|
|
226
|
-
`;
|
|
240
|
+
ObcRudder.NEEDLE_INNER_RADIUS = -16.5;
|
|
241
|
+
ObcRudder.NEEDLE_OUTER_RADIUS = 160.65;
|
|
242
|
+
ObcRudder.NEEDLE_HALF_WIDTH = 16.5;
|
|
243
|
+
ObcRudder.styles = unsafeCSS(componentStyle);
|
|
227
244
|
__decorateClass([
|
|
228
245
|
property({ type: Number })
|
|
229
246
|
], ObcRudder.prototype, "angle", 2);
|