@oicl/openbridge-webcomponents 0.0.15-dev-20240915195432 → 0.0.15-dev-20240916185711
Sign up to get free protection for your applications and to get access to all the features.
- package/__snapshots__/navigation-instruments-azimuth-thruster--in-command-at-setpoint-disable-auto-setpoint.png +0 -0
- package/__snapshots__/navigation-instruments-azimuth-thruster--in-command-at-setpoint.png +0 -0
- package/__snapshots__/navigation-instruments-azimuth-thruster--in-command.png +0 -0
- package/__snapshots__/navigation-instruments-azimuth-thruster--pod.png +0 -0
- package/__snapshots__/navigation-instruments-azimuth-thruster--single-direction-with-propeller.png +0 -0
- package/__snapshots__/navigation-instruments-azimuth-thruster--single-direction.png +0 -0
- package/__snapshots__/navigation-instruments-azimuth-thruster-labeled--large.png +0 -0
- package/__snapshots__/navigation-instruments-main-engine--active.png +0 -0
- package/__snapshots__/navigation-instruments-main-engine--in-command.png +0 -0
- package/__snapshots__/navigation-instruments-main-engine--off.png +0 -0
- package/__snapshots__/navigation-instruments-thruster--tunnel.png +0 -0
- package/custom-elements.json +570 -7
- package/dist/navigation-instruments/azimuth-thruster/azimuth-thruster.d.ts.map +1 -1
- package/dist/navigation-instruments/azimuth-thruster/azimuth-thruster.js +2 -1
- package/dist/navigation-instruments/azimuth-thruster/azimuth-thruster.js.map +1 -1
- package/dist/navigation-instruments/main-engine/main-engine.css.js +22 -0
- package/dist/navigation-instruments/main-engine/main-engine.css.js.map +1 -0
- package/dist/navigation-instruments/main-engine/main-engine.d.ts +29 -0
- package/dist/navigation-instruments/main-engine/main-engine.d.ts.map +1 -0
- package/dist/navigation-instruments/main-engine/main-engine.js +196 -0
- package/dist/navigation-instruments/main-engine/main-engine.js.map +1 -0
- package/dist/navigation-instruments/thruster/thruster.d.ts +54 -1
- package/dist/navigation-instruments/thruster/thruster.d.ts.map +1 -1
- package/dist/navigation-instruments/thruster/thruster.js +163 -99
- package/dist/navigation-instruments/thruster/thruster.js.map +1 -1
- package/package.json +1 -1
- package/src/navigation-instruments/azimuth-thruster/azimuth-thruster.ts +1 -0
- package/src/navigation-instruments/main-engine/main-engine.css +17 -0
- package/src/navigation-instruments/main-engine/main-engine.stories.ts +54 -0
- package/src/navigation-instruments/main-engine/main-engine.ts +160 -0
- package/src/navigation-instruments/thruster/thruster.stories.ts +1 -0
- package/src/navigation-instruments/thruster/thruster.ts +205 -113
- package/src/palettes/variables.css +1343 -1343
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"azimuth-thruster.js","sources":["../../../src/navigation-instruments/azimuth-thruster/azimuth-thruster.ts"],"sourcesContent":["import {LitElement, svg, unsafeCSS} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport {InstrumentState} from '../types';\nimport {thruster} from '../thruster/thruster';\nimport '../watch/watch';\nimport componentStyle from './azimuth-thruster.css?inline';\nimport {ifDefined} from 'lit/directives/if-defined.js';\nimport {AdviceState, AngleAdvice, AngleAdviceRaw} from '../watch/advice';\nimport {Tickmark, TickmarkType} from '../watch/tickmark';\nimport {LinearAdvice} from '../thruster/advice';\nimport {PropellerType} from '../thruster/propeller';\n\nfunction mapAngle0to360(angle: number): number {\n const a = angle % 360;\n if (a >= 0) {\n return a;\n } else {\n return a + 360;\n }\n}\n\n@customElement('obc-azimuth-thruster')\nexport class ObcAzimuthThruster extends LitElement {\n @property({type: Number}) angle = 0;\n @property({type: Number}) angleSetpoint: number | undefined;\n @property({type: Boolean})\n atAngleSetpoint: boolean = false;\n @property({type: Boolean}) touching: boolean = false;\n @property({type: Boolean}) disableAutoAtAngleSetpoint: boolean = false;\n @property({type: Number}) autoAtAngleSetpointDeadband: number = 2;\n\n @property({type: Number}) thrust = 0;\n @property({type: Number}) thrustSetpoint: number | undefined;\n @property({type: Boolean})\n atThrustSetpoint: boolean = false;\n @property({type: Number}) thrustSetpointAtZeroDeadband: number = 0.1;\n @property({type: Boolean}) disableAutoAtThrustSetpoint: boolean = false;\n @property({type: Number}) autoAtThrustSetpointDeadband: number = 1;\n @property({type: String}) state: InstrumentState = InstrumentState.inCommand;\n @property({type: Number}) loading: number = 0;\n @property({type: Boolean}) noPadding: boolean = false;\n @property({type: Array, attribute: false}) angleAdvices: AngleAdvice[] = [];\n @property({type: Array, attribute: false}) thrustAdvices: LinearAdvice[] = [];\n @property({type: Boolean}) singleDirection: boolean = false;\n @property({type: String}) topPropeller: PropellerType = PropellerType.none;\n @property({type: String}) bottomPropeller: PropellerType = PropellerType.none;\n\n get atAngleSetpointCalc() {\n if (this.angleSetpoint === undefined) {\n return false;\n }\n\n if (this.touching) {\n return false;\n }\n\n if (!this.disableAutoAtAngleSetpoint) {\n return (\n Math.abs(this.angle - this.angleSetpoint) <\n this.autoAtAngleSetpointDeadband\n );\n }\n return this.atAngleSetpoint;\n }\n\n private get angleAdviceRaw(): AngleAdviceRaw[] {\n return this.angleAdvices.map((advice) => {\n const triggered =\n mapAngle0to360(this.angle) >= mapAngle0to360(advice.minAngle) &&\n mapAngle0to360(this.angle) <= mapAngle0to360(advice.maxAngle);\n let state: AdviceState;\n if (triggered) {\n state = AdviceState.triggered;\n } else if (advice.hinted) {\n state = AdviceState.hinted;\n } else {\n state = AdviceState.regular;\n }\n return {\n minAngle: advice.minAngle,\n maxAngle: advice.maxAngle,\n type: advice.type,\n state,\n };\n });\n }\n\n override render() {\n const rotateAngle = this.angle;\n\n const watchfaceTicksOn =\n this.state === InstrumentState.active ||\n this.state === InstrumentState.inCommand;\n\n let tickmarks: Tickmark[] = [];\n if (watchfaceTicksOn) {\n tickmarks = [\n {angle: 0, type: TickmarkType.main},\n {angle: 90, type: TickmarkType.primary},\n {angle: 180, type: TickmarkType.primary},\n {angle: 270, type: TickmarkType.primary},\n ];\n }\n\n const viewBox = this.noPadding ? '-192 -192 384 384' : '-200 -200 400 400';\n\n return svg`\n <div class=\"container\">\n <obc-watch \n .tickmarks=${tickmarks}\n .state=${this.state} \n .angleSetpoint=${this.angleSetpoint}\n .atAngleSetpoint=${this.atAngleSetpointCalc}\n .padding=${ifDefined(this.noPadding ? 16 : undefined)}\n .advices=${this.angleAdviceRaw}\n ></obc-watch>\n <svg viewBox=${viewBox} xmlns=\"http://www.w3.org/2000/svg\">\n <g transform=\"rotate(${rotateAngle})\">\n <svg width=\"320\" height=\"320\" y =\"-160\" x=\"-160\" viewBox=\"-160 -160 320 320\">\n ${thruster(this.thrust, this.thrustSetpoint, this.state, {\n atSetpoint: this.atThrustSetpoint,\n singleSided: true,\n singleDirection: false,\n singleDirectionHalfSize: this.singleDirection,\n tunnel: false,\n autoAtSetpoint: !this.disableAutoAtThrustSetpoint,\n autoSetpointDeadband: this.autoAtThrustSetpointDeadband,\n setpointAtZeroDeadband: this.thrustSetpointAtZeroDeadband,\n touching: this.touching,\n advices: this.thrustAdvices,\n topPropeller: this.topPropeller,\n bottomPropeller: this.bottomPropeller,\n })}\n </svg>\n </g>\n </svg>\n </div>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-azimuth-thruster': ObcAzimuthThruster;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAYA,SAAS,eAAe,OAAuB;AAC7C,QAAM,IAAI,QAAQ;AAClB,MAAI,KAAK,GAAG;AACH,WAAA;AAAA,EAAA,OACF;AACL,WAAO,IAAI;AAAA,EACb;AACF;AAGa,IAAA,qBAAN,cAAiC,WAAW;AAAA,EAA5C,cAAA;AAAA,UAAA,GAAA,SAAA;AAC6B,SAAA,QAAA;AAGP,SAAA,kBAAA;AACoB,SAAA,WAAA;AACkB,SAAA,6BAAA;AACD,SAAA,8BAAA;AAE7B,SAAA,SAAA;AAGP,SAAA,mBAAA;AACqC,SAAA,+BAAA;AACC,SAAA,8BAAA;AACD,SAAA,+BAAA;AACvC,SAAA,QAAyB,gBAAgB;AACvB,SAAA,UAAA;AACI,SAAA,YAAA;AACL,SAAA,eAA8B;AAC9B,SAAA,gBAAgC;AACrB,SAAA,kBAAA;AAC5B,SAAA,eAA8B,cAAc;AAC5C,SAAA,kBAAiC,cAAc;AAAA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ACF,KAAK,aAAa;AAAA,2BAChB,KAAK,mBAAmB;AAAA,mBAChC,UAAU,KAAK,YAAY,KAAK,MAAS,CAAC;AAAA,mBAC1C,KAAK,cAAc;AAAA;AAAA,qBAEjB,OAAO;AAAA,6BACC,WAAW;AAAA;AAAA,UAE9B,SAAS,KAAK,QAAQ,KAAK,gBAAgB,KAAK,OAAO;AAAA,MACvD,YAAY,KAAK;AAAA,MACjB,aAAa;AAAA,MACb,iBAAiB;AAAA,MACjB,yBAAyB,KAAK;AAAA,MAC9B,QAAQ;AAAA,MACR,gBAAgB,CAAC,KAAK;AAAA,MACtB,sBAAsB,KAAK;AAAA,MAC3B,wBAAwB,KAAK;AAAA,MAC7B,UAAU,KAAK;AAAA,MACf,SAAS,KAAK;AAAA,MACd,cAAc,KAAK;AAAA,MACnB,iBAAiB,KAAK;AAAA,IAAA,
|
1
|
+
{"version":3,"file":"azimuth-thruster.js","sources":["../../../src/navigation-instruments/azimuth-thruster/azimuth-thruster.ts"],"sourcesContent":["import {LitElement, svg, unsafeCSS} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport {InstrumentState} from '../types';\nimport {thruster} from '../thruster/thruster';\nimport '../watch/watch';\nimport componentStyle from './azimuth-thruster.css?inline';\nimport {ifDefined} from 'lit/directives/if-defined.js';\nimport {AdviceState, AngleAdvice, AngleAdviceRaw} from '../watch/advice';\nimport {Tickmark, TickmarkType} from '../watch/tickmark';\nimport {LinearAdvice} from '../thruster/advice';\nimport {PropellerType} from '../thruster/propeller';\n\nfunction mapAngle0to360(angle: number): number {\n const a = angle % 360;\n if (a >= 0) {\n return a;\n } else {\n return a + 360;\n }\n}\n\n@customElement('obc-azimuth-thruster')\nexport class ObcAzimuthThruster extends LitElement {\n @property({type: Number}) angle = 0;\n @property({type: Number}) angleSetpoint: number | undefined;\n @property({type: Boolean})\n atAngleSetpoint: boolean = false;\n @property({type: Boolean}) touching: boolean = false;\n @property({type: Boolean}) disableAutoAtAngleSetpoint: boolean = false;\n @property({type: Number}) autoAtAngleSetpointDeadband: number = 2;\n\n @property({type: Number}) thrust = 0;\n @property({type: Number}) thrustSetpoint: number | undefined;\n @property({type: Boolean})\n atThrustSetpoint: boolean = false;\n @property({type: Number}) thrustSetpointAtZeroDeadband: number = 0.1;\n @property({type: Boolean}) disableAutoAtThrustSetpoint: boolean = false;\n @property({type: Number}) autoAtThrustSetpointDeadband: number = 1;\n @property({type: String}) state: InstrumentState = InstrumentState.inCommand;\n @property({type: Number}) loading: number = 0;\n @property({type: Boolean}) noPadding: boolean = false;\n @property({type: Array, attribute: false}) angleAdvices: AngleAdvice[] = [];\n @property({type: Array, attribute: false}) thrustAdvices: LinearAdvice[] = [];\n @property({type: Boolean}) singleDirection: boolean = false;\n @property({type: String}) topPropeller: PropellerType = PropellerType.none;\n @property({type: String}) bottomPropeller: PropellerType = PropellerType.none;\n\n get atAngleSetpointCalc() {\n if (this.angleSetpoint === undefined) {\n return false;\n }\n\n if (this.touching) {\n return false;\n }\n\n if (!this.disableAutoAtAngleSetpoint) {\n return (\n Math.abs(this.angle - this.angleSetpoint) <\n this.autoAtAngleSetpointDeadband\n );\n }\n return this.atAngleSetpoint;\n }\n\n private get angleAdviceRaw(): AngleAdviceRaw[] {\n return this.angleAdvices.map((advice) => {\n const triggered =\n mapAngle0to360(this.angle) >= mapAngle0to360(advice.minAngle) &&\n mapAngle0to360(this.angle) <= mapAngle0to360(advice.maxAngle);\n let state: AdviceState;\n if (triggered) {\n state = AdviceState.triggered;\n } else if (advice.hinted) {\n state = AdviceState.hinted;\n } else {\n state = AdviceState.regular;\n }\n return {\n minAngle: advice.minAngle,\n maxAngle: advice.maxAngle,\n type: advice.type,\n state,\n };\n });\n }\n\n override render() {\n const rotateAngle = this.angle;\n\n const watchfaceTicksOn =\n this.state === InstrumentState.active ||\n this.state === InstrumentState.inCommand;\n\n let tickmarks: Tickmark[] = [];\n if (watchfaceTicksOn) {\n tickmarks = [\n {angle: 0, type: TickmarkType.main},\n {angle: 90, type: TickmarkType.primary},\n {angle: 180, type: TickmarkType.primary},\n {angle: 270, type: TickmarkType.primary},\n ];\n }\n\n const viewBox = this.noPadding ? '-192 -192 384 384' : '-200 -200 400 400';\n\n return svg`\n <div class=\"container\">\n <obc-watch \n .tickmarks=${tickmarks}\n .state=${this.state} \n .angleSetpoint=${this.angleSetpoint}\n .atAngleSetpoint=${this.atAngleSetpointCalc}\n .padding=${ifDefined(this.noPadding ? 16 : undefined)}\n .advices=${this.angleAdviceRaw}\n ></obc-watch>\n <svg viewBox=${viewBox} xmlns=\"http://www.w3.org/2000/svg\">\n <g transform=\"rotate(${rotateAngle})\">\n <svg width=\"320\" height=\"320\" y =\"-160\" x=\"-160\" viewBox=\"-160 -160 320 320\">\n ${thruster(this.thrust, this.thrustSetpoint, this.state, {\n atSetpoint: this.atThrustSetpoint,\n singleSided: true,\n singleDirection: false,\n singleDirectionHalfSize: this.singleDirection,\n tunnel: false,\n autoAtSetpoint: !this.disableAutoAtThrustSetpoint,\n autoSetpointDeadband: this.autoAtThrustSetpointDeadband,\n setpointAtZeroDeadband: this.thrustSetpointAtZeroDeadband,\n touching: this.touching,\n advices: this.thrustAdvices,\n topPropeller: this.topPropeller,\n bottomPropeller: this.bottomPropeller,\n narrow: true,\n })}\n </svg>\n </g>\n </svg>\n </div>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-azimuth-thruster': ObcAzimuthThruster;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAYA,SAAS,eAAe,OAAuB;AAC7C,QAAM,IAAI,QAAQ;AAClB,MAAI,KAAK,GAAG;AACH,WAAA;AAAA,EAAA,OACF;AACL,WAAO,IAAI;AAAA,EACb;AACF;AAGa,IAAA,qBAAN,cAAiC,WAAW;AAAA,EAA5C,cAAA;AAAA,UAAA,GAAA,SAAA;AAC6B,SAAA,QAAA;AAGP,SAAA,kBAAA;AACoB,SAAA,WA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AA,GApB9B,mBAoBgC,WAAA,iBAAA,CAAA;AAChB,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GArBd,mBAqBgB,WAAA,mBAAA,CAAA;AACD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAtBb,mBAsBe,WAAA,gBAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAvBb,mBAuBe,WAAA,mBAAA,CAAA;AAvBf,qBAAN,gBAAA;AAAA,EADN,cAAc,sBAAsB;AAAA,GACxB,kBAAA;"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { css } from "lit";
|
2
|
+
const compentStyle = css`* {
|
3
|
+
box-sizing: border-box;
|
4
|
+
}
|
5
|
+
|
6
|
+
.container {
|
7
|
+
position: relative;
|
8
|
+
width: 100%;
|
9
|
+
height: 100%;
|
10
|
+
}
|
11
|
+
|
12
|
+
.container>* {
|
13
|
+
position: absolute;
|
14
|
+
top: 0;
|
15
|
+
left: 0;
|
16
|
+
width: 100%;
|
17
|
+
height: 100%;
|
18
|
+
}`;
|
19
|
+
export {
|
20
|
+
compentStyle as default
|
21
|
+
};
|
22
|
+
//# sourceMappingURL=main-engine.css.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"main-engine.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { LitElement } from 'lit';
|
2
|
+
import { InstrumentState } from '../types';
|
3
|
+
import { LinearAdvice } from '../thruster/advice';
|
4
|
+
export declare class ObcMainEngine extends LitElement {
|
5
|
+
thrust: number;
|
6
|
+
thrustSetpoint: number | undefined;
|
7
|
+
thrustTouching: boolean;
|
8
|
+
atThrustSetpoint: boolean;
|
9
|
+
speed: number;
|
10
|
+
speedSetpoint: number | undefined;
|
11
|
+
speedTouching: boolean;
|
12
|
+
atSpeedSetpoint: boolean;
|
13
|
+
disableAutoAtThrustSetpoint: boolean;
|
14
|
+
disableAutoAtSpeedSetpoint: boolean;
|
15
|
+
autoAtThrustSetpointDeadband: number;
|
16
|
+
autoAtSpeedSetpointDeadband: number;
|
17
|
+
thrustSetpointAtZeroDeadband: number;
|
18
|
+
speedSetpointAtZeroDeadband: number;
|
19
|
+
state: InstrumentState;
|
20
|
+
thrustAdvices: LinearAdvice[];
|
21
|
+
render(): import("lit-html").TemplateResult<1>;
|
22
|
+
static styles: import("lit").CSSResult;
|
23
|
+
}
|
24
|
+
declare global {
|
25
|
+
interface HTMLElementTagNameMap {
|
26
|
+
'obc-main-engine': ObcMainEngine;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
//# sourceMappingURL=main-engine.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"main-engine.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/main-engine/main-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAgC,MAAM,KAAK,CAAC;AAG9D,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAQzC,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAEhD,qBACa,aAAc,SAAQ,UAAU;IACjB,MAAM,EAAE,MAAM,CAAK;IACnB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,cAAc,EAAE,OAAO,CAAS;IAChC,gBAAgB,EAAE,OAAO,CAAS;IACnC,KAAK,EAAE,MAAM,CAAK;IAClB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,aAAa,EAAE,OAAO,CAAS;IAC/B,eAAe,EAAE,OAAO,CAAS;IACjC,2BAA2B,EAAE,OAAO,CAAS;IAC7C,0BAA0B,EAAE,OAAO,CAAS;IAC7C,4BAA4B,EAAE,MAAM,CAAK;IACzC,2BAA2B,EAAE,MAAM,CAAK;IACxC,4BAA4B,EAAE,MAAM,CAAO;IAC3C,2BAA2B,EAAE,MAAM,CAAO;IAC1C,KAAK,EAAE,eAAe,CAA6B;IACpD,aAAa,EAAE,YAAY,EAAE,CAAM;IAEnD,MAAM;IAwHf,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,aAAa,CAAC;KAClC;CACF"}
|
@@ -0,0 +1,196 @@
|
|
1
|
+
import { unsafeCSS, LitElement, svg, nothing, html } from "lit";
|
2
|
+
import { property, customElement } from "lit/decorators.js";
|
3
|
+
import compentStyle from "./main-engine.css.js";
|
4
|
+
import { InstrumentState } from "../types.js";
|
5
|
+
import { atSetpoint, thrusterColors, convertThrustAdvices, thrusterTopSingleSided, setpointSvg } from "../thruster/thruster.js";
|
6
|
+
var __defProp = Object.defineProperty;
|
7
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
8
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
9
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
10
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
11
|
+
if (decorator = decorators[i])
|
12
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
13
|
+
if (kind && result)
|
14
|
+
__defProp(target, key, result);
|
15
|
+
return result;
|
16
|
+
};
|
17
|
+
let ObcMainEngine = class extends LitElement {
|
18
|
+
constructor() {
|
19
|
+
super(...arguments);
|
20
|
+
this.thrust = 0;
|
21
|
+
this.thrustTouching = false;
|
22
|
+
this.atThrustSetpoint = false;
|
23
|
+
this.speed = 0;
|
24
|
+
this.speedTouching = false;
|
25
|
+
this.atSpeedSetpoint = false;
|
26
|
+
this.disableAutoAtThrustSetpoint = false;
|
27
|
+
this.disableAutoAtSpeedSetpoint = false;
|
28
|
+
this.autoAtThrustSetpointDeadband = 1;
|
29
|
+
this.autoAtSpeedSetpointDeadband = 1;
|
30
|
+
this.thrustSetpointAtZeroDeadband = 0.5;
|
31
|
+
this.speedSetpointAtZeroDeadband = 0.5;
|
32
|
+
this.state = InstrumentState.inCommand;
|
33
|
+
this.thrustAdvices = [];
|
34
|
+
}
|
35
|
+
render() {
|
36
|
+
const thrustSetpointAtZero = Math.abs(this.thrustSetpoint || 0) < this.thrustSetpointAtZeroDeadband;
|
37
|
+
const speedSetpointAtZero = Math.abs(this.speedSetpoint || 0) < this.speedSetpointAtZeroDeadband;
|
38
|
+
const thrustAtSetpoint = atSetpoint(this.thrust, this.thrustSetpoint, {
|
39
|
+
atSetpoint: this.atThrustSetpoint,
|
40
|
+
autoAtSetpoint: !this.disableAutoAtThrustSetpoint,
|
41
|
+
autoSetpointDeadband: this.autoAtThrustSetpointDeadband,
|
42
|
+
touching: this.thrustTouching
|
43
|
+
});
|
44
|
+
const cThrust = thrusterColors(
|
45
|
+
{
|
46
|
+
atSetpoint: thrustAtSetpoint,
|
47
|
+
touching: this.thrustTouching
|
48
|
+
},
|
49
|
+
this.state
|
50
|
+
);
|
51
|
+
const speedAtSetpoint = atSetpoint(this.speed, this.speedSetpoint, {
|
52
|
+
atSetpoint: this.atSpeedSetpoint,
|
53
|
+
autoAtSetpoint: !this.disableAutoAtSpeedSetpoint,
|
54
|
+
autoSetpointDeadband: this.autoAtSpeedSetpointDeadband,
|
55
|
+
touching: this.speedTouching
|
56
|
+
});
|
57
|
+
const cSpeed = thrusterColors(
|
58
|
+
{
|
59
|
+
atSetpoint: speedAtSetpoint,
|
60
|
+
touching: this.speedTouching
|
61
|
+
},
|
62
|
+
this.state
|
63
|
+
);
|
64
|
+
const container = svg`<rect x="-80" y="-176" width="160" height="352" fill="var(--instrument-frame-primary-color)" stroke="var(--instrument-frame-tertiary-color)" rx="8"/>`;
|
65
|
+
const border = svg`<rect x="-80" y="-176" width="160" height="352" fill="none" stroke="var(--instrument-frame-tertiary-color)" rx="8" vector-effect="non-scaling-stroke"/>`;
|
66
|
+
const frameLeft = svg`<rect x="-56" y="-176" width="48" height="352" fill="var(--instrument-frame-secondary-color)" vector-effect="non-scaling-stroke" stroke="var(--instrument-frame-secondary-color)"/>`;
|
67
|
+
const frameRight = svg`<rect x="8" y="-176" width="48" height="352" fill="var(--instrument-frame-secondary-color)" vector-effect="non-scaling-stroke" stroke="var(--instrument-frame-secondary-color)"/>`;
|
68
|
+
const thrustCenter = svg`<rect x="8" y="-2" height="4" width="72" fill="${cThrust.zeroLineColor}" stroke=${cThrust.zeroLineColor} vector-effect="non-scaling-stroke"/>`;
|
69
|
+
const { topAdvices: topThrustAdvice, bottomAdvices: bottomThrustAdvice } = convertThrustAdvices(this.thrustAdvices, this.thrust);
|
70
|
+
const thrustTop = svg`<g transform="translate(44, 0)">
|
71
|
+
${thrusterTopSingleSided(
|
72
|
+
174,
|
73
|
+
Math.max(this.thrust, 0),
|
74
|
+
{ box: cThrust.boxColor, container: "" },
|
75
|
+
{
|
76
|
+
hideContainer: true,
|
77
|
+
hideTicks: cThrust.hideTicks,
|
78
|
+
flipAdicePattern: false,
|
79
|
+
narrow: false
|
80
|
+
},
|
81
|
+
topThrustAdvice
|
82
|
+
)}</g>`;
|
83
|
+
const thrusterBottom = svg`<g transform="rotate(180) scale(-1,1) translate(44)">
|
84
|
+
${thrusterTopSingleSided(
|
85
|
+
174,
|
86
|
+
Math.max(-this.thrust, 0),
|
87
|
+
{ box: cThrust.boxColor, container: "" },
|
88
|
+
{
|
89
|
+
hideContainer: true,
|
90
|
+
hideTicks: cThrust.hideTicks,
|
91
|
+
flipAdicePattern: false,
|
92
|
+
narrow: false
|
93
|
+
},
|
94
|
+
bottomThrustAdvice
|
95
|
+
)}</g>`;
|
96
|
+
const thrustSetpoint = this.thrustSetpoint !== void 0 ? svg`<g transform="translate(44, 0)">${setpointSvg(
|
97
|
+
174,
|
98
|
+
this.thrustSetpoint,
|
99
|
+
thrustSetpointAtZero,
|
100
|
+
{
|
101
|
+
fill: cThrust.setPointColor,
|
102
|
+
stroke: "var(--border-silhouette-color)"
|
103
|
+
},
|
104
|
+
{
|
105
|
+
inCommand: this.state === InstrumentState.inCommand,
|
106
|
+
singleSided: true,
|
107
|
+
narrow: false
|
108
|
+
}
|
109
|
+
)}</g>` : nothing;
|
110
|
+
const speedHeight = 352 * (this.speed / 100) + 2;
|
111
|
+
const speedY = 176 - speedHeight;
|
112
|
+
const speedBoxColor = this.state === InstrumentState.inCommand ? "var(--instrument-enhanced-tertiary-color)" : "var(--instrument-regular-tertiary-color)";
|
113
|
+
const speedBox = svg`<rect x="-56" y=${speedY} width="48" height=${speedHeight} fill=${speedBoxColor} stroke=${speedBoxColor} vector-effect="non-scaling-stroke">`;
|
114
|
+
const speedLine = svg`<rect x="-56" y=${speedY - 2} width="48" height="4" rx="2" fill=${cSpeed.boxColor} stroke=${cSpeed.boxColor}/>
|
115
|
+
`;
|
116
|
+
const speedSetpoint = this.speedSetpoint !== void 0 ? svg`<g transform="scale(-1 1) translate(44, 176)">${setpointSvg(
|
117
|
+
350,
|
118
|
+
this.speedSetpoint,
|
119
|
+
speedSetpointAtZero,
|
120
|
+
{
|
121
|
+
fill: cSpeed.setPointColor,
|
122
|
+
stroke: "var(--border-silhouette-color)"
|
123
|
+
},
|
124
|
+
{
|
125
|
+
inCommand: this.state === InstrumentState.inCommand,
|
126
|
+
singleSided: true,
|
127
|
+
narrow: false
|
128
|
+
}
|
129
|
+
)}</g>` : nothing;
|
130
|
+
return html`
|
131
|
+
<div class="container">
|
132
|
+
<svg viewbox="-100 -200 200 400">
|
133
|
+
${container} ${frameLeft} ${frameRight} ${thrustCenter} ${thrustTop}
|
134
|
+
${thrusterBottom} ${speedBox} ${speedLine} ${border} ${thrustSetpoint}
|
135
|
+
${speedSetpoint}
|
136
|
+
</svg>
|
137
|
+
</div>
|
138
|
+
`;
|
139
|
+
}
|
140
|
+
};
|
141
|
+
ObcMainEngine.styles = unsafeCSS(compentStyle);
|
142
|
+
__decorateClass([
|
143
|
+
property({ type: Number })
|
144
|
+
], ObcMainEngine.prototype, "thrust", 2);
|
145
|
+
__decorateClass([
|
146
|
+
property({ type: Number })
|
147
|
+
], ObcMainEngine.prototype, "thrustSetpoint", 2);
|
148
|
+
__decorateClass([
|
149
|
+
property({ type: Boolean })
|
150
|
+
], ObcMainEngine.prototype, "thrustTouching", 2);
|
151
|
+
__decorateClass([
|
152
|
+
property({ type: Boolean })
|
153
|
+
], ObcMainEngine.prototype, "atThrustSetpoint", 2);
|
154
|
+
__decorateClass([
|
155
|
+
property({ type: Number })
|
156
|
+
], ObcMainEngine.prototype, "speed", 2);
|
157
|
+
__decorateClass([
|
158
|
+
property({ type: Number })
|
159
|
+
], ObcMainEngine.prototype, "speedSetpoint", 2);
|
160
|
+
__decorateClass([
|
161
|
+
property({ type: Boolean })
|
162
|
+
], ObcMainEngine.prototype, "speedTouching", 2);
|
163
|
+
__decorateClass([
|
164
|
+
property({ type: Boolean })
|
165
|
+
], ObcMainEngine.prototype, "atSpeedSetpoint", 2);
|
166
|
+
__decorateClass([
|
167
|
+
property({ type: Boolean })
|
168
|
+
], ObcMainEngine.prototype, "disableAutoAtThrustSetpoint", 2);
|
169
|
+
__decorateClass([
|
170
|
+
property({ type: Boolean })
|
171
|
+
], ObcMainEngine.prototype, "disableAutoAtSpeedSetpoint", 2);
|
172
|
+
__decorateClass([
|
173
|
+
property({ type: Number })
|
174
|
+
], ObcMainEngine.prototype, "autoAtThrustSetpointDeadband", 2);
|
175
|
+
__decorateClass([
|
176
|
+
property({ type: Number })
|
177
|
+
], ObcMainEngine.prototype, "autoAtSpeedSetpointDeadband", 2);
|
178
|
+
__decorateClass([
|
179
|
+
property({ type: Number })
|
180
|
+
], ObcMainEngine.prototype, "thrustSetpointAtZeroDeadband", 2);
|
181
|
+
__decorateClass([
|
182
|
+
property({ type: Number })
|
183
|
+
], ObcMainEngine.prototype, "speedSetpointAtZeroDeadband", 2);
|
184
|
+
__decorateClass([
|
185
|
+
property({ type: String })
|
186
|
+
], ObcMainEngine.prototype, "state", 2);
|
187
|
+
__decorateClass([
|
188
|
+
property({ type: Array })
|
189
|
+
], ObcMainEngine.prototype, "thrustAdvices", 2);
|
190
|
+
ObcMainEngine = __decorateClass([
|
191
|
+
customElement("obc-main-engine")
|
192
|
+
], ObcMainEngine);
|
193
|
+
export {
|
194
|
+
ObcMainEngine
|
195
|
+
};
|
196
|
+
//# sourceMappingURL=main-engine.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"main-engine.js","sources":["../../../src/navigation-instruments/main-engine/main-engine.ts"],"sourcesContent":["import {LitElement, html, unsafeCSS, svg, nothing} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport compentStyle from './main-engine.css?inline';\nimport {InstrumentState} from '../types';\nimport {\n atSetpoint,\n convertThrustAdvices,\n thrusterColors,\n thrusterTopSingleSided,\n setpointSvg,\n} from '../thruster/thruster';\nimport {LinearAdvice} from '../thruster/advice';\n\n@customElement('obc-main-engine')\nexport class ObcMainEngine extends LitElement {\n @property({type: Number}) thrust: number = 0;\n @property({type: Number}) thrustSetpoint: number | undefined;\n @property({type: Boolean}) thrustTouching: boolean = false;\n @property({type: Boolean}) atThrustSetpoint: boolean = false;\n @property({type: Number}) speed: number = 0;\n @property({type: Number}) speedSetpoint: number | undefined;\n @property({type: Boolean}) speedTouching: boolean = false;\n @property({type: Boolean}) atSpeedSetpoint: boolean = false;\n @property({type: Boolean}) disableAutoAtThrustSetpoint: boolean = false;\n @property({type: Boolean}) disableAutoAtSpeedSetpoint: boolean = false;\n @property({type: Number}) autoAtThrustSetpointDeadband: number = 1;\n @property({type: Number}) autoAtSpeedSetpointDeadband: number = 1;\n @property({type: Number}) thrustSetpointAtZeroDeadband: number = 0.5;\n @property({type: Number}) speedSetpointAtZeroDeadband: number = 0.5;\n @property({type: String}) state: InstrumentState = InstrumentState.inCommand;\n @property({type: Array}) thrustAdvices: LinearAdvice[] = [];\n\n override render() {\n const thrustSetpointAtZero =\n Math.abs(this.thrustSetpoint || 0) < this.thrustSetpointAtZeroDeadband;\n const speedSetpointAtZero =\n Math.abs(this.speedSetpoint || 0) < this.speedSetpointAtZeroDeadband;\n const thrustAtSetpoint = atSetpoint(this.thrust, this.thrustSetpoint, {\n atSetpoint: this.atThrustSetpoint,\n autoAtSetpoint: !this.disableAutoAtThrustSetpoint,\n autoSetpointDeadband: this.autoAtThrustSetpointDeadband,\n touching: this.thrustTouching,\n });\n const cThrust = thrusterColors(\n {\n atSetpoint: thrustAtSetpoint,\n touching: this.thrustTouching,\n },\n this.state\n );\n const speedAtSetpoint = atSetpoint(this.speed, this.speedSetpoint, {\n atSetpoint: this.atSpeedSetpoint,\n autoAtSetpoint: !this.disableAutoAtSpeedSetpoint,\n autoSetpointDeadband: this.autoAtSpeedSetpointDeadband,\n touching: this.speedTouching,\n });\n const cSpeed = thrusterColors(\n {\n atSetpoint: speedAtSetpoint,\n touching: this.speedTouching,\n },\n this.state\n );\n const container = svg`<rect x=\"-80\" y=\"-176\" width=\"160\" height=\"352\" fill=\"var(--instrument-frame-primary-color)\" stroke=\"var(--instrument-frame-tertiary-color)\" rx=\"8\"/>`;\n const border = svg`<rect x=\"-80\" y=\"-176\" width=\"160\" height=\"352\" fill=\"none\" stroke=\"var(--instrument-frame-tertiary-color)\" rx=\"8\" vector-effect=\"non-scaling-stroke\"/>`;\n const frameLeft = svg`<rect x=\"-56\" y=\"-176\" width=\"48\" height=\"352\" fill=\"var(--instrument-frame-secondary-color)\" vector-effect=\"non-scaling-stroke\" stroke=\"var(--instrument-frame-secondary-color)\"/>`;\n const frameRight = svg`<rect x=\"8\" y=\"-176\" width=\"48\" height=\"352\" fill=\"var(--instrument-frame-secondary-color)\" vector-effect=\"non-scaling-stroke\" stroke=\"var(--instrument-frame-secondary-color)\"/>`;\n const thrustCenter = svg`<rect x=\"8\" y=\"-2\" height=\"4\" width=\"72\" fill=\"${cThrust.zeroLineColor}\" stroke=${cThrust.zeroLineColor} vector-effect=\"non-scaling-stroke\"/>`;\n const {topAdvices: topThrustAdvice, bottomAdvices: bottomThrustAdvice} =\n convertThrustAdvices(this.thrustAdvices, this.thrust);\n const thrustTop = svg`<g transform=\"translate(44, 0)\">\n ${thrusterTopSingleSided(\n 174,\n Math.max(this.thrust, 0),\n {box: cThrust.boxColor, container: ''},\n {\n hideContainer: true,\n hideTicks: cThrust.hideTicks,\n flipAdicePattern: false,\n narrow: false,\n },\n topThrustAdvice\n )}</g>`;\n const thrusterBottom = svg`<g transform=\"rotate(180) scale(-1,1) translate(44)\">\n ${thrusterTopSingleSided(\n 174,\n Math.max(-this.thrust, 0),\n {box: cThrust.boxColor, container: ''},\n {\n hideContainer: true,\n hideTicks: cThrust.hideTicks,\n flipAdicePattern: false,\n narrow: false,\n },\n bottomThrustAdvice\n )}</g>`;\n const thrustSetpoint =\n this.thrustSetpoint !== undefined\n ? svg`<g transform=\"translate(44, 0)\">${setpointSvg(\n 174,\n this.thrustSetpoint,\n thrustSetpointAtZero,\n {\n fill: cThrust.setPointColor,\n stroke: 'var(--border-silhouette-color)',\n },\n {\n inCommand: this.state === InstrumentState.inCommand,\n singleSided: true,\n narrow: false,\n }\n )}</g>`\n : nothing;\n\n const speedHeight = 352 * (this.speed / 100) + 2;\n const speedY = 176 - speedHeight;\n const speedBoxColor =\n this.state === InstrumentState.inCommand\n ? 'var(--instrument-enhanced-tertiary-color)'\n : 'var(--instrument-regular-tertiary-color)';\n const speedBox = svg`<rect x=\"-56\" y=${speedY} width=\"48\" height=${speedHeight} fill=${speedBoxColor} stroke=${speedBoxColor} vector-effect=\"non-scaling-stroke\">`;\n const speedLine = svg`<rect x=\"-56\" y=${speedY - 2} width=\"48\" height=\"4\" rx=\"2\" fill=${cSpeed.boxColor} stroke=${cSpeed.boxColor}/>\n`;\n const speedSetpoint =\n this.speedSetpoint !== undefined\n ? svg`<g transform=\"scale(-1 1) translate(44, 176)\">${setpointSvg(\n 350,\n this.speedSetpoint,\n speedSetpointAtZero,\n {\n fill: cSpeed.setPointColor,\n stroke: 'var(--border-silhouette-color)',\n },\n {\n inCommand: this.state === InstrumentState.inCommand,\n singleSided: true,\n narrow: false,\n }\n )}</g>`\n : nothing;\n\n return html`\n <div class=\"container\">\n <svg viewbox=\"-100 -200 200 400\">\n ${container} ${frameLeft} ${frameRight} ${thrustCenter} ${thrustTop}\n ${thrusterBottom} ${speedBox} ${speedLine} ${border} ${thrustSetpoint}\n ${speedSetpoint}\n </svg>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-main-engine': ObcMainEngine;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAca,IAAA,gBAAN,cAA4B,WAAW;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACsC,SAAA,SAAA;AAEU,SAAA,iBAAA;AACE,SAAA,mBAAA;AACb,SAAA,QAAA;AAEU,SAAA,gBAAA;AACE,SAAA,kBAAA;AACY,SAAA,8BAAA;AACD,SAAA,6BAAA;AACA,SAAA,+BAAA;AACD,SAAA,8BAAA;AACC,SAAA,+BAAA;AACD,SAAA,8BAAA;AACtC,SAAA,QAAyB,gBAAgB;AAC1C,SAAA,gBAAgC;EAAC;AAAA,EAEjD,SAAS;AAChB,UAAM,uBACJ,KAAK,IAAI,KAAK,kBAAkB,CAAC,IAAI,KAAK;AAC5C,UAAM,sBACJ,KAAK,IAAI,KAAK,iBAAiB,CAAC,IAAI,KAAK;AAC3C,UAAM,mBAAmB,WAAW,KAAK,QAAQ,KAAK,gBAAgB;AAAA,MACpE,YAAY,KAAK;AAAA,MACjB,gBAAgB,CAAC,KAAK;AAAA,MACtB,sBAAsB,KAAK;AAAA,MAC3B,UAAU,KAAK;AAAA,IAAA,CAChB;AACD,UAAM,UAAU;AAAA,MACd;AAAA,QACE,YAAY;AAAA,QACZ,UAAU,KAAK;AAAA,MACjB;AAAA,MACA,KAAK;AAAA,IAAA;AAEP,UAAM,kBAAkB,WAAW,KAAK,OAAO,KAAK,eAAe;AAAA,MACjE,YAAY,KAAK;AAAA,MACjB,gBAAgB,CAAC,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AC,MAAM,QAAO;AAAA,GANb,cAMe,WAAA,iBAAA,CAAA;AACC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GAPd,cAOgB,WAAA,iBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GARd,cAQgB,WAAA,mBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GATd,cASgB,WAAA,+BAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GAVd,cAUgB,WAAA,8BAAA,CAAA;AACD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAXb,cAWe,WAAA,gCAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAZb,cAYe,WAAA,+BAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAbb,cAae,WAAA,gCAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAdb,cAce,WAAA,+BAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAfb,cAee,WAAA,SAAA,CAAA;AACD,gBAAA;AAAA,EAAxB,SAAS,EAAC,MAAM,OAAM;AAAA,GAhBZ,cAgBc,WAAA,iBAAA,CAAA;AAhBd,gBAAN,gBAAA;AAAA,EADN,cAAc,iBAAiB;AAAA,GACnB,aAAA;"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { LitElement } from 'lit';
|
2
2
|
import { InstrumentState } from '../types';
|
3
|
-
import { LinearAdvice } from './advice';
|
3
|
+
import { LinearAdvice, LinearAdviceRaw } from './advice';
|
4
4
|
import { PropellerType } from './propeller';
|
5
5
|
/**
|
6
6
|
* @element obc-thruster
|
@@ -27,6 +27,43 @@ export declare class ObcThruster extends LitElement {
|
|
27
27
|
render(): import("lit-html").TemplateResult<1>;
|
28
28
|
static styles: import("lit").CSSResult;
|
29
29
|
}
|
30
|
+
export declare function thrusterTop(height: number, value: number, colors: {
|
31
|
+
box: string;
|
32
|
+
container: string;
|
33
|
+
}, options: {
|
34
|
+
hideTicks: boolean;
|
35
|
+
hideContainer: boolean;
|
36
|
+
}): (import("lit-html").TemplateResult<2> | import("lit-html").TemplateResult<2>[])[];
|
37
|
+
export declare function thrusterTopSingleSided(height: number, value: number, colors: {
|
38
|
+
box: string;
|
39
|
+
container: string;
|
40
|
+
}, options: {
|
41
|
+
hideTicks: boolean;
|
42
|
+
flipAdicePattern: boolean;
|
43
|
+
hideContainer: boolean;
|
44
|
+
narrow: boolean;
|
45
|
+
}, advice: LinearAdviceRaw[]): import("lit-html").TemplateResult<2> | (import("lit-html").TemplateResult<2> | (import("lit-html").TemplateResult<2> | null)[])[];
|
46
|
+
export declare function thrusterBottom(height: number, value: number, colors: {
|
47
|
+
box: string;
|
48
|
+
container: string;
|
49
|
+
}, options: {
|
50
|
+
hideTicks: boolean;
|
51
|
+
hideContainer: boolean;
|
52
|
+
}): import("lit-html").TemplateResult<2>;
|
53
|
+
export declare function setpointSvg(height: number, value: number, setpointAtZero: boolean, colors: {
|
54
|
+
fill: string;
|
55
|
+
stroke: string;
|
56
|
+
}, options: {
|
57
|
+
inCommand: boolean;
|
58
|
+
singleSided: boolean;
|
59
|
+
narrow: boolean;
|
60
|
+
}): import("lit-html").TemplateResult<2>;
|
61
|
+
export declare function atSetpoint(thrust: number, setpoint: number | undefined, options: {
|
62
|
+
autoAtSetpoint: boolean;
|
63
|
+
autoSetpointDeadband: number;
|
64
|
+
touching: boolean;
|
65
|
+
atSetpoint: boolean;
|
66
|
+
}): boolean;
|
30
67
|
export declare function thruster(thrust: number, setpoint: number | undefined, state: InstrumentState, options: {
|
31
68
|
atSetpoint: boolean;
|
32
69
|
tunnel: boolean;
|
@@ -40,10 +77,26 @@ export declare function thruster(thrust: number, setpoint: number | undefined, s
|
|
40
77
|
advices: LinearAdvice[];
|
41
78
|
topPropeller: PropellerType;
|
42
79
|
bottomPropeller: PropellerType;
|
80
|
+
narrow: boolean;
|
43
81
|
}): import("lit-html").TemplateResult<2>;
|
44
82
|
declare global {
|
45
83
|
interface HTMLElementTagNameMap {
|
46
84
|
'obc-thruster': ObcThruster;
|
47
85
|
}
|
48
86
|
}
|
87
|
+
export declare function convertThrustAdvices(advices: LinearAdvice[], thrust: number): {
|
88
|
+
topAdvices: LinearAdviceRaw[];
|
89
|
+
bottomAdvices: LinearAdviceRaw[];
|
90
|
+
};
|
91
|
+
export declare function thrusterColors(options: {
|
92
|
+
atSetpoint: boolean;
|
93
|
+
touching: boolean;
|
94
|
+
}, state: InstrumentState): {
|
95
|
+
zeroLineColor: string;
|
96
|
+
boxColor: string;
|
97
|
+
containerBackgroundColor: string;
|
98
|
+
hideTicks: boolean;
|
99
|
+
setPointColor: string;
|
100
|
+
arrowColor: string;
|
101
|
+
};
|
49
102
|
//# sourceMappingURL=thruster.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"thruster.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/thruster/thruster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,
|
1
|
+
{"version":3,"file":"thruster.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/thruster/thruster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA0B,MAAM,KAAK,CAAC;AAExD,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AACzC,OAAO,EAAC,YAAY,EAAE,eAAe,EAAe,MAAM,UAAU,CAAC;AAIrE,OAAO,EAAC,aAAa,EAAgC,MAAM,aAAa,CAAC;AAEzE;;;;;GAKG;AACH,qBACa,WAAY,SAAQ,UAAU;IACf,MAAM,EAAE,MAAM,CAAK;IACnB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QA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