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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. package/.storybook/main.ts +8 -0
  2. package/.storybook/preview.ts +2 -0
  3. package/__snapshots__/building-blocks-watch--advice.png +0 -0
  4. package/__snapshots__/building-blocks-watch-flat--primary.png +0 -0
  5. package/__snapshots__/navigation-instruments-azimuth-thruster--in-command.png +0 -0
  6. package/__snapshots__/navigation-instruments-azimuth-thruster-labeled--large.png +0 -0
  7. package/__snapshots__/navigation-instruments-azimuth-thruster-labeled--medium.png +0 -0
  8. package/__snapshots__/navigation-instruments-azimuth-thruster-labeled--no-command.png +0 -0
  9. package/__snapshots__/navigation-instruments-compass--primary.png +0 -0
  10. package/__snapshots__/navigation-instruments-compass-flat--primary.png +0 -0
  11. package/__snapshots__/navigation-instruments-compass-flat--with-fov-indicator.png +0 -0
  12. package/custom-elements.json +968 -7
  13. package/dist/navigation-instruments/compass/arrow.d.ts +7 -0
  14. package/dist/navigation-instruments/compass/arrow.d.ts.map +1 -0
  15. package/dist/navigation-instruments/compass/arrow.js +59 -0
  16. package/dist/navigation-instruments/compass/arrow.js.map +1 -0
  17. package/dist/navigation-instruments/compass/compass.d.ts +23 -0
  18. package/dist/navigation-instruments/compass/compass.d.ts.map +1 -0
  19. package/dist/navigation-instruments/compass/compass.js +139 -0
  20. package/dist/navigation-instruments/compass/compass.js.map +1 -0
  21. package/dist/navigation-instruments/compass/radial-tickmark.d.ts +4 -0
  22. package/dist/navigation-instruments/compass/radial-tickmark.d.ts.map +1 -0
  23. package/dist/navigation-instruments/compass/radial-tickmark.js +69 -0
  24. package/dist/navigation-instruments/compass/radial-tickmark.js.map +1 -0
  25. package/dist/navigation-instruments/compass-flat/compass-flat.css.js +29 -0
  26. package/dist/navigation-instruments/compass-flat/compass-flat.css.js.map +1 -0
  27. package/dist/navigation-instruments/compass-flat/compass-flat.d.ts +45 -0
  28. package/dist/navigation-instruments/compass-flat/compass-flat.d.ts.map +1 -0
  29. package/dist/navigation-instruments/compass-flat/compass-flat.js +223 -0
  30. package/dist/navigation-instruments/compass-flat/compass-flat.js.map +1 -0
  31. package/dist/navigation-instruments/thruster/advice.d.ts.map +1 -1
  32. package/dist/navigation-instruments/thruster/advice.js +9 -5
  33. package/dist/navigation-instruments/thruster/advice.js.map +1 -1
  34. package/dist/navigation-instruments/watch/advice.js +1 -1
  35. package/dist/navigation-instruments/watch/advice.js.map +1 -1
  36. package/dist/navigation-instruments/watch/label.d.ts +3 -0
  37. package/dist/navigation-instruments/watch/label.d.ts.map +1 -0
  38. package/dist/navigation-instruments/watch/label.js +68 -0
  39. package/dist/navigation-instruments/watch/label.js.map +1 -0
  40. package/dist/navigation-instruments/watch/watch.css.js +15 -14
  41. package/dist/navigation-instruments/watch/watch.css.js.map +1 -1
  42. package/dist/navigation-instruments/watch/watch.d.ts +3 -0
  43. package/dist/navigation-instruments/watch/watch.d.ts.map +1 -1
  44. package/dist/navigation-instruments/watch/watch.js +34 -1
  45. package/dist/navigation-instruments/watch/watch.js.map +1 -1
  46. package/dist/navigation-instruments/watch-flat/tickmark-flat.d.ts +20 -0
  47. package/dist/navigation-instruments/watch-flat/tickmark-flat.d.ts.map +1 -0
  48. package/dist/navigation-instruments/watch-flat/tickmark-flat.js +53 -0
  49. package/dist/navigation-instruments/watch-flat/tickmark-flat.js.map +1 -0
  50. package/dist/navigation-instruments/watch-flat/watch-flat.css.js +32 -0
  51. package/dist/navigation-instruments/watch-flat/watch-flat.css.js.map +1 -0
  52. package/dist/navigation-instruments/watch-flat/watch-flat.d.ts +29 -0
  53. package/dist/navigation-instruments/watch-flat/watch-flat.d.ts.map +1 -0
  54. package/dist/navigation-instruments/watch-flat/watch-flat.js +184 -0
  55. package/dist/navigation-instruments/watch-flat/watch-flat.js.map +1 -0
  56. package/dist/svghelpers/rectangular.d.ts +1 -0
  57. package/dist/svghelpers/rectangular.d.ts.map +1 -1
  58. package/dist/svghelpers/rectangular.js +3 -2
  59. package/dist/svghelpers/rectangular.js.map +1 -1
  60. package/package.json +16 -11
  61. package/src/navigation-instruments/compass/arrow.ts +61 -0
  62. package/src/navigation-instruments/compass/compass.stories.ts +37 -0
  63. package/src/navigation-instruments/compass/compass.ts +132 -0
  64. package/src/navigation-instruments/compass/radial-tickmark.ts +77 -0
  65. package/src/navigation-instruments/compass-flat/compass-flat.css +23 -0
  66. package/src/navigation-instruments/compass-flat/compass-flat.stories.ts +35 -0
  67. package/src/navigation-instruments/compass-flat/compass-flat.ts +221 -0
  68. package/src/navigation-instruments/thruster/advice.ts +9 -5
  69. package/src/navigation-instruments/watch/advice.ts +1 -1
  70. package/src/navigation-instruments/watch/label.ts +69 -0
  71. package/src/navigation-instruments/watch/watch.css +7 -7
  72. package/src/navigation-instruments/watch/watch.ts +30 -1
  73. package/src/navigation-instruments/watch-flat/tickmark-flat.ts +62 -0
  74. package/src/navigation-instruments/watch-flat/watch-flat.css +19 -0
  75. package/src/navigation-instruments/watch-flat/watch-flat.stories.ts +17 -0
  76. package/src/navigation-instruments/watch-flat/watch-flat.ts +148 -0
  77. package/src/svghelpers/rectangular.ts +6 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compass-flat.js","sources":["../../../src/navigation-instruments/compass-flat/compass-flat.ts"],"sourcesContent":["import {LitElement, svg, SVGTemplateResult, unsafeCSS} from 'lit';\nimport componentStyle from './compass-flat.css?inline';\nimport {customElement, property} from 'lit/decorators.js';\nimport {Tickmark, TickmarkType} from '../watch-flat/tickmark-flat';\nimport '../watch-flat/watch-flat';\n\nexport enum LabelPosition {\n top = -45,\n bottom = 50,\n}\n\nexport enum LabelStyle {\n regular = 'var(--instrument-tick-mark-secondary-color)',\n}\n\nexport interface Label {\n x: number;\n y: LabelPosition;\n text: string;\n}\n\n@customElement('obc-compass-flat')\nexport class ObcCompassFlat extends LitElement {\n @property({type: Boolean}) noPadding: boolean = true;\n @property({type: Boolean}) FOVIndicator: boolean = false;\n @property({type: Number}) padding: number = 16;\n @property({type: Number}) heading = 0;\n @property({type: Number}) courseOverGround = 0;\n @property({type: Number}) tickInterval = 5;\n @property({type: Number}) FOV = 45;\n @property({type: Number}) minFOV = 45;\n @property({type: Number}) maxFOV = 180;\n labels: Label[] = [];\n\n @property({type: Number}) containerWidth = 0;\n\n private resizeObserver: ResizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n this.containerWidth = entry.contentRect.width;\n this.updateLabels();\n }\n });\n\n override connectedCallback() {\n super.connectedCallback();\n this.resizeObserver.observe(this);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.resizeObserver.unobserve(this);\n }\n\n private updateLabels() {\n if (this.containerWidth < 192) {\n this.labels = [];\n } else if (this.containerWidth <= 300) {\n this.labels = [\n {x: -180, y: LabelPosition.top, text: 'S'},\n {x: -90, y: LabelPosition.top, text: 'W'},\n {x: 0, y: LabelPosition.top, text: 'N'},\n {x: 90, y: LabelPosition.top, text: 'E'},\n {x: 180, y: LabelPosition.top, text: 'S'},\n {x: 270, y: LabelPosition.top, text: 'W'},\n {x: 360, y: LabelPosition.top, text: 'N'},\n {x: 450, y: LabelPosition.top, text: 'E'},\n {x: 540, y: LabelPosition.top, text: 'S'},\n ];\n } else {\n this.labels = [\n {x: -180, y: LabelPosition.top, text: 'S'},\n {x: -135, y: LabelPosition.top, text: 'SW'},\n {x: -90, y: LabelPosition.top, text: 'W'},\n {x: -45, y: LabelPosition.top, text: 'NW'},\n {x: 0, y: LabelPosition.top, text: 'N'},\n {x: 45, y: LabelPosition.top, text: 'NE'},\n {x: 90, y: LabelPosition.top, text: 'E'},\n {x: 135, y: LabelPosition.top, text: 'SE'},\n {x: 180, y: LabelPosition.top, text: 'S'},\n {x: 225, y: LabelPosition.top, text: 'SW'},\n {x: 270, y: LabelPosition.top, text: 'W'},\n {x: 315, y: LabelPosition.top, text: 'NW'},\n {x: 360, y: LabelPosition.top, text: 'N'},\n {x: 405, y: LabelPosition.top, text: 'NE'},\n {x: 450, y: LabelPosition.top, text: 'E'},\n {x: 495, y: LabelPosition.top, text: 'SE'},\n {x: 540, y: LabelPosition.top, text: 'S'},\n ];\n }\n }\n\n private generateIntervalTickmarks(scale: number): Tickmark[] {\n const tickmarks: Tickmark[] = [];\n let cardinalInterval = 90;\n\n if (this.containerWidth > 300) {\n cardinalInterval = 45;\n } else if (this.containerWidth < 192) {\n cardinalInterval = 0;\n }\n\n for (\n let angle = -180;\n angle < this.maxFOV * 3;\n angle += this.tickInterval\n ) {\n if (cardinalInterval !== 0 && angle % cardinalInterval === 0) {\n continue;\n }\n tickmarks.push({angle: angle * scale, type: TickmarkType.secondary});\n }\n\n return tickmarks;\n }\n\n private generateCardinalTickmarks(scale: number): Tickmark[] {\n const tickmarks: Tickmark[] = [];\n\n for (const label of this.labels) {\n tickmarks.push({angle: label.x * scale, type: TickmarkType.main});\n }\n\n return tickmarks;\n }\n\n private generateTickmarks(scale: number): Tickmark[] {\n return [\n ...this.generateCardinalTickmarks(scale),\n ...this.generateIntervalTickmarks(scale),\n ];\n }\n\n private renderFOVIndicator(): SVGTemplateResult[] {\n const indicators: SVGTemplateResult[] = [];\n\n const maxAdjustment = 10;\n const minContainerWidth = 300;\n const maxContainerWidth = 512;\n\n let yAdjustment = 0;\n if (this.containerWidth < maxContainerWidth) {\n const widthRange = maxContainerWidth - minContainerWidth;\n const scaleFactor =\n (maxContainerWidth - this.containerWidth) / widthRange;\n yAdjustment = scaleFactor * maxAdjustment;\n }\n\n const y = LabelPosition.bottom + yAdjustment;\n\n indicators.push(svg`\n <text x=\"-175\" y=${y} class=\"label left\" fill=${LabelStyle.regular}>\n ${-this.FOV}\\u00B0\n </text>`);\n\n indicators.push(svg`\n <text x=\"0\" y=${y} class=\"label\" fill=${LabelStyle.regular}>\n ${this.heading}\\u00B0\n </text>`);\n\n indicators.push(svg`\n <text x=\"175\" y=${y} class=\"label right\" fill=${LabelStyle.regular}>\n ${this.FOV}\\u00B0\n </text>`);\n\n return indicators;\n }\n\n private get HDGSvg(): SVGTemplateResult {\n return svg`<g transform=\"translate(-24, -74)\">\n <path d=\"M36.7011 44.1445L36.6898 44.1379L36.6781 44.1318L24.2301 37.6823L24.0001 37.5631L23.7701 37.6823L11.3221 44.1318L11.3104 44.1379L11.2991 44.1445C9.25497 45.3438 6.78661 43.308 7.68828 41.0919L22.6036 4.43285C23.1096 3.18905 24.8906 3.18905 25.3967 4.43284L40.3119 41.0919C41.2136 43.308 38.7452 45.3438 36.7011 44.1445Z\" fill=\"var(--instrument-enhanced-secondary-color)\" stroke=\"var(--border-silhouette-color)\"/>\n </g>`;\n }\n\n private COGSvg(translation: number): SVGTemplateResult {\n return svg`\n <g transform=\"translate(${-24 + translation}, -74)\">\n <path d=\"M31.9025 36.0262L33.1068 36.6502L32.5956 35.3938L24.4632 15.406L24.0001 14.2677L23.537 15.406L15.4046 35.3938L14.8935 36.6502L16.0978 36.0262L24.0001 31.9319L31.9025 36.0262ZM36.7011 44.1445L36.6898 44.1379L36.6781 44.1318L24.2301 37.6823L24.0001 37.5631L23.7701 37.6823L11.3221 44.1318L11.3104 44.1379L11.2991 44.1445C9.25497 45.3438 6.78661 43.308 7.68828 41.0919L22.6036 4.43285C23.1096 3.18905 24.8906 3.18905 25.3967 4.43284L40.3119 41.0919C41.2136 43.308 38.7452 45.3438 36.7011 44.1445Z\" fill=\"var(--instrument-enhanced-secondary-color)\" stroke=\"var(--border-silhouette-color)\"/>\n </g>\n `;\n }\n\n override render() {\n let angleDiff = this.courseOverGround - this.heading;\n\n if (angleDiff > this.maxFOV) {\n angleDiff -= 360;\n } else if (angleDiff < -this.maxFOV) {\n angleDiff += 360;\n }\n\n this.FOV = Math.max(this.minFOV, Math.abs(angleDiff));\n\n const baseOffset = 5;\n const translationScale = (baseOffset * 35) / this.FOV;\n\n const translation = angleDiff * translationScale;\n\n const tickmarks = this.generateTickmarks(translationScale);\n this.labels.map((l) => {\n l.x = l.x * translationScale;\n });\n\n const viewBox = this.noPadding ? '-192 -128 384 128' : '-200 -144 400 144';\n\n return svg`\n <div class=\"container\">\n <obc-watch-flat .noPadding=${this.noPadding} .FOVIndicator=${this.FOVIndicator ? this.renderFOVIndicator() : []} .labels=${this.labels} .rotation=${this.heading} .tickmarks=${tickmarks} .tickmarkSpacing=${translationScale}></obc-watch-flat>\n <svg viewBox=${viewBox} xmlns=\"http://www.w3.org/2000/svg\"> \n ${this.HDGSvg}${this.COGSvg(translation)}\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-compass-flat': ObcCompassFlat;\n }\n}\n"],"names":["LabelPosition","LabelStyle"],"mappings":";;;;;;;;;;;;;;;;AAMY,IAAA,kCAAAA,mBAAL;AACLA,iBAAAA,eAAA,SAAM,GAAN,IAAA;AACAA,iBAAAA,eAAA,YAAS,EAAT,IAAA;AAFUA,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AAKA,IAAA,+BAAAC,gBAAL;AACLA,cAAA,SAAU,IAAA;AADAA,SAAAA;AAAA,GAAA,cAAA,CAAA,CAAA;AAWC,IAAA,iBAAN,cAA6B,WAAW;AAAA,EAAxC,cAAA;AAAA,UAAA,GAAA,SAAA;AAC2C,SAAA,YAAA;AACG,SAAA,eAAA;AACP,SAAA,UAAA;AACR,SAAA,UAAA;AACS,SAAA,mBAAA;AACJ,SAAA,eAAA;AACT,SAAA,MAAA;AACG,SAAA,SAAA;AACA,SAAA,SAAA;AACnC,SAAA,SAAkB;AAEyB,SAAA,iBAAA;AAE3C,SAAQ,iBAAiC,IAAI,eAAe,CAAC,YAAY;AACvE,iBAAW,SAAS,SAAS;AACtB,aAAA,iBAAiB,MAAM,YAAY;AACxC,aAAK,aAAa;AAAA,MACpB;AAAA,IAAA,CACD;AAAA,EAAA;AAAA,EAEQ,oBAAoB;AAC3B,UAAM,kBAAkB;AACnB,SAAA,eAAe,QAAQ,IAAI;AAAA,EAClC;AAAA,EAES,uBAAuB;AAC9B,UAAM,qBAAq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.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/thruster/advice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAe,MAAM,KAAK,CAAC;AACpD,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAIxD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,WAAW,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AAwBD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,eAAe,EACvB,aAAa,EAAE,OAAO,GACrB,iBAAiB,CA2DnB"}
1
+ {"version":3,"file":"advice.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/thruster/advice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAe,MAAM,KAAK,CAAC;AACpD,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAIxD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,WAAW,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AAwBD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,eAAe,EACvB,aAAa,EAAE,OAAO,GACrB,iBAAiB,CA+DnB"}
@@ -56,20 +56,24 @@ function renderAdvice(height, advice, flipDirection) {
56
56
  ${singleSidedTickmark(height, advice.max, tickmarkStyle)}
57
57
  `;
58
58
  } else {
59
- let mainColor;
59
+ let strokeColor;
60
60
  let tickmarkStyle;
61
+ let fillColor;
61
62
  if (advice.state === AdviceState.hinted) {
62
- mainColor = "var(--instrument-frame-tertiary-color)";
63
+ strokeColor = "var(--instrument-frame-tertiary-color)";
64
+ fillColor = "none";
63
65
  tickmarkStyle = TickmarkStyle.hinted;
64
66
  } else if (advice.state === AdviceState.regular) {
65
- mainColor = "var(--instrument-regular-secondary-color)";
67
+ strokeColor = "var(--instrument-regular-secondary-color)";
68
+ fillColor = "none";
66
69
  tickmarkStyle = TickmarkStyle.regular;
67
70
  } else {
68
- mainColor = "var(--instrument-enhanced-secondary-color)";
71
+ strokeColor = "var(--instrument-enhanced-secondary-color)";
72
+ fillColor = strokeColor;
69
73
  tickmarkStyle = TickmarkStyle.regular;
70
74
  }
71
75
  return svg`
72
- ${adviceMask(height, advice.min, advice.max, mainColor, mainColor)}
76
+ ${adviceMask(height, advice.min, advice.max, fillColor, strokeColor)}
73
77
  ${singleSidedTickmark(height, advice.min, tickmarkStyle)}
74
78
  ${singleSidedTickmark(height, advice.max, tickmarkStyle)}
75
79
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"advice.js","sources":["../../../src/navigation-instruments/thruster/advice.ts"],"sourcesContent":["import {SVGTemplateResult, nothing, svg} from 'lit';\nimport {AdviceState, AdviceType} from '../watch/advice';\nimport {TickmarkStyle} from '../watch/tickmark';\nimport {singleSidedTickmark} from './tickmark';\n\nexport interface LinearAdviceRaw {\n min: number;\n max: number;\n type: AdviceType;\n state: AdviceState;\n}\n\nexport interface LinearAdvice {\n min: number;\n max: number;\n type: AdviceType;\n hinted: boolean;\n}\n\nfunction adviceMask(\n height: number,\n min: number,\n max: number,\n fill: string,\n stroke: string\n): SVGTemplateResult {\n const width = 8;\n const x1 = 12;\n const x2 = x1 + width;\n const r = width / 2;\n const yL = (-min * height) / 100 - 2 * r - 2;\n const yH = (-max * height) / 100 + 2 * r - 2;\n\n const path = `M ${x1} ${yL} \n A ${r} ${r} 0 0 0 ${x2} ${yL}\n V ${yH}\n A ${r} ${r} 0 0 0 ${x1} ${yH}\n Z`;\n return svg`<path d=${path} fill=${fill} stroke=${stroke} stroke-width=\"1\" vector-effect=\"non-scaling-stroke\" />`;\n}\n\nexport function renderAdvice(\n height: number,\n advice: LinearAdviceRaw,\n flipDirection: boolean\n): SVGTemplateResult {\n if (advice.type === AdviceType.caution) {\n let mainColor;\n let fillColor: string | null = null;\n if (advice.state === AdviceState.hinted) {\n mainColor = 'var(--instrument-frame-tertiary-color)';\n } else if (advice.state === AdviceState.regular) {\n mainColor = 'var(--instrument-tick-mark-tertiary-color)';\n } else {\n mainColor = 'var(--on-caution-active-color)';\n fillColor = 'var(--alert-caution-color)';\n }\n const pattern = [];\n const ypattern = flipDirection ? 50 : -50;\n for (let i = -100; i < 300; i += 16) {\n pattern.push(svg`<g transform=\"translate(0 ${-i}) \">\n <path d=\"M 50 0 L 0 ${ypattern}\" stroke=${mainColor} stroke-width=\"6\"/>\n </g>\n `);\n }\n const maskId = `adviceMask-${advice.min}-${advice.max}`;\n let tickmarkStyle = TickmarkStyle.hinted;\n if (advice.state === AdviceState.regular) {\n tickmarkStyle = TickmarkStyle.regular;\n } else if (advice.state === AdviceState.triggered) {\n tickmarkStyle = TickmarkStyle.enhanced;\n }\n\n return svg`\n <mask id=${maskId}>\n ${adviceMask(height, advice.min, advice.max, 'white', 'black')}\n </mask>\n <g mask=\"url(#${maskId})\">\n ${fillColor ? svg`<rect x=\"-256\" y=\"-512\" width=\"512\" height=\"1024\" fill=\"${fillColor}\"/>` : nothing}\n ${pattern}\n </g>\n ${adviceMask(height, advice.min, advice.max, 'none', mainColor)}\n ${singleSidedTickmark(height, advice.min, tickmarkStyle)}\n ${singleSidedTickmark(height, advice.max, tickmarkStyle)}\n `;\n } else {\n let mainColor;\n let tickmarkStyle;\n if (advice.state === AdviceState.hinted) {\n mainColor = 'var(--instrument-frame-tertiary-color)';\n tickmarkStyle = TickmarkStyle.hinted;\n } else if (advice.state === AdviceState.regular) {\n mainColor = 'var(--instrument-regular-secondary-color)';\n tickmarkStyle = TickmarkStyle.regular;\n } else {\n mainColor = 'var(--instrument-enhanced-secondary-color)';\n tickmarkStyle = TickmarkStyle.regular;\n }\n return svg`\n ${adviceMask(height, advice.min, advice.max, mainColor, mainColor)}\n ${singleSidedTickmark(height, advice.min, tickmarkStyle)}\n ${singleSidedTickmark(height, advice.max, tickmarkStyle)}\n `;\n }\n}\n"],"names":[],"mappings":";;;;AAmBA,SAAS,WACP,QACA,KACA,KACA,MACA,QACmB;AACnB,QAAM,QAAQ;AACd,QAAM,KAAK;AACX,QAAM,KAAK,KAAK;AAChB,QAAM,IAAI,QAAQ;AAClB,QAAM,KAAM,CAAC,MAAM,SAAU,MAAM,IAAI,IAAI;AAC3C,QAAM,KAAM,CAAC,MAAM,SAAU,MAAM,IAAI,IAAI;AAE3C,QAAM,OAAO,KAAK,EAAE,IAAI,EAAE;AAAA,wBACJ,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE;AAAA,wBACxB,EAAE;AAAA,wBACF,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE;AAAA;AAE9C,SAAO,cAAc,IAAI,SAAS,IAAI,WAAW,MAAM;AACzD;AAEgB,SAAA,aACd,QACA,QACA,eACmB;AACf,MAAA,OAAO,SAAS,WAAW,SAAS;AAClC,QAAA;AACJ,QAAI,YAA2B;AAC3B,QAAA,OAAO,UAAU,YAAY,QAAQ;AAC3B,kBAAA;AAAA,IACH,WAAA,OAAO,UAAU,YAAY,SAAS;AACnC,kBAAA;AAAA,IAAA,OACP;AACO,kBAAA;AACA,kBAAA;AAAA,IACd;AACA,UAAM,UAAU,CAAA;AACV,UAAA,WAAW,gBAAgB,KAAK;AACtC,aAAS,IAAI,MAAM,IAAI,KAAK,KAAK,IAAI;AAC3B,cAAA,KAAK,gCAAgC,CAAC,CAAC;AAAA,kCACnB,QAAQ,YAAY,SAAS;AAAA;AAAA,aAElD;AAAA,IACT;AACA,UAAM,SAAS,cAAc,OAAO,GAAG,IAAI,OAAO,GAAG;AACrD,QAAI,gBAAgB,cAAc;AAC9B,QAAA,OAAO,UAAU,YAAY,SAAS;AACxC,sBAAgB,cAAc;AAAA,IACrB,WAAA,OAAO,UAAU,YAAY,WAAW;AACjD,sBAAgB,cAAc;AAAA,IAChC;AAEO,WAAA;AAAA,uBACY,MAAM;AAAA,kBACX,WAAW,QAAQ,OAAO,KAAK,OAAO,KAAK,SAAS,OAAO,CAAC;AAAA;AAAA,4BAElD,MAAM;AAAA,kBAChB,YAAY,8DAA8D,SAAS,QAAQ,OAAO;AAAA,kBAClG,OAAO;AAAA;AAAA,cAEX,WAAW,QAAQ,OAAO,KAAK,OAAO,KAAK,QAAQ,SAAS,CAAC;AAAA,cAC7D,oBAAoB,QAAQ,OAAO,KAAK,aAAa,CAAC;AAAA,cACtD,oBAAoB,QAAQ,OAAO,KAAK,aAAa,CAAC;AAAA;AAAA,EAAA,OAE3D;AACD,QAAA;AACA,QAAA;AACA,QAAA,OAAO,UAAU,YAAY,QAAQ;AAC3B,kBAAA;AACZ,sBAAgB,cAAc;AAAA,IACrB,WAAA,OAAO,UAAU,YAAY,SAAS;AACnC,kBAAA;AACZ,sBAAgB,cAAc;AAAA,IAAA,OACzB;AACO,kBAAA;AACZ,sBAAgB,cAAc;AAAA,IAChC;AACO,WAAA;AAAA,cACG,WAAW,QAAQ,OAAO,KAAK,OAAO,KAAK,WAAW,SAAS,CAAC;AAAA,cAChE,oBAAoB,QAAQ,OAAO,KAAK,aAAa,CAAC;AAAA,cACtD,oBAAoB,QAAQ,OAAO,KAAK,aAAa,CAAC;AAAA;AAAA,EAElE;AACF;"}
1
+ {"version":3,"file":"advice.js","sources":["../../../src/navigation-instruments/thruster/advice.ts"],"sourcesContent":["import {SVGTemplateResult, nothing, svg} from 'lit';\nimport {AdviceState, AdviceType} from '../watch/advice';\nimport {TickmarkStyle} from '../watch/tickmark';\nimport {singleSidedTickmark} from './tickmark';\n\nexport interface LinearAdviceRaw {\n min: number;\n max: number;\n type: AdviceType;\n state: AdviceState;\n}\n\nexport interface LinearAdvice {\n min: number;\n max: number;\n type: AdviceType;\n hinted: boolean;\n}\n\nfunction adviceMask(\n height: number,\n min: number,\n max: number,\n fill: string,\n stroke: string\n): SVGTemplateResult {\n const width = 8;\n const x1 = 12;\n const x2 = x1 + width;\n const r = width / 2;\n const yL = (-min * height) / 100 - 2 * r - 2;\n const yH = (-max * height) / 100 + 2 * r - 2;\n\n const path = `M ${x1} ${yL} \n A ${r} ${r} 0 0 0 ${x2} ${yL}\n V ${yH}\n A ${r} ${r} 0 0 0 ${x1} ${yH}\n Z`;\n return svg`<path d=${path} fill=${fill} stroke=${stroke} stroke-width=\"1\" vector-effect=\"non-scaling-stroke\" />`;\n}\n\nexport function renderAdvice(\n height: number,\n advice: LinearAdviceRaw,\n flipDirection: boolean\n): SVGTemplateResult {\n if (advice.type === AdviceType.caution) {\n let mainColor;\n let fillColor: string | null = null;\n if (advice.state === AdviceState.hinted) {\n mainColor = 'var(--instrument-frame-tertiary-color)';\n } else if (advice.state === AdviceState.regular) {\n mainColor = 'var(--instrument-tick-mark-tertiary-color)';\n } else {\n mainColor = 'var(--on-caution-active-color)';\n fillColor = 'var(--alert-caution-color)';\n }\n const pattern = [];\n const ypattern = flipDirection ? 50 : -50;\n for (let i = -100; i < 300; i += 16) {\n pattern.push(svg`<g transform=\"translate(0 ${-i}) \">\n <path d=\"M 50 0 L 0 ${ypattern}\" stroke=${mainColor} stroke-width=\"6\"/>\n </g>\n `);\n }\n const maskId = `adviceMask-${advice.min}-${advice.max}`;\n let tickmarkStyle = TickmarkStyle.hinted;\n if (advice.state === AdviceState.regular) {\n tickmarkStyle = TickmarkStyle.regular;\n } else if (advice.state === AdviceState.triggered) {\n tickmarkStyle = TickmarkStyle.enhanced;\n }\n\n return svg`\n <mask id=${maskId}>\n ${adviceMask(height, advice.min, advice.max, 'white', 'black')}\n </mask>\n <g mask=\"url(#${maskId})\">\n ${fillColor ? svg`<rect x=\"-256\" y=\"-512\" width=\"512\" height=\"1024\" fill=\"${fillColor}\"/>` : nothing}\n ${pattern}\n </g>\n ${adviceMask(height, advice.min, advice.max, 'none', mainColor)}\n ${singleSidedTickmark(height, advice.min, tickmarkStyle)}\n ${singleSidedTickmark(height, advice.max, tickmarkStyle)}\n `;\n } else {\n let strokeColor;\n let tickmarkStyle;\n let fillColor: string;\n if (advice.state === AdviceState.hinted) {\n strokeColor = 'var(--instrument-frame-tertiary-color)';\n fillColor = 'none';\n tickmarkStyle = TickmarkStyle.hinted;\n } else if (advice.state === AdviceState.regular) {\n strokeColor = 'var(--instrument-regular-secondary-color)';\n fillColor = 'none';\n tickmarkStyle = TickmarkStyle.regular;\n } else {\n strokeColor = 'var(--instrument-enhanced-secondary-color)';\n fillColor = strokeColor;\n tickmarkStyle = TickmarkStyle.regular;\n }\n return svg`\n ${adviceMask(height, advice.min, advice.max, fillColor, strokeColor)}\n ${singleSidedTickmark(height, advice.min, tickmarkStyle)}\n ${singleSidedTickmark(height, advice.max, tickmarkStyle)}\n `;\n }\n}\n"],"names":[],"mappings":";;;;AAmBA,SAAS,WACP,QACA,KACA,KACA,MACA,QACmB;AACnB,QAAM,QAAQ;AACd,QAAM,KAAK;AACX,QAAM,KAAK,KAAK;AAChB,QAAM,IAAI,QAAQ;AAClB,QAAM,KAAM,CAAC,MAAM,SAAU,MAAM,IAAI,IAAI;AAC3C,QAAM,KAAM,CAAC,MAAM,SAAU,MAAM,IAAI,IAAI;AAE3C,QAAM,OAAO,KAAK,EAAE,IAAI,EAAE;AAAA,wBACJ,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE;AAAA,wBACxB,EAAE;AAAA,wBACF,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE;AAAA;AAE9C,SAAO,cAAc,I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A,OAAO,UAAU,YAAY,SAAS;AACjC,oBAAA;AACF,kBAAA;AACZ,sBAAgB,cAAc;AAAA,IAAA,OACzB;AACS,oBAAA;AACF,kBAAA;AACZ,sBAAgB,cAAc;AAAA,IAChC;AACO,WAAA;AAAA,cACG,WAAW,QAAQ,OAAO,KAAK,OAAO,KAAK,WAAW,WAAW,CAAC;AAAA,cAClE,oBAAoB,QAAQ,OAAO,KAAK,aAAa,CAAC;AAAA,cACtD,oBAAoB,QAAQ,OAAO,KAAK,aAAa,CAAC;AAAA;AAAA,EAElE;AACF;"}
@@ -87,7 +87,7 @@ function renderAdvice(advice) {
87
87
  tickmarkStyle = TickmarkStyle.regular;
88
88
  }
89
89
  return svg`
90
- ${adviceMask(advice.minAngle, advice.maxAngle, mainColor, mainColor)}
90
+ ${adviceMask(advice.minAngle, advice.maxAngle, advice.state === "triggered" ? mainColor : "none", mainColor)}
91
91
  ${tickmark(advice.minAngle, TickmarkType.primary, tickmarkStyle, 1)}
92
92
  ${tickmark(advice.maxAngle, TickmarkType.primary, tickmarkStyle, 1)}
93
93
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"advice.js","sources":["../../../src/navigation-instruments/watch/advice.ts"],"sourcesContent":["import {SVGTemplateResult, nothing, svg} from 'lit';\nimport {TickmarkStyle, TickmarkType, tickmark} from './tickmark';\n\nexport enum AdviceType {\n advice = 'advice',\n caution = 'caution',\n}\n\nexport enum AdviceState {\n regular = 'regular',\n hinted = 'hinted',\n triggered = 'triggered',\n}\n\nexport interface AngleAdviceRaw {\n minAngle: number;\n maxAngle: number;\n type: AdviceType;\n state: AdviceState;\n}\n\nexport interface AngleAdvice {\n minAngle: number;\n maxAngle: number;\n type: AdviceType;\n hinted: boolean;\n}\n\nconst margin = (344 - 328) / 2 + 8;\nconst deltaAngle = Math.atan2(margin, (344 + 328) / 2);\n\nfunction adviceMask(\n minAngle: number,\n maxAngle: number,\n fill: string,\n stroke: string\n): SVGTemplateResult {\n const radl = (minAngle * Math.PI) / 180 + deltaAngle;\n const radh = (maxAngle * Math.PI) / 180 - deltaAngle;\n const r1 = 328 / 2;\n const r2 = 344 / 2;\n const R = (r2 - r1) / 2;\n const x1l = Math.sin(radl) * r1;\n const y1l = -Math.cos(radl) * r1;\n const x2l = Math.sin(radl) * r2;\n const y2l = -Math.cos(radl) * r2;\n\n const x1h = Math.sin(radh) * r1;\n const y1h = -Math.cos(radh) * r1;\n const x2h = Math.sin(radh) * r2;\n const y2h = -Math.cos(radh) * r2;\n\n const path = `M ${x1l} ${y1l} \n A ${r1} ${r1} 0 0 1 ${x1h} ${y1h}\n A ${R} ${R} 0 0 0 ${x2h} ${y2h}\n A ${r2} ${r2} 0 0 0 ${x2l} ${y2l}\n A ${R} ${R} 0 0 0 ${x1l} ${y1l}\n Z`;\n return svg`<path d=${path} fill=${fill} stroke=${stroke} stroke-width=\"1\" vector-effect=\"non-scaling-stroke\" />`;\n}\n\nexport function renderAdvice(advice: AngleAdviceRaw): SVGTemplateResult {\n if (advice.type === AdviceType.caution) {\n let mainColor;\n let fillColor: string | null = null;\n if (advice.state === AdviceState.hinted) {\n mainColor = 'var(--instrument-frame-tertiary-color)';\n } else if (advice.state === AdviceState.regular) {\n mainColor = 'var(--instrument-tick-mark-tertiary-color)';\n } else {\n mainColor = 'var(--on-caution-active-color)';\n fillColor = 'var(--alert-caution-color)';\n }\n const radialPattern = [];\n for (let i = 0; i < 180; i += 4) {\n radialPattern.push(svg`<g transform=\"rotate(${i}) translate(-256 -256) \">\n <path d=\"M369.167 64.7317L144 194.732L142 191.268L367.167 61.2676L369.167 64.7317ZM369.167 320.732L144 450.732L142 447.267L367.167 317.267L369.167 320.732Z\" fill=${mainColor}/>\n </g>\n `);\n }\n const maskId = `adviceMask-${advice.minAngle}-${advice.maxAngle}`;\n let tickmarkStyle = TickmarkStyle.hinted;\n if (advice.state === AdviceState.regular) {\n tickmarkStyle = TickmarkStyle.regular;\n } else if (advice.state === AdviceState.triggered) {\n tickmarkStyle = TickmarkStyle.enhanced;\n }\n\n return svg`\n <mask id=${maskId}>\n ${adviceMask(advice.minAngle, advice.maxAngle, 'white', 'black')}\n </mask>\n <g mask=\"url(#${maskId})\">\n ${fillColor ? svg`<rect x=\"-256\" y=\"-256\" width=\"512\" height=\"512\" fill=\"${fillColor}\"/>` : nothing}\n ${radialPattern}\n </g>\n ${adviceMask(advice.minAngle, advice.maxAngle, 'none', mainColor)}\n ${tickmark(advice.minAngle, TickmarkType.primary, tickmarkStyle, 1)}\n ${tickmark(advice.maxAngle, TickmarkType.primary, tickmarkStyle, 1)}\n `;\n } else {\n let mainColor;\n let tickmarkStyle;\n if (advice.state === AdviceState.hinted) {\n mainColor = 'var(--instrument-frame-tertiary-color)';\n tickmarkStyle = TickmarkStyle.hinted;\n } else if (advice.state === AdviceState.regular) {\n mainColor = 'var(--instrument-regular-secondary-color)';\n tickmarkStyle = TickmarkStyle.regular;\n } else {\n mainColor = 'var(--instrument-enhanced-secondary-color)';\n tickmarkStyle = TickmarkStyle.regular;\n }\n return svg`\n ${adviceMask(advice.minAngle, advice.maxAngle, mainColor, mainColor)}\n ${tickmark(advice.minAngle, TickmarkType.primary, tickmarkStyle, 1)}\n ${tickmark(advice.maxAngle, TickmarkType.primary, tickmarkStyle, 1)}\n `;\n }\n}\n"],"names":["AdviceType","AdviceState"],"mappings":";;AAGY,IAAA,+BAAAA,gBAAL;AACLA,cAAA,QAAS,IAAA;AACTA,cAAA,SAAU,IAAA;AAFAA,SAAAA;AAAA,GAAA,cAAA,CAAA,CAAA;AAKA,IAAA,gCAAAC,iBAAL;AACLA,eAAA,SAAU,IAAA;AACVA,eAAA,QAAS,IAAA;AACTA,eAAA,WAAY,IAAA;AAHFA,SAAAA;AAAA,GAAA,eAAA,CAAA,CAAA;AAoBZ,MAAM,UAAU,MAAM,OAAO,IAAI;AACjC,MAAM,aAAa,KAAK,MAAM,SAAS,MAAM,OAAO,CAAC;AAErD,SAAS,WACP,UACA,UACA,MACA,QACmB;AACnB,QAAM,OA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AAAA,IACT;AACA,UAAM,SAAS,cAAc,OAAO,QAAQ,IAAI,OAAO,QAAQ;AAC/D,QAAI,gBAAgB,cAAc;AAC9B,QAAA,OAAO,UAAU,WAAqB;AACxC,sBAAgB,cAAc;AAAA,IAAA,WACrB,OAAO,UAAU,aAAuB;AACjD,sBAAgB,cAAc;AAAA,IAChC;AAEO,WAAA;AAAA,uBACY,MAAM;AAAA,kBACX,WAAW,OAAO,UAAU,OAAO,UAAU,SAAS,OAAO,CAAC;AAAA;AAAA,4BAEpD,MAAM;AAAA,kBAChB,YAAY,6DAA6D,SAAS,QAAQ,OAAO;AAAA,kBACjG,aAAa;AAAA;AAAA,cAEjB,WAAW,OAAO,UAAU,OAAO,UAAU,QAAQ,SAAS,CAAC;AAAA,cAC/D,SAAS,OAAO,UAAU,aAAa,SAAS,eAAe,CAAC,CAAC;AAAA,cACjE,SAAS,OAAO,UAAU,aAAa,SAAS,eAAe,CAAC,CAAC;AAAA;AAAA,EAAA,OAEtE;AACD,QAAA;AACA,QAAA;AACA,QAAA,OAAO,UAAU,UAAoB;AAC3B,kBAAA;AACZ,sBAAgB,cAAc;AAAA,IAAA,WACrB,OAAO,UAAU,WAAqB;AACnC,kBAAA;AACZ,sBAAgB,cAAc;AAAA,IAAA,OACzB;AACO,kBAAA;AACZ,sBAAgB,cAAc;AAAA,IAChC;AACO,WAAA;AAAA,cACG,WAAW,OAAO,UAAU,OAAO,UAAU,WAAW,SAAS,CAAC;AAAA,cAClE,SAAS,OAAO,UAAU,aAAa,SAAS,eAAe,CAAC,CAAC;AAAA,cACjE,SAAS,OAAO,UAAU,aAAa,SAAS,eAAe,CAAC,CAAC;AAAA;AAAA,EAE7E;AACF;"}
1
+ {"version":3,"file":"advice.js","sources":["../../../src/navigation-instruments/watch/advice.ts"],"sourcesContent":["import {SVGTemplateResult, nothing, svg} from 'lit';\nimport {TickmarkStyle, TickmarkType, tickmark} from './tickmark';\n\nexport enum AdviceType {\n advice = 'advice',\n caution = 'caution',\n}\n\nexport enum AdviceState {\n regular = 'regular',\n hinted = 'hinted',\n triggered = 'triggered',\n}\n\nexport interface AngleAdviceRaw {\n minAngle: number;\n maxAngle: number;\n type: AdviceType;\n state: AdviceState;\n}\n\nexport interface AngleAdvice {\n minAngle: number;\n maxAngle: number;\n type: AdviceType;\n hinted: boolean;\n}\n\nconst margin = (344 - 328) / 2 + 8;\nconst deltaAngle = Math.atan2(margin, (344 + 328) / 2);\n\nfunction adviceMask(\n minAngle: number,\n maxAngle: number,\n fill: string,\n stroke: string\n): SVGTemplateResult {\n const radl = (minAngle * Math.PI) / 180 + deltaAngle;\n const radh = (maxAngle * Math.PI) / 180 - deltaAngle;\n const r1 = 328 / 2;\n const r2 = 344 / 2;\n const R = (r2 - r1) / 2;\n const x1l = Math.sin(radl) * r1;\n const y1l = -Math.cos(radl) * r1;\n const x2l = Math.sin(radl) * r2;\n const y2l = -Math.cos(radl) * r2;\n\n const x1h = Math.sin(radh) * r1;\n const y1h = -Math.cos(radh) * r1;\n const x2h = Math.sin(radh) * r2;\n const y2h = -Math.cos(radh) * r2;\n\n const path = `M ${x1l} ${y1l} \n A ${r1} ${r1} 0 0 1 ${x1h} ${y1h}\n A ${R} ${R} 0 0 0 ${x2h} ${y2h}\n A ${r2} ${r2} 0 0 0 ${x2l} ${y2l}\n A ${R} ${R} 0 0 0 ${x1l} ${y1l}\n Z`;\n return svg`<path d=${path} fill=${fill} stroke=${stroke} stroke-width=\"1\" vector-effect=\"non-scaling-stroke\" />`;\n}\n\nexport function renderAdvice(advice: AngleAdviceRaw): SVGTemplateResult {\n if (advice.type === AdviceType.caution) {\n let mainColor;\n let fillColor: string | null = null;\n if (advice.state === AdviceState.hinted) {\n mainColor = 'var(--instrument-frame-tertiary-color)';\n } else if (advice.state === AdviceState.regular) {\n mainColor = 'var(--instrument-tick-mark-tertiary-color)';\n } else {\n mainColor = 'var(--on-caution-active-color)';\n fillColor = 'var(--alert-caution-color)';\n }\n const radialPattern = [];\n for (let i = 0; i < 180; i += 4) {\n radialPattern.push(svg`<g transform=\"rotate(${i}) translate(-256 -256) \">\n <path d=\"M369.167 64.7317L144 194.732L142 191.268L367.167 61.2676L369.167 64.7317ZM369.167 320.732L144 450.732L142 447.267L367.167 317.267L369.167 320.732Z\" fill=${mainColor}/>\n </g>\n `);\n }\n const maskId = `adviceMask-${advice.minAngle}-${advice.maxAngle}`;\n let tickmarkStyle = TickmarkStyle.hinted;\n if (advice.state === AdviceState.regular) {\n tickmarkStyle = TickmarkStyle.regular;\n } else if (advice.state === AdviceState.triggered) {\n tickmarkStyle = TickmarkStyle.enhanced;\n }\n\n return svg`\n <mask id=${maskId}>\n ${adviceMask(advice.minAngle, advice.maxAngle, 'white', 'black')}\n </mask>\n <g mask=\"url(#${maskId})\">\n ${fillColor ? svg`<rect x=\"-256\" y=\"-256\" width=\"512\" height=\"512\" fill=\"${fillColor}\"/>` : nothing}\n ${radialPattern}\n </g>\n ${adviceMask(advice.minAngle, advice.maxAngle, 'none', mainColor)}\n ${tickmark(advice.minAngle, TickmarkType.primary, tickmarkStyle, 1)}\n ${tickmark(advice.maxAngle, TickmarkType.primary, tickmarkStyle, 1)}\n `;\n } else {\n let mainColor;\n let tickmarkStyle;\n if (advice.state === AdviceState.hinted) {\n mainColor = 'var(--instrument-frame-tertiary-color)';\n tickmarkStyle = TickmarkStyle.hinted;\n } else if (advice.state === AdviceState.regular) {\n mainColor = 'var(--instrument-regular-secondary-color)';\n tickmarkStyle = TickmarkStyle.regular;\n } else {\n mainColor = 'var(--instrument-enhanced-secondary-color)';\n tickmarkStyle = TickmarkStyle.regular;\n }\n return svg`\n ${adviceMask(advice.minAngle, advice.maxAngle, advice.state === AdviceState.triggered ? mainColor : 'none', mainColor)}\n ${tickmark(advice.minAngle, TickmarkType.primary, tickmarkStyle, 1)}\n ${tickmark(advice.maxAngle, TickmarkType.primary, tickmarkStyle, 1)}\n `;\n }\n}\n"],"names":["AdviceType","AdviceState"],"mappings":";;AAGY,IAAA,+BAAAA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AA;AAAA,cACG,WAAW,OAAO,UAAU,OAAO,UAAU,OAAO,UAAU,cAAwB,YAAY,QAAQ,SAAS,CAAC;AAAA,cACpH,SAAS,OAAO,UAAU,aAAa,SAAS,eAAe,CAAC,CAAC;AAAA,cACjE,SAAS,OAAO,UAAU,aAAa,SAAS,eAAe,CAAC,CAAC;AAAA;AAAA,EAE7E;AACF;"}
@@ -0,0 +1,3 @@
1
+ import { SVGTemplateResult } from 'lit-html';
2
+ export declare function renderLabels(scale: number): SVGTemplateResult;
3
+ //# sourceMappingURL=label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/watch/label.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAEhD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAkE7D"}
@@ -0,0 +1,68 @@
1
+ import { svg } from "lit-html";
2
+ function renderLabels(scale) {
3
+ const labelWidth = 32;
4
+ const gap = 8;
5
+ const radius = 368 / 2;
6
+ const labels = [
7
+ {
8
+ label: "E",
9
+ x: radius + gap / scale + labelWidth / 2,
10
+ y: 0,
11
+ class: "label"
12
+ },
13
+ {
14
+ label: "S",
15
+ x: 0,
16
+ y: radius + gap / scale + labelWidth / 2,
17
+ class: "label"
18
+ },
19
+ {
20
+ label: "W",
21
+ x: -(radius + gap / scale + labelWidth / 2),
22
+ y: 0,
23
+ class: "label"
24
+ }
25
+ ];
26
+ let arrow = svg`<defs>
27
+ <mask id="circleMask">
28
+ <rect x="-${radius}" y="-${radius}" width="${radius * 2}" height="${radius * 2}" fill="black"/>
29
+ <circle cx="0" cy="0" r="${radius}" fill="white"/>
30
+ </mask>
31
+ </defs>
32
+ <g mask="url(#circleMask)" transform="translate(0, ${-(radius + 45 / scale)}) scale(${1 / scale}, ${1 / scale})">
33
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M-32.04 42.7192 0 0 32.039 42.7192C21.627 40.9314 10.922 40 0 40-10.922 40-21.627 40.9314-32.04 42.7192Z"
34
+ fill="var(--instrument-tick-mark-secondary-color)"/>
35
+ <path d="M5.003 29H2.091L-3.013 20.264H-3.077C-3.066 20.52-3.056 20.7813-3.045 21.048-3.034 21.3147-3.024 21.5867-3.013 21.864-2.992 22.1307-2.976 22.4027-2.965 22.68-2.954 22.9573-2.944 23.2347-2.933 23.512V29H-4.997V17.576H-2.101L2.987 26.232H3.035C3.024 25.9867 3.014 25.736 3.003 25.48 2.992 25.2133 2.982 24.952 2.971 24.696 2.971 24.4293 2.966 24.1627 2.955 23.896 2.944 23.6293 2.934 23.3627 2.923 23.096V17.576H5.003V29Z" fill="var(--element-active-inverted-color)"/>
36
+ </g>`;
37
+ if (scale < 0.58) {
38
+ arrow = svg`
39
+ <g mask="url(#circleMask)" transform="translate(0, ${-radius})">
40
+ <path fill-rule="evenodd" clip-rule="evenodd" 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" fill="var(--instrument-frame-tertiary-color)"/>
41
+ </g>`;
42
+ labels.push({
43
+ label: "N",
44
+ x: 0,
45
+ y: -(radius + gap / scale + labelWidth / 2),
46
+ class: "label"
47
+ });
48
+ }
49
+ return svg`
50
+ ${arrow}
51
+
52
+ ${labels.map(
53
+ (l) => svg`
54
+ <text
55
+ x="${l.x}"
56
+ y="${l.y}"
57
+ class="${l.class}"
58
+ >
59
+ ${l.label}
60
+ </text>
61
+ `
62
+ )}
63
+ `;
64
+ }
65
+ export {
66
+ renderLabels
67
+ };
68
+ //# sourceMappingURL=label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.js","sources":["../../../src/navigation-instruments/watch/label.ts"],"sourcesContent":["import {svg, SVGTemplateResult} from 'lit-html';\n\nexport function renderLabels(scale: number): SVGTemplateResult {\n const labelWidth = 32;\n const gap = 8;\n const radius: number = 368 / 2;\n const labels = [\n {\n label: 'E',\n x: radius + gap / scale + labelWidth / 2,\n y: 0,\n class: 'label',\n },\n {\n label: 'S',\n x: 0,\n y: radius + gap / scale + labelWidth / 2,\n class: 'label',\n },\n {\n label: 'W',\n x: -(radius + gap / scale + labelWidth / 2),\n y: 0,\n class: 'label',\n },\n ];\n\n let arrow = svg`<defs>\n <mask id=\"circleMask\">\n <rect x=\"-${radius}\" y=\"-${radius}\" width=\"${radius * 2}\" height=\"${radius * 2}\" fill=\"black\"/>\n <circle cx=\"0\" cy=\"0\" r=\"${radius}\" fill=\"white\"/>\n </mask>\n </defs>\n <g mask=\"url(#circleMask)\" transform=\"translate(0, ${-(radius + 45 / scale)}) scale(${1 / scale}, ${1 / scale})\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M-32.04 42.7192 0 0 32.039 42.7192C21.627 40.9314 10.922 40 0 40-10.922 40-21.627 40.9314-32.04 42.7192Z\" \n fill=\"var(--instrument-tick-mark-secondary-color)\"/>\n <path d=\"M5.003 29H2.091L-3.013 20.264H-3.077C-3.066 20.52-3.056 20.7813-3.045 21.048-3.034 21.3147-3.024 21.5867-3.013 21.864-2.992 22.1307-2.976 22.4027-2.965 22.68-2.954 22.9573-2.944 23.2347-2.933 23.512V29H-4.997V17.576H-2.101L2.987 26.232H3.035C3.024 25.9867 3.014 25.736 3.003 25.48 2.992 25.2133 2.982 24.952 2.971 24.696 2.971 24.4293 2.966 24.1627 2.955 23.896 2.944 23.6293 2.934 23.3627 2.923 23.096V17.576H5.003V29Z\" fill=\"var(--element-active-inverted-color)\"/>\n </g>`;\n\n if (scale < 0.58) {\n arrow = svg`\n <g mask=\"url(#circleMask)\" transform=\"translate(0, ${-radius})\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" 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\" fill=\"var(--instrument-frame-tertiary-color)\"/>\n </g>`;\n\n labels.push({\n label: 'N',\n x: 0,\n y: -(radius + gap / scale + labelWidth / 2),\n class: 'label',\n });\n }\n\n return svg`\n ${arrow}\n\n ${labels.map(\n (l) => svg`\n <text\n x=\"${l.x}\"\n y=\"${l.y}\"\n class=\"${l.class}\"\n >\n ${l.label}\n </text>\n `\n )}\n `;\n}\n"],"names":[],"mappings":";AAEO,SAAS,aAAa,OAAkC;AAC7D,QAAM,aAAa;AACnB,QAAM,MAAM;AACZ,QAAM,SAAiB,MAAM;AAC7B,QAAM,SAAS;AAAA,IACb;AAAA,MACE,OAAO;AAAA,MACP,GAAG,SAAS,MAAM,QAAQ,aAAa;AAAA,MACvC,GAAG;AAAA,MACH,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,GAAG;AAAA,MACH,GAAG,SAAS,MAAM,QAAQ,aAAa;AAAA,MACvC,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,GAAG,EAAE,SAAS,MAAM,QAAQ,aAAa;AAAA,MACzC,GAAG;AAAA,MACH,OAAO;AAAA,IACT;AAAA,EAAA;AAGF,MAAI,QAAQ;AAAA;AAAA,wBAEU,MAAM,SAAS,MAAM,YAAY,SAAS,CAAC,aAAa,SAAS,CAAC;AAAA,uCACnD,MAAM;AAAA;AAAA;AAAA,yDAGY,EAAE,SAAS,KAAK,MAAM,WAAW,IAAI,KAAK,KAAK,IAAI,KAAK;AAAA;AAAA;AAAA;AAAA;AAM/G,MAAI,QAAQ,MAAM;AACR,YAAA;AAAA,2DAC+C,CAAC,MAAM;AAAA;AAAA;AAI9D,WAAO,KAAK;AAAA,MACV,OAAO;AAAA,MACP,GAAG;AAAA,MACH,GAAG,EAAE,SAAS,MAAM,QAAQ,aAAa;AAAA,MACzC,OAAO;AAAA,IAAA,CACR;AAAA,EACH;AAEO,SAAA;AAAA,MACH,KAAK;AAAA;AAAA,MAEL,OAAO;AAAA,IACP,CAAC,MAAM;AAAA;AAAA,eAEE,EAAE,CAAC;AAAA,eACH,EAAE,CAAC;AAAA,mBACC,EAAE,KAAK;AAAA;AAAA,YAEd,EAAE,KAAK;AAAA;AAAA;AAAA,EAAA,CAGd;AAAA;AAEL;"}
@@ -1,22 +1,23 @@
1
1
  import { css } from "lit";
2
2
  const compentStyle = css`* {
3
- box-sizing: border-box;
3
+ box-sizing: border-box;
4
4
  }
5
5
 
6
6
  .label {
7
- /* UI/Body */
8
- font-family: 'Noto Sans';
9
- font-size: 16px;
10
- font-style: normal;
11
- font-weight: 370;
12
- line-height: 24px;
13
- /* 150% */
14
- text-decoration: none;
15
- font-size: calc(16px / var(--scale));
16
- fill: var(--element-neutral-color);
17
- alignment-baseline: middle;
18
- text-anchor: middle;
19
- }`;
7
+ /* UI/Body */
8
+ font-family: 'Noto Sans';
9
+ font-size: 16px;
10
+ font-style: normal;
11
+ font-weight: 370;
12
+ line-height: 24px;
13
+ /* 150% */
14
+ text-decoration: none;
15
+ font-size: calc(16px / var(--scale));
16
+ fill: var(--element-neutral-color);
17
+ alignment-baseline: middle;
18
+ text-anchor: middle;
19
+ }
20
+ `;
20
21
  export {
21
22
  compentStyle as default
22
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"watch.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"watch.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
@@ -13,8 +13,11 @@ export declare class ObcWatch extends LitElement {
13
13
  roundInsideCut: boolean;
14
14
  tickmarks: Tickmark[];
15
15
  advices: AngleAdviceRaw[];
16
+ crosshairEnabled: boolean;
17
+ labelFrameEnabled: boolean;
16
18
  private _resizeController;
17
19
  private watchCircle;
20
+ private renderCrosshair;
18
21
  render(): import("lit-html").TemplateResult<1>;
19
22
  private renderSetpoint;
20
23
  static styles: import("lit").CSSResult;
@@ -1 +1 @@
1
- {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/watch/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAMX,MAAM,KAAK,CAAC;AAIb,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAC,cAAc,EAAe,MAAM,UAAU,CAAC;AACtD,OAAO,EAAC,QAAQ,EAA0B,MAAM,YAAY,CAAC;AAE7D,qBACa,QAAS,SAAQ,UAAU;IACZ,KAAK,EAAE,eAAe,CAA6B;IACnD,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,eAAe,EAAE,OAAO,CAAS;IAClC,OAAO,SAAM;IACb,aAAa,EAAE,MAAM,GAAG,IAAI,CAAQ;IACpC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;IACjC,eAAe,UAAS;IACxB,cAAc,UAAS;IACP,SAAS,EAAE,QAAQ,EAAE,CAAM;IAC3B,OAAO,EAAE,cAAc,EAAE,CAAM;IAI1E,OAAO,CAAC,iBAAiB,CAAkC;IAE3D,OAAO,CAAC,WAAW;IA2DV,MAAM;IAuBf,OAAO,CAAC,cAAc;IA8CtB,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
1
+ {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/watch/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAMX,MAAM,KAAK,CAAC;AAIb,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAC,cAAc,EAAe,MAAM,UAAU,CAAC;AACtD,OAAO,EAAC,QAAQ,EAA0B,MAAM,YAAY,CAAC;AAG7D,qBACa,QAAS,SAAQ,UAAU;IACZ,KAAK,EAAE,eAAe,CAA6B;IACnD,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,eAAe,EAAE,OAAO,CAAS;IAClC,OAAO,SAAM;IACb,aAAa,EAAE,MAAM,GAAG,IAAI,CAAQ;IACpC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;IACjC,eAAe,UAAS;IACxB,cAAc,UAAS;IACP,SAAS,EAAE,QAAQ,EAAE,CAAM;IAC3B,OAAO,EAAE,cAAc,EAAE,CAAM;IAC/C,gBAAgB,EAAE,OAAO,CAAS;IAClC,iBAAiB,EAAE,OAAO,CAAS;IAI9D,OAAO,CAAC,iBAAiB,CAAkC;IAE3D,OAAO,CAAC,WAAW;IA2DnB,OAAO,CAAC,eAAe;IAuBd,MAAM;IA0Bf,OAAO,CAAC,cAAc;IA8CtB,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
@@ -7,6 +7,7 @@ import compentStyle from "./watch.css.js";
7
7
  import { ResizeController } from "@lit-labs/observers/resize-controller.js";
8
8
  import { renderAdvice } from "./advice.js";
9
9
  import { tickmark, TickmarkStyle } from "./tickmark.js";
10
+ import { renderLabels } from "./label.js";
10
11
  var __defProp = Object.defineProperty;
11
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
13
  var __decorateClass = (decorators, target, key, kind) => {
@@ -30,6 +31,8 @@ let ObcWatch = class extends LitElement {
30
31
  this.roundInsideCut = false;
31
32
  this.tickmarks = [];
32
33
  this.advices = [];
34
+ this.crosshairEnabled = false;
35
+ this.labelFrameEnabled = false;
33
36
  this._resizeController = new ResizeController(this, {});
34
37
  }
35
38
  watchCircle() {
@@ -82,6 +85,28 @@ let ObcWatch = class extends LitElement {
82
85
  `;
83
86
  }
84
87
  }
88
+ renderCrosshair(radius) {
89
+ return svg`
90
+ <line
91
+ x1="-${radius}"
92
+ y1="0"
93
+ x2="${radius}"
94
+ y2="0"
95
+ stroke="var(--instrument-frame-tertiary-color)"
96
+ stroke-width="1"
97
+ vector-effect="non-scaling-stroke"
98
+ />
99
+ <line
100
+ x1="0"
101
+ y1="-${radius}"
102
+ x2="0"
103
+ y2="${radius}"
104
+ stroke="var(--instrument-frame-tertiary-color)"
105
+ stroke-width="1"
106
+ vector-effect="non-scaling-stroke"
107
+ />
108
+ `;
109
+ }
85
110
  render() {
86
111
  const width = (176 + this.padding) * 2;
87
112
  const viewBox = `-${width / 2} -${width / 2} ${width} ${width}`;
@@ -91,6 +116,7 @@ let ObcWatch = class extends LitElement {
91
116
  (t) => tickmark(t.angle, t.type, TickmarkStyle.hinted, scale, t.text)
92
117
  );
93
118
  const advices = this.advices ? this.advices.map((a) => renderAdvice(a)) : nothing;
119
+ const labels = this.labelFrameEnabled ? renderLabels(scale) : nothing;
94
120
  return html`
95
121
  <svg
96
122
  width="100%"
@@ -98,7 +124,8 @@ let ObcWatch = class extends LitElement {
98
124
  viewBox=${viewBox}
99
125
  style="--scale: ${scale}"
100
126
  >
101
- ${this.watchCircle()} ${tickmarks} ${advices} ${angleSetpoint}
127
+ ${this.watchCircle()} ${tickmarks} ${advices} ${angleSetpoint} ${labels}
128
+ ${this.crosshairEnabled ? this.renderCrosshair(320 / 2) : nothing}
102
129
  </svg>
103
130
  `;
104
131
  }
@@ -176,6 +203,12 @@ __decorateClass([
176
203
  __decorateClass([
177
204
  property({ type: Array, attribute: false })
178
205
  ], ObcWatch.prototype, "advices", 2);
206
+ __decorateClass([
207
+ property({ type: Boolean })
208
+ ], ObcWatch.prototype, "crosshairEnabled", 2);
209
+ __decorateClass([
210
+ property({ type: Boolean })
211
+ ], ObcWatch.prototype, "labelFrameEnabled", 2);
179
212
  ObcWatch = __decorateClass([
180
213
  customElement("obc-watch")
181
214
  ], ObcWatch);
@@ -1 +1 @@
1
- {"version":3,"file":"watch.js","sources":["../../../src/navigation-instruments/watch/watch.ts"],"sourcesContent":["import {\n LitElement,\n SVGTemplateResult,\n html,\n nothing,\n svg,\n unsafeCSS,\n} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport {circle} from '../../svghelpers';\nimport {roundedArch} from '../../svghelpers/roundedArch';\nimport {InstrumentState} from '../types';\nimport compentStyle from './watch.css?inline';\nimport {ResizeController} from '@lit-labs/observers/resize-controller.js';\nimport {AngleAdviceRaw, renderAdvice} from './advice';\nimport {Tickmark, TickmarkStyle, tickmark} from './tickmark';\n\n@customElement('obc-watch')\nexport class ObcWatch extends LitElement {\n @property({type: String}) state: InstrumentState = InstrumentState.inCommand;\n @property({type: Number}) angleSetpoint: number | undefined;\n @property({type: Boolean}) atAngleSetpoint: boolean = false;\n @property({type: Number}) padding = 24;\n @property({type: Number}) cutAngleStart: number | null = null;\n @property({type: Number}) cutAngleEnd: number | null = null;\n @property({type: Boolean}) roundOutsideCut = false;\n @property({type: Boolean}) roundInsideCut = false;\n @property({type: Array, attribute: false}) tickmarks: Tickmark[] = [];\n @property({type: Array, attribute: false}) advices: AngleAdviceRaw[] = [];\n\n // @ts-expect-error TS6133: The controller unsures that the render\n // function is called on resize of the element\n private _resizeController = new ResizeController(this, {});\n\n private watchCircle(): SVGTemplateResult {\n if (this.cutAngleStart === null || this.cutAngleEnd === null) {\n return svg`\n <defs>\n <mask id=\"mask1\" x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">\n <rect x=\"-200\" y=\"-200\" width=\"400\" height=\"400\" fill=\"white\" />\n <circle cx=\"0\" cy=\"0\" r=\"160\" fill=\"black\" />\n </mask>\n </defs>\n ${\n this.state === InstrumentState.off\n ? null\n : svg`\n <circle\n cx=\"0\"\n cy=\"0\"\n r=\"184\"\n fill=\"var(--instrument-frame-primary-color)\"\n mask=\"url(#mask1)\"\n />`\n }\n ${circle('innerRing', {\n radius: 320 / 2,\n strokeWidth: 1,\n strokeColor: 'var(--instrument-frame-tertiary-color)',\n strokePosition: 'center',\n fillColor: 'none',\n })}\n ${\n this.state === InstrumentState.off\n ? null\n : circle('outerRing', {\n radius: 368 / 2,\n strokeWidth: 1,\n strokeColor: 'var(--instrument-frame-tertiary-color)',\n strokePosition: 'center',\n fillColor: 'none',\n })\n }\n `;\n } else {\n const R = 184;\n const r = 160;\n const svgPath = roundedArch({\n startAngle: this.cutAngleStart,\n endAngle: this.cutAngleEnd,\n R,\n r,\n roundOutsideCut: this.roundOutsideCut,\n roundInsideCut: this.roundInsideCut,\n });\n return svg`\n <path d=${svgPath} fill=\"var(--instrument-frame-primary-color)\" \n stroke=\"var(--instrument-frame-tertiary-color)\"\n vector-effect=\"non-scaling-stroke\"/>\n `;\n }\n }\n\n override render() {\n const width = (176 + this.padding) * 2;\n const viewBox = `-${width / 2} -${width / 2} ${width} ${width}`;\n const angleSetpoint = this.renderSetpoint();\n const scale = this.clientWidth / width;\n const tickmarks = this.tickmarks.map((t) =>\n tickmark(t.angle, t.type, TickmarkStyle.hinted, scale, t.text)\n );\n const advices = this.advices\n ? this.advices.map((a) => renderAdvice(a))\n : nothing;\n return html`\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox=${viewBox}\n style=\"--scale: ${scale}\"\n >\n ${this.watchCircle()} ${tickmarks} ${advices} ${angleSetpoint}\n </svg>\n `;\n }\n\n private renderSetpoint(): SVGTemplateResult | typeof nothing {\n let setPointColor = 'var(--instrument-enhanced-primary-color)';\n if (this.atAngleSetpoint) {\n setPointColor = 'var(--instrument-enhanced-secondary-color)';\n }\n if (this.state === InstrumentState.active) {\n setPointColor = 'var(--instrument-regular-primary-color)';\n if (this.atAngleSetpoint) {\n setPointColor = 'var(--instrument-regular-secondary-color)';\n }\n } else if (this.state === InstrumentState.loading) {\n setPointColor = 'var(--instrument-frame-tertiary-color)';\n } else if (this.state === InstrumentState.off) {\n setPointColor = 'var(--instrument-frame-tertiary-color)';\n }\n\n if (this.angleSetpoint === undefined) {\n return nothing;\n } else {\n let path;\n if (this.state === InstrumentState.inCommand) {\n path =\n 'M23.5119 8C24.6981 6.35191 23.5696 4 21.5926 4L2.39959 4C0.422598 4 -0.705911 6.35191 0.480283 8L11.9961 24L23.5119 8Z';\n } else {\n path =\n 'M18.5836 8L5.4086 8L11.9961 17.1526L18.5836 8ZM23.5119 8C24.6981 6.35191 23.5696 4 21.5926 4L2.39959 4C0.422598 4 -0.705911 6.35191 0.480283 8L11.9961 24L23.5119 8Z';\n }\n return svg`\n <defs>\n <g id=\"setpoint\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" transform=\"translate(-24 12) rotate(-90)\" d=${path} vector-effect=\"non-scaling-stroke\"/>\n </g>\n <mask id=\"setpointMask\">\n <rect x=\"-20\" y=\"-20\" width=\"50\" height=\"50\" fill=\"white\" />\n <use href=\"#setpoint\" fill=\"black\" />\n </mask>\n </defs>\n <g transform=\"rotate(${this.angleSetpoint + 90}) translate(-168 0) \">\n <use href=\"#setpoint\" fill=${setPointColor} stroke-width=\"0\" />\n \n <use href=\"#setpoint\" vector-effect=\"non-scaling-stroke\" fill=\"none\" stroke=\"var(--border-silhouette-color)\" stroke-width=\"2\" stroke-linejoin=\"round\" mask=\"url(#setpointMask)\" />\n </g>\n `;\n }\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-watch': ObcWatch;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBa,IAAA,WAAN,cAAuB,WAAW;AAAA,EAAlC,cAAA;AAAA,UAAA,GAAA,SAAA;AACqB,SAAA,QAAyB,gBAAgB;AAEb,SAAA,kBAAA;AAClB,SAAA,UAAA;AACqB,SAAA,gBAAA;AACF,SAAA,cAAA;AACV,SAAA,kBAAA;AACD,SAAA,iBAAA;AACD,SAAA,YAAwB;AACxB,SAAA,UAA4B;AAIvE,SAAQ,oBAAoB,IAAI,iBAAiB,MAAM,CAAE,CAAA;AAAA,EAAA;AAAA,EAEjD,cAAiC;AACvC,QAAI,KAAK,kBAAkB,QAAQ,KAAK,gBAAgB,MAAM;AACrD,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAQH,KAAK,UAAU,gBAAgB,MAC3B,OACA;AA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AA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GAPd,SAOgB,WAAA,mBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GARd,SAQgB,WAAA,kBAAA,CAAA;AACgB,gBAAA;AAAA,EAA1C,SAAS,EAAC,MAAM,OAAO,WAAW,OAAM;AAAA,GAT9B,SASgC,WAAA,aAAA,CAAA;AACA,gBAAA;AAAA,EAA1C,SAAS,EAAC,MAAM,OAAO,WAAW,OAAM;AAAA,GAV9B,SAUgC,WAAA,WAAA,CAAA;AAVhC,WAAN,gBAAA;AAAA,EADN,cAAc,WAAW;AAAA,GACb,QAAA;"}
1
+ {"version":3,"file":"watch.js","sources":["../../../src/navigation-instruments/watch/watch.ts"],"sourcesContent":["import {\n LitElement,\n SVGTemplateResult,\n html,\n nothing,\n svg,\n unsafeCSS,\n} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport {circle} from '../../svghelpers';\nimport {roundedArch} from '../../svghelpers/roundedArch';\nimport {InstrumentState} from '../types';\nimport compentStyle from './watch.css?inline';\nimport {ResizeController} from '@lit-labs/observers/resize-controller.js';\nimport {AngleAdviceRaw, renderAdvice} from './advice';\nimport {Tickmark, TickmarkStyle, tickmark} from './tickmark';\nimport {renderLabels} from './label';\n\n@customElement('obc-watch')\nexport class ObcWatch extends LitElement {\n @property({type: String}) state: InstrumentState = InstrumentState.inCommand;\n @property({type: Number}) angleSetpoint: number | undefined;\n @property({type: Boolean}) atAngleSetpoint: boolean = false;\n @property({type: Number}) padding = 24;\n @property({type: Number}) cutAngleStart: number | null = null;\n @property({type: Number}) cutAngleEnd: number | null = null;\n @property({type: Boolean}) roundOutsideCut = false;\n @property({type: Boolean}) roundInsideCut = false;\n @property({type: Array, attribute: false}) tickmarks: Tickmark[] = [];\n @property({type: Array, attribute: false}) advices: AngleAdviceRaw[] = [];\n @property({type: Boolean}) crosshairEnabled: boolean = false;\n @property({type: Boolean}) labelFrameEnabled: boolean = false;\n\n // @ts-expect-error TS6133: The controller unsures that the render\n // function is called on resize of the element\n private _resizeController = new ResizeController(this, {});\n\n private watchCircle(): SVGTemplateResult {\n if (this.cutAngleStart === null || this.cutAngleEnd === null) {\n return svg`\n <defs>\n <mask id=\"mask1\" x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">\n <rect x=\"-200\" y=\"-200\" width=\"400\" height=\"400\" fill=\"white\" />\n <circle cx=\"0\" cy=\"0\" r=\"160\" fill=\"black\" />\n </mask>\n </defs>\n ${\n this.state === InstrumentState.off\n ? null\n : svg`\n <circle\n cx=\"0\"\n cy=\"0\"\n r=\"184\"\n fill=\"var(--instrument-frame-primary-color)\"\n mask=\"url(#mask1)\"\n />`\n }\n ${circle('innerRing', {\n radius: 320 / 2,\n strokeWidth: 1,\n strokeColor: 'var(--instrument-frame-tertiary-color)',\n strokePosition: 'center',\n fillColor: 'none',\n })}\n ${\n this.state === InstrumentState.off\n ? null\n : circle('outerRing', {\n radius: 368 / 2,\n strokeWidth: 1,\n strokeColor: 'var(--instrument-frame-tertiary-color)',\n strokePosition: 'center',\n fillColor: 'none',\n })\n }\n `;\n } else {\n const R = 184;\n const r = 160;\n const svgPath = roundedArch({\n startAngle: this.cutAngleStart,\n endAngle: this.cutAngleEnd,\n R,\n r,\n roundOutsideCut: this.roundOutsideCut,\n roundInsideCut: this.roundInsideCut,\n });\n return svg`\n <path d=${svgPath} fill=\"var(--instrument-frame-primary-color)\" \n stroke=\"var(--instrument-frame-tertiary-color)\"\n vector-effect=\"non-scaling-stroke\"/>\n `;\n }\n }\n\n private renderCrosshair(radius: number): SVGTemplateResult {\n return svg`\n <line\n x1=\"-${radius}\"\n y1=\"0\"\n x2=\"${radius}\"\n y2=\"0\"\n stroke=\"var(--instrument-frame-tertiary-color)\"\n stroke-width=\"1\"\n vector-effect=\"non-scaling-stroke\"\n />\n <line\n x1=\"0\"\n y1=\"-${radius}\"\n x2=\"0\"\n y2=\"${radius}\"\n stroke=\"var(--instrument-frame-tertiary-color)\"\n stroke-width=\"1\"\n vector-effect=\"non-scaling-stroke\"\n />\n `;\n }\n\n override render() {\n const width = (176 + this.padding) * 2;\n const viewBox = `-${width / 2} -${width / 2} ${width} ${width}`;\n const angleSetpoint = this.renderSetpoint();\n const scale = this.clientWidth / width;\n const tickmarks = this.tickmarks.map((t) =>\n tickmark(t.angle, t.type, TickmarkStyle.hinted, scale, t.text)\n );\n const advices = this.advices\n ? this.advices.map((a) => renderAdvice(a))\n : nothing;\n const labels = this.labelFrameEnabled ? renderLabels(scale) : nothing;\n\n return html`\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox=${viewBox}\n style=\"--scale: ${scale}\"\n >\n ${this.watchCircle()} ${tickmarks} ${advices} ${angleSetpoint} ${labels}\n ${this.crosshairEnabled ? this.renderCrosshair(320 / 2) : nothing}\n </svg>\n `;\n }\n\n private renderSetpoint(): SVGTemplateResult | typeof nothing {\n let setPointColor = 'var(--instrument-enhanced-primary-color)';\n if (this.atAngleSetpoint) {\n setPointColor = 'var(--instrument-enhanced-secondary-color)';\n }\n if (this.state === InstrumentState.active) {\n setPointColor = 'var(--instrument-regular-primary-color)';\n if (this.atAngleSetpoint) {\n setPointColor = 'var(--instrument-regular-secondary-color)';\n }\n } else if (this.state === InstrumentState.loading) {\n setPointColor = 'var(--instrument-frame-tertiary-color)';\n } else if (this.state === InstrumentState.off) {\n setPointColor = 'var(--instrument-frame-tertiary-color)';\n }\n\n if (this.angleSetpoint === undefined) {\n return nothing;\n } else {\n let path;\n if (this.state === InstrumentState.inCommand) {\n path =\n 'M23.5119 8C24.6981 6.35191 23.5696 4 21.5926 4L2.39959 4C0.422598 4 -0.705911 6.35191 0.480283 8L11.9961 24L23.5119 8Z';\n } else {\n path =\n 'M18.5836 8L5.4086 8L11.9961 17.1526L18.5836 8ZM23.5119 8C24.6981 6.35191 23.5696 4 21.5926 4L2.39959 4C0.422598 4 -0.705911 6.35191 0.480283 8L11.9961 24L23.5119 8Z';\n }\n return svg`\n <defs>\n <g id=\"setpoint\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" transform=\"translate(-24 12) rotate(-90)\" d=${path} vector-effect=\"non-scaling-stroke\"/>\n </g>\n <mask id=\"setpointMask\">\n <rect x=\"-20\" y=\"-20\" width=\"50\" height=\"50\" fill=\"white\" />\n <use href=\"#setpoint\" fill=\"black\" />\n </mask>\n </defs>\n <g transform=\"rotate(${this.angleSetpoint + 90}) translate(-168 0) \">\n <use href=\"#setpoint\" fill=${setPointColor} stroke-width=\"0\" />\n \n <use href=\"#setpoint\" vector-effect=\"non-scaling-stroke\" fill=\"none\" stroke=\"var(--border-silhouette-color)\" stroke-width=\"2\" stroke-linejoin=\"round\" mask=\"url(#setpointMask)\" />\n </g>\n `;\n }\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-watch': ObcWatch;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmBa,IAAA,WAAN,cAAuB,WAAW;AAAA,EAAlC,cAAA;AAAA,UAAA,GAAA,SAAA;AACqB,SAAA,QAAyB,gBAAgB;AAEb,SAAA,kBAAA;AAClB,SAAA,UAAA;AACqB,SAAA,gBAAA;AACF,SAAA,cAAA;AACV,SAAA,kBAAA;AACD,SAAA,iBAAA;AACD,SAAA,YAAwB;AACxB,SAAA,UAA4B;AAChB,SAAA,mBAAA;AACC,SAAA,oBAAA;AAIxD,SAAQ,oBAAoB,IAAI,iBAAiB,MAAM,CAAE,CAAA;AAAA,EAAA;AAAA,EAEjD,cAAiC;AACvC,QAAI,KAAK,kBAAkB,QAAQ,KAAK,gBAAgB,MAAM;AACrD,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAQH,KAAK,UAAU,gBAAgB,MAC3B,OACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAQN;AAAA,UACE,OAAO,aAAa;AAAA,QACpB,QAAQ,MAAM;A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zB,SAAS,EAAC,MAAM,QAAO;AAAA,GAJb,SAIe,WAAA,WAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GALb,SAKe,WAAA,iBAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GANb,SAMe,WAAA,eAAA,CAAA;AACC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GAPd,SAOgB,WAAA,mBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GARd,SAQgB,WAAA,kBAAA,CAAA;AACgB,gBAAA;AAAA,EAA1C,SAAS,EAAC,MAAM,OAAO,WAAW,OAAM;AAAA,GAT9B,SASgC,WAAA,aAAA,CAAA;AACA,gBAAA;AAAA,EAA1C,SAAS,EAAC,MAAM,OAAO,WAAW,OAAM;AAAA,GAV9B,SAUgC,WAAA,WAAA,CAAA;AAChB,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GAXd,SAWgB,WAAA,oBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GAZd,SAYgB,WAAA,qBAAA,CAAA;AAZhB,WAAN,gBAAA;AAAA,EADN,cAAc,WAAW;AAAA,GACb,QAAA;"}
@@ -0,0 +1,20 @@
1
+ import { SVGTemplateResult } from 'lit';
2
+ export interface Tickmark {
3
+ angle: number;
4
+ type: TickmarkType;
5
+ text?: string;
6
+ }
7
+ export declare enum TickmarkType {
8
+ main = "main",
9
+ primary = "primary",
10
+ secondary = "secondary",
11
+ tertiary = "tertiary"
12
+ }
13
+ export declare enum TickmarkStyle {
14
+ hinted = "hinted",
15
+ regular = "regular",
16
+ enhanced = "enhanced"
17
+ }
18
+ export declare function tickmarkColor(style: TickmarkStyle): string;
19
+ export declare function tickmark(angle: number, tickmarkSize: TickmarkType, style: TickmarkStyle, text?: string): SVGTemplateResult | SVGTemplateResult[];
20
+ //# sourceMappingURL=tickmark-flat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tickmark-flat.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/watch-flat/tickmark-flat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAM,MAAM,KAAK,CAAC;AAE3C,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,YAAY;IACtB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,QAAQ,aAAa;CACtB;AAED,oBAAY,aAAa;IACvB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAQ1D;AAED,wBAAgB,QAAQ,CACtB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,aAAa,EACpB,IAAI,CAAC,EAAE,MAAM,GACZ,iBAAiB,GAAG,iBAAiB,EAAE,CAyBzC"}
@@ -0,0 +1,53 @@
1
+ import { svg } from "lit";
2
+ var TickmarkType = /* @__PURE__ */ ((TickmarkType2) => {
3
+ TickmarkType2["main"] = "main";
4
+ TickmarkType2["primary"] = "primary";
5
+ TickmarkType2["secondary"] = "secondary";
6
+ TickmarkType2["tertiary"] = "tertiary";
7
+ return TickmarkType2;
8
+ })(TickmarkType || {});
9
+ var TickmarkStyle = /* @__PURE__ */ ((TickmarkStyle2) => {
10
+ TickmarkStyle2["hinted"] = "hinted";
11
+ TickmarkStyle2["regular"] = "regular";
12
+ TickmarkStyle2["enhanced"] = "enhanced";
13
+ return TickmarkStyle2;
14
+ })(TickmarkStyle || {});
15
+ function tickmarkColor(style) {
16
+ if (style === "hinted") {
17
+ return "var(--instrument-frame-tertiary-color)";
18
+ } else if (style === "regular") {
19
+ return "var(--instrument-tick-mark-secondary-color)";
20
+ } else {
21
+ return "var(--instrument-tick-mark-primary-color)";
22
+ }
23
+ }
24
+ function tickmark(angle, tickmarkSize, style, text) {
25
+ const textHeight = -32;
26
+ let lineStartY = -35;
27
+ let lineEndY = -34;
28
+ if (tickmarkSize === "secondary") {
29
+ lineStartY = -24;
30
+ lineEndY = lineStartY + 8;
31
+ } else if (tickmarkSize === "main") {
32
+ lineEndY = lineStartY + 20;
33
+ } else if (tickmarkSize === "tertiary") {
34
+ throw new Error("Tertiary tickmarks are not supported");
35
+ }
36
+ const colorName = tickmarkColor(style);
37
+ const tick = svg`<line x1=${angle} y1=${lineStartY} x2=${angle} y2=${lineEndY} stroke=${colorName} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
38
+ if (text) {
39
+ const textY = lineEndY + textHeight;
40
+ return [
41
+ tick,
42
+ svg`<text x=${angle} y=${textY} class="label" text-anchor="middle">${text}</text>`
43
+ ];
44
+ }
45
+ return tick;
46
+ }
47
+ export {
48
+ TickmarkStyle,
49
+ TickmarkType,
50
+ tickmark,
51
+ tickmarkColor
52
+ };
53
+ //# sourceMappingURL=tickmark-flat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tickmark-flat.js","sources":["../../../src/navigation-instruments/watch-flat/tickmark-flat.ts"],"sourcesContent":["import {SVGTemplateResult, svg} from 'lit';\n\nexport interface Tickmark {\n angle: number;\n type: TickmarkType;\n text?: string;\n}\n\nexport enum TickmarkType {\n main = 'main',\n primary = 'primary',\n secondary = 'secondary',\n tertiary = 'tertiary',\n}\n\nexport enum TickmarkStyle {\n hinted = 'hinted',\n regular = 'regular',\n enhanced = 'enhanced',\n}\n\nexport function tickmarkColor(style: TickmarkStyle): string {\n if (style === TickmarkStyle.hinted) {\n return 'var(--instrument-frame-tertiary-color)';\n } else if (style === TickmarkStyle.regular) {\n return 'var(--instrument-tick-mark-secondary-color)';\n } else {\n return 'var(--instrument-tick-mark-primary-color)';\n }\n}\n\nexport function tickmark(\n angle: number,\n tickmarkSize: TickmarkType,\n style: TickmarkStyle,\n text?: string\n): SVGTemplateResult | SVGTemplateResult[] {\n const textHeight = -32;\n let lineStartY: number = -35;\n let lineEndY: number = -34;\n\n if (tickmarkSize === TickmarkType.secondary) {\n lineStartY = -24;\n lineEndY = lineStartY + 8;\n } else if (tickmarkSize === TickmarkType.main) {\n lineEndY = lineStartY + 20;\n } else if (tickmarkSize === TickmarkType.tertiary) {\n throw new Error('Tertiary tickmarks are not supported');\n }\n\n const colorName = tickmarkColor(style);\n const tick = svg`<line x1=${angle} y1=${lineStartY} x2=${angle} y2=${lineEndY} stroke=${colorName} stroke-width=\"1\" vector-effect=\"non-scaling-stroke\"/>`;\n if (text) {\n const textY = lineEndY + textHeight;\n return [\n tick,\n svg`<text x=${angle} y=${textY} class=\"label\" text-anchor=\"middle\">${text}</text>`,\n ];\n }\n\n return tick;\n}\n"],"names":["TickmarkType","TickmarkStyle"],"mappings":";AAQY,IAAA,iCAAAA,kBAAL;AACLA,gBAAA,MAAO,IAAA;AACPA,gBAAA,SAAU,IAAA;AACVA,gBAAA,WAAY,IAAA;AACZA,gBAAA,UAAW,IAAA;AAJDA,SAAAA;AAAA,GAAA,gBAAA,CAAA,CAAA;AAOA,IAAA,kCAAAC,mBAAL;AACLA,iBAAA,QAAS,IAAA;AACTA,iBAAA,SAAU,IAAA;AACVA,iBAAA,UAAW,IAAA;AAHDA,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AAML,SAAS,cAAc,OAA8B;AAC1D,MAAI,UAAU,UAAsB;AAC3B,WAAA;AAAA,EAAA,WACE,UAAU,WAAuB;AACnC,WAAA;AAAA,EAAA,OACF;AACE,WAAA;AAAA,EACT;AACF;AAEO,SAAS,SACd,OACA,cACA,OACA,MACyC;AACzC,QAAM,aAAa;AACnB,MAAI,aAAqB;AACzB,MAAI,WAAmB;AAEvB,MAAI,iBAAiB,aAAwB;AAC9B,iBAAA;AACb,eAAW,aAAa;AAAA,EAAA,WACf,iBAAiB,QAAmB;AAC7C,eAAW,aAAa;AAAA,EAAA,WACf,iBAAiB,YAAuB;AAC3C,UAAA,IAAI,MAAM,sCAAsC;AAAA,EACxD;AAEM,QAAA,YAAY,cAAc,KAAK;AAC/B,QAAA,OAAO,eAAe,KAAK,OAAO,UAAU,OAAO,KAAK,OAAO,QAAQ,WAAW,SAAS;AACjG,MAAI,MAAM;AACR,UAAM,QAAQ,WAAW;AAClB,WAAA;AAAA,MACL;AAAA,MACA,cAAc,KAAK,MAAM,KAAK,uCAAuC,IAAI;AAAA,IAAA;AAAA,EAE7E;AAEO,SAAA;AACT;"}
@@ -0,0 +1,32 @@
1
+ import { css } from "lit";
2
+ const compentStyle = css`* {
3
+ box-sizing: border-box;
4
+ }
5
+
6
+ .label {
7
+ /* UI/Body */
8
+ font-family: 'Noto Sans';
9
+ font-size: 16px;
10
+ font-style: normal;
11
+ font-weight: 370;
12
+ line-height: 24px;
13
+ /* 150% */
14
+ text-decoration: none;
15
+ font-size: calc(16px / var(--scale));
16
+ fill: var(--element-neutral-color);
17
+ alignment-baseline: middle;
18
+ text-anchor: middle;
19
+ }
20
+
21
+ .label.left {
22
+ text-anchor: start;
23
+ }
24
+
25
+ .label.right {
26
+ text-anchor: end;
27
+ }
28
+ `;
29
+ export {
30
+ compentStyle as default
31
+ };
32
+ //# sourceMappingURL=watch-flat.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-flat.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,29 @@
1
+ import { LitElement, SVGTemplateResult } from 'lit';
2
+ import { Tickmark } from './tickmark-flat';
3
+ import { Label } from '../compass-flat/compass-flat';
4
+ export declare class ObcWatchFlat extends LitElement {
5
+ width: number;
6
+ height: number;
7
+ padding: number;
8
+ rotation: number;
9
+ tickmarkSpacing: number;
10
+ angleSetpoint: number | undefined;
11
+ tickmarks: Tickmark[];
12
+ labels: Label[];
13
+ FOVIndicator: SVGTemplateResult[];
14
+ trackHeight: number;
15
+ ticksHeight: number;
16
+ borderRadius: number;
17
+ private renderClipPath;
18
+ private renderLabelMask;
19
+ private renderLabels;
20
+ private watchFace;
21
+ render(): import("lit-html").TemplateResult<1>;
22
+ static styles: import("lit").CSSResult;
23
+ }
24
+ declare global {
25
+ interface HTMLElementTagNameMap {
26
+ 'obc-watch-flat': ObcWatchFlat;
27
+ }
28
+ }
29
+ //# sourceMappingURL=watch-flat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-flat.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/watch-flat/watch-flat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,iBAAiB,EAAuB,MAAM,KAAK,CAAC;AAGxE,OAAO,EAAC,QAAQ,EAA0B,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAC,KAAK,EAAC,MAAM,8BAA8B,CAAC;AAEnD,qBACa,YAAa,SAAQ,UAAU;IAChB,KAAK,SAAO;IACZ,MAAM,SAAM;IACZ,OAAO,SAAK;IACZ,QAAQ,SAAK;IACb,eAAe,SAAK;IACpB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IACjB,SAAS,EAAE,QAAQ,EAAE,CAAM;IAC3B,MAAM,EAAE,KAAK,EAAE,CAAM;IACrB,YAAY,EAAE,iBAAiB,EAAE,CACvE;IACqB,WAAW,SAAyB;IACpC,WAAW,SAAkC;IAC7C,YAAY,SAAK;IAE3C,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,eAAe;IAqBvB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,SAAS;IAwCR,MAAM;IA8Bf,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,YAAY,CAAC;KAChC;CACF"}