@oicl/openbridge-webcomponents-full-bundle 2.2.0-next.21 → 2.2.0-next.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/openbridge-webcomponents.bundle.js +113 -56
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +49 -21
- package/dist/automation/automation-tank/automation-tank.d.ts.map +1 -1
- package/dist/automation/automation-tank/automation-tank.js +2 -1
- package/dist/automation/automation-tank/automation-tank.js.map +1 -1
- package/dist/building-blocks/bar-horizontal/bar-horizontal.d.ts +4 -2
- package/dist/building-blocks/bar-horizontal/bar-horizontal.d.ts.map +1 -1
- package/dist/building-blocks/bar-horizontal/bar-horizontal.js +12 -6
- package/dist/building-blocks/bar-horizontal/bar-horizontal.js.map +1 -1
- package/dist/building-blocks/bar-vertical/bar-vertical.d.ts +4 -2
- package/dist/building-blocks/bar-vertical/bar-vertical.d.ts.map +1 -1
- package/dist/building-blocks/bar-vertical/bar-vertical.js +12 -6
- package/dist/building-blocks/bar-vertical/bar-vertical.js.map +1 -1
- package/dist/building-blocks/external-scale/external-scale.d.ts +21 -3
- package/dist/building-blocks/external-scale/external-scale.d.ts.map +1 -1
- package/dist/building-blocks/external-scale/external-scale.js +40 -17
- package/dist/building-blocks/external-scale/external-scale.js.map +1 -1
- package/dist/navigation-instruments/gauge-horizontal/gauge-horizontal.d.ts +4 -2
- package/dist/navigation-instruments/gauge-horizontal/gauge-horizontal.d.ts.map +1 -1
- package/dist/navigation-instruments/gauge-horizontal/gauge-horizontal.js +14 -6
- package/dist/navigation-instruments/gauge-horizontal/gauge-horizontal.js.map +1 -1
- package/dist/navigation-instruments/gauge-vertical/gauge-vertical.d.ts +4 -2
- package/dist/navigation-instruments/gauge-vertical/gauge-vertical.d.ts.map +1 -1
- package/dist/navigation-instruments/gauge-vertical/gauge-vertical.js +14 -6
- package/dist/navigation-instruments/gauge-vertical/gauge-vertical.js.map +1 -1
- package/dist/svghelpers/advice-linear.d.ts +7 -0
- package/dist/svghelpers/advice-linear.d.ts.map +1 -1
- package/dist/svghelpers/advice-linear.js +14 -10
- package/dist/svghelpers/advice-linear.js.map +1 -1
- package/dist/svghelpers/advice-patterns.d.ts +2 -2
- package/dist/svghelpers/advice-patterns.d.ts.map +1 -1
- package/dist/svghelpers/advice-patterns.js +6 -4
- package/dist/svghelpers/advice-patterns.js.map +1 -1
- package/package.json +1 -1
- package/src/automation/automation-tank/automation-tank.ts +4 -0
- package/src/building-blocks/bar-horizontal/bar-horizontal-fixed-aspect.spec.ts +50 -0
- package/src/building-blocks/bar-horizontal/bar-horizontal.stories.ts +6 -0
- package/src/building-blocks/bar-horizontal/bar-horizontal.ts +22 -9
- package/src/building-blocks/bar-vertical/bar-vertical-dimensions.spec.ts +36 -0
- package/src/building-blocks/bar-vertical/bar-vertical-fixed-aspect.spec.ts +49 -0
- package/src/building-blocks/bar-vertical/bar-vertical.stories.ts +6 -0
- package/src/building-blocks/bar-vertical/bar-vertical.ts +22 -9
- package/src/building-blocks/external-scale/external-scale.spec.ts +151 -0
- package/src/building-blocks/external-scale/external-scale.stories.ts +6 -0
- package/src/building-blocks/external-scale/external-scale.ts +86 -40
- package/src/navigation-instruments/gauge-horizontal/gauge-horizontal.spec.ts +55 -0
- package/src/navigation-instruments/gauge-horizontal/gauge-horizontal.stories.ts +2 -0
- package/src/navigation-instruments/gauge-horizontal/gauge-horizontal.ts +24 -9
- package/src/navigation-instruments/gauge-trend/gauge-trend.stories.ts +25 -0
- package/src/navigation-instruments/gauge-vertical/gauge-vertical.spec.ts +55 -0
- package/src/navigation-instruments/gauge-vertical/gauge-vertical.stories.ts +2 -0
- package/src/navigation-instruments/gauge-vertical/gauge-vertical.ts +24 -9
- package/src/svghelpers/advice-linear.ts +25 -11
- package/src/svghelpers/advice-patterns.ts +13 -5
|
@@ -23,6 +23,13 @@ const svgOf = (el: Element) => el.querySelector('svg')!;
|
|
|
23
23
|
const scaleOf = (el: Element) =>
|
|
24
24
|
parseFloat(svgOf(el).style.getPropertyValue('--scale'));
|
|
25
25
|
|
|
26
|
+
/** The painted thickness of the first advice band, in CSS px. */
|
|
27
|
+
const pillPx = (el: Element) => {
|
|
28
|
+
const svg = svgOf(el);
|
|
29
|
+
const band = svg.querySelector('path.advice-band') as SVGPathElement;
|
|
30
|
+
return +(band.getBBox().width * svg.getScreenCTM()!.a).toFixed(2);
|
|
31
|
+
};
|
|
32
|
+
|
|
26
33
|
/** Default bands and no setpoint: 48 bar + 24 ticks + 60 labels = 132 thick. */
|
|
27
34
|
async function mount(fixedAspectRatio = false): Promise<ObcGaugeVertical> {
|
|
28
35
|
const screen = render(
|
|
@@ -281,4 +288,52 @@ describe('obc-gauge-vertical sizing', () => {
|
|
|
281
288
|
await until(() => Math.abs(scaleOf(el) - 80 / 72) < 1e-3);
|
|
282
289
|
await until(() => reports[reports.length - 1] === 80);
|
|
283
290
|
});
|
|
291
|
+
|
|
292
|
+
it('keeps the advice pill at 8 px at every scale', async () => {
|
|
293
|
+
const screen = render(
|
|
294
|
+
html`<div style="display: block; width: 480px; height: 600px">
|
|
295
|
+
<obc-gauge-vertical
|
|
296
|
+
.minValue=${0}
|
|
297
|
+
.maxValue=${100}
|
|
298
|
+
.value=${40}
|
|
299
|
+
.primaryTickmarkInterval=${20}
|
|
300
|
+
.advices=${[{min: 20, max: 40, category: 'optimal'}]}
|
|
301
|
+
.fixedAspectRatio=${true}
|
|
302
|
+
></obc-gauge-vertical>
|
|
303
|
+
</div>`
|
|
304
|
+
);
|
|
305
|
+
const el = screen.container.querySelector(
|
|
306
|
+
'obc-gauge-vertical'
|
|
307
|
+
) as ObcGaugeVertical;
|
|
308
|
+
await el.updateComplete;
|
|
309
|
+
await until(() => Math.abs(scaleOf(el) - 600 / 384) < 1e-3);
|
|
310
|
+
expect(pillPx(el)).toBeCloseTo(8, 1);
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
it('reports the advice column when it is the widest band outside the bar', async () => {
|
|
314
|
+
const screen = render(
|
|
315
|
+
html`<div style="display: block; width: 480px; height: 192px">
|
|
316
|
+
<obc-gauge-vertical
|
|
317
|
+
.minValue=${0}
|
|
318
|
+
.maxValue=${100}
|
|
319
|
+
.value=${40}
|
|
320
|
+
.primaryTickmarkInterval=${20}
|
|
321
|
+
.showLabels=${false}
|
|
322
|
+
.advices=${[{min: 20, max: 40, category: 'optimal'}]}
|
|
323
|
+
.fixedAspectRatio=${true}
|
|
324
|
+
></obc-gauge-vertical>
|
|
325
|
+
</div>`
|
|
326
|
+
);
|
|
327
|
+
const el = screen.container.querySelector(
|
|
328
|
+
'obc-gauge-vertical'
|
|
329
|
+
) as ObcGaugeVertical;
|
|
330
|
+
const reports: number[] = [];
|
|
331
|
+
el.addEventListener('scale-dimensions-changed', (e) =>
|
|
332
|
+
reports.push((e as CustomEvent<{thickness: number}>).detail.thickness)
|
|
333
|
+
);
|
|
334
|
+
await el.updateComplete;
|
|
335
|
+
// At scale 0.5 the 16 px column is 32 units, past the 24 unit ticks:
|
|
336
|
+
// (48 + 32) × 0.5, not (48 + 24) × 0.5.
|
|
337
|
+
await until(() => reports[reports.length - 1] === 40);
|
|
338
|
+
});
|
|
284
339
|
});
|
|
@@ -689,6 +689,7 @@ export const FixedAspectRatioComparison: StoryObj = {
|
|
|
689
689
|
.value=${60}
|
|
690
690
|
.setpoint=${80}
|
|
691
691
|
.primaryTickmarkInterval=${20}
|
|
692
|
+
.advices=${[{min: 60, max: 80, type: AdviceType.caution, hinted: true}]}
|
|
692
693
|
.priority=${Priority.regular}
|
|
693
694
|
></obc-gauge-vertical>
|
|
694
695
|
</div>
|
|
@@ -703,6 +704,7 @@ export const FixedAspectRatioComparison: StoryObj = {
|
|
|
703
704
|
.value=${60}
|
|
704
705
|
.setpoint=${80}
|
|
705
706
|
.primaryTickmarkInterval=${20}
|
|
707
|
+
.advices=${[{min: 60, max: 80, type: AdviceType.caution, hinted: true}]}
|
|
706
708
|
.priority=${Priority.enhanced}
|
|
707
709
|
></obc-gauge-vertical>
|
|
708
710
|
</div>
|
|
@@ -10,7 +10,10 @@ import {
|
|
|
10
10
|
BorderRadiusPosition,
|
|
11
11
|
Priority,
|
|
12
12
|
} from '../types.js';
|
|
13
|
-
import type {
|
|
13
|
+
import type {
|
|
14
|
+
ExternalScaleConfig,
|
|
15
|
+
ExternalScaleLayoutConfig,
|
|
16
|
+
} from '../../building-blocks/external-scale/external-scale.js';
|
|
14
17
|
import {
|
|
15
18
|
computeExternalScaleViewBox,
|
|
16
19
|
computeFixedAspectRatioScale,
|
|
@@ -172,8 +175,17 @@ export class ObcGaugeVertical extends AdviceMixin(
|
|
|
172
175
|
@state()
|
|
173
176
|
private _scale = 1;
|
|
174
177
|
|
|
175
|
-
/** The
|
|
176
|
-
private
|
|
178
|
+
/** The last render's layout inputs, for the scale measurement. */
|
|
179
|
+
private _layoutConfig?: ExternalScaleLayoutConfig;
|
|
180
|
+
|
|
181
|
+
/** The drawing's width in viewBox units at a scale: the advice column is pixels, so it depends on it. */
|
|
182
|
+
private _thicknessAt = (scale: number): number =>
|
|
183
|
+
this._layoutConfig
|
|
184
|
+
? computeExternalScaleLayout({
|
|
185
|
+
...this._layoutConfig,
|
|
186
|
+
fixedAspectRatioScale: scale,
|
|
187
|
+
}).thickness
|
|
188
|
+
: 0;
|
|
177
189
|
|
|
178
190
|
// ResizeController automatically subscribes/unsubscribes based on component lifecycle
|
|
179
191
|
// @ts-expect-error - Controller is used for side effects, not accessed directly
|
|
@@ -189,7 +201,7 @@ export class ObcGaugeVertical extends AdviceMixin(
|
|
|
189
201
|
containerMainAxisSize: entry.contentRect.height,
|
|
190
202
|
containerCrossAxisSize: entry.contentRect.width,
|
|
191
203
|
scaleReferenceSize: this.scaleReferenceSize,
|
|
192
|
-
viewBoxThickness: this.
|
|
204
|
+
viewBoxThickness: this._thicknessAt,
|
|
193
205
|
});
|
|
194
206
|
// Guard against zero-sized containers, but allow fractional scales < 1
|
|
195
207
|
this._scale = scale > 0 ? scale : 1;
|
|
@@ -301,16 +313,16 @@ export class ObcGaugeVertical extends AdviceMixin(
|
|
|
301
313
|
adviceEmphasis: this.adviceEmphasis,
|
|
302
314
|
adviceMaskPrefix: this._adviceMaskPrefix,
|
|
303
315
|
fixedAspectRatio: this.fixedAspectRatio,
|
|
316
|
+
fixedAspectRatioScale: this.fixedAspectRatio ? this._scale : 1,
|
|
304
317
|
// Gauges are always in instrument mode - they use fixed borderRadius (8px)
|
|
305
318
|
// and don't respond to .obc-component-size-* CSS classes for border radius
|
|
306
319
|
instrumentMode: true,
|
|
307
320
|
highlightCurrentValue: this.highlightCurrentValue,
|
|
308
321
|
};
|
|
309
322
|
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
this._viewBoxThickness = layout.thickness;
|
|
323
|
+
const layoutConfig = toExternalScaleLayoutConfig(config);
|
|
324
|
+
const layout = computeExternalScaleLayout(layoutConfig);
|
|
325
|
+
this._layoutConfig = layoutConfig;
|
|
314
326
|
|
|
315
327
|
const parts = renderExternalScale(config);
|
|
316
328
|
|
|
@@ -411,11 +423,14 @@ export class ObcGaugeVertical extends AdviceMixin(
|
|
|
411
423
|
labelThickness: this.labelThickness,
|
|
412
424
|
length: this.fixedAspectRatio ? this.scaleReferenceSize : this.height,
|
|
413
425
|
scaleType: this.scaleType,
|
|
426
|
+
advicePosition: this.advicePosition,
|
|
427
|
+
hasAdvice: !!this.advices && this.advices.length > 0,
|
|
414
428
|
hasAdviceIcon: !!this.advices?.some((a) => a.showIcon),
|
|
415
429
|
hasSetpoint:
|
|
416
430
|
this.setpoint !== undefined ||
|
|
417
431
|
this.newSetpoint !== undefined ||
|
|
418
432
|
this.departingNewSetpoint !== undefined,
|
|
433
|
+
fixedAspectRatioScale: this.fixedAspectRatio ? this._scale : 1,
|
|
419
434
|
});
|
|
420
435
|
|
|
421
436
|
// The chart lays out in visual pixels, so a scaled drawing reports its
|
|
@@ -492,7 +507,7 @@ export class ObcGaugeVertical extends AdviceMixin(
|
|
|
492
507
|
containerMainAxisSize: height,
|
|
493
508
|
containerCrossAxisSize: width,
|
|
494
509
|
scaleReferenceSize: this.scaleReferenceSize,
|
|
495
|
-
viewBoxThickness: this.
|
|
510
|
+
viewBoxThickness: this._thicknessAt,
|
|
496
511
|
});
|
|
497
512
|
return true;
|
|
498
513
|
}
|
|
@@ -48,6 +48,11 @@ export interface LinearAdviceBandOptions {
|
|
|
48
48
|
maskId: string;
|
|
49
49
|
/** The band is drawn under a reflection, so the hatch is mirrored back. */
|
|
50
50
|
mirrorPattern?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* ViewBox units per CSS pixel when the band is pixel-fixed inside a scaled
|
|
53
|
+
* drawing: the hatch tile is enlarged by it so the stripes keep their pitch.
|
|
54
|
+
*/
|
|
55
|
+
unitsPerPx?: number;
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
const point = (vertical: boolean, main: number, perp: number) =>
|
|
@@ -67,13 +72,17 @@ function bandPath(o: LinearAdviceBandOptions, advice: ResolvedAdvice) {
|
|
|
67
72
|
const hi = Math.max(o.mainStart, o.mainEnd);
|
|
68
73
|
const capLo = ascending ? caps.start : caps.end;
|
|
69
74
|
const capHi = ascending ? caps.end : caps.start;
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
// The caps are pixel geometry like the band: a scaled drawing holds them
|
|
76
|
+
// in the band's own units.
|
|
77
|
+
const u = o.unitsPerPx ?? 1;
|
|
78
|
+
const inset = ADVICE_CAP_INSET * u;
|
|
79
|
+
const edgeLo = capLo === AdviceCap.pill ? lo + inset : lo;
|
|
80
|
+
const edgeHi = capHi === AdviceCap.pill ? hi - inset : hi;
|
|
72
81
|
const radius = (cap: AdviceCap) =>
|
|
73
82
|
cap === AdviceCap.pill
|
|
74
83
|
? t / 2
|
|
75
84
|
: cap === AdviceCap.square
|
|
76
|
-
? ADVICE_ALERT_CORNER_RADIUS
|
|
85
|
+
? ADVICE_ALERT_CORNER_RADIUS * u
|
|
77
86
|
: 0;
|
|
78
87
|
const rLo = radius(capLo);
|
|
79
88
|
const rHi = radius(capHi);
|
|
@@ -120,21 +129,23 @@ export function renderLinearAdviceBand(
|
|
|
120
129
|
const d = bandPath(o, advice);
|
|
121
130
|
if (d === null) return nothing;
|
|
122
131
|
if (style.pattern === 'none') {
|
|
123
|
-
return svg`<path d=${d} fill=${style.fill} stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
132
|
+
return svg`<path class="advice-band" d=${d} fill=${style.fill} stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
124
133
|
}
|
|
125
134
|
const t = o.thickness ?? ADVICE_BAND_THICKNESS;
|
|
126
135
|
const lo = Math.min(o.mainStart, o.mainEnd);
|
|
127
136
|
const hi = Math.max(o.mainStart, o.mainEnd);
|
|
128
137
|
const patternId = `${o.maskId}-pattern`;
|
|
129
138
|
const mirrored = o.mirrorPattern ?? false;
|
|
139
|
+
const unitsPerPx = o.unitsPerPx ?? 1;
|
|
130
140
|
const pattern =
|
|
131
141
|
style.pattern === 'hairline'
|
|
132
|
-
? hairlinePattern(patternId, style.patternColor, mirrored)
|
|
142
|
+
? hairlinePattern(patternId, style.patternColor, mirrored, unitsPerPx)
|
|
133
143
|
: stripePattern(
|
|
134
144
|
patternId,
|
|
135
145
|
style.patternColor,
|
|
136
146
|
ADVICE_STRIPE.width,
|
|
137
|
-
mirrored
|
|
147
|
+
mirrored,
|
|
148
|
+
unitsPerPx
|
|
138
149
|
);
|
|
139
150
|
const cover = o.vertical
|
|
140
151
|
? svg`<rect x=${o.perpStart} y=${lo} width=${t} height=${hi - lo} fill=${style.fill}/><rect x=${o.perpStart} y=${lo} width=${t} height=${hi - lo} fill="url(#${patternId})"/>`
|
|
@@ -147,7 +158,7 @@ export function renderLinearAdviceBand(
|
|
|
147
158
|
</mask>
|
|
148
159
|
</defs>
|
|
149
160
|
<g mask="url(#${o.maskId})">${cover}</g>
|
|
150
|
-
<path d=${d} fill="none" stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
161
|
+
<path class="advice-band" d=${d} fill="none" stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
151
162
|
}
|
|
152
163
|
|
|
153
164
|
/** Where a point marker sits: on the band centreline at its value. */
|
|
@@ -158,6 +169,8 @@ export interface LinearAdvicePointOptions {
|
|
|
158
169
|
/** Perpendicular coordinate of the band centreline. */
|
|
159
170
|
perpCenter: number;
|
|
160
171
|
advice: AdviceInput | ResolvedAdvice;
|
|
172
|
+
/** ViewBox units per CSS pixel when the marker is pixel-fixed inside a scaled drawing. */
|
|
173
|
+
unitsPerPx?: number;
|
|
161
174
|
}
|
|
162
175
|
|
|
163
176
|
/**
|
|
@@ -172,8 +185,9 @@ export function renderLinearAdvicePoint(
|
|
|
172
185
|
const style = adviceStyle(advice.category, advice.state);
|
|
173
186
|
const cx = o.vertical ? o.perpCenter : o.main;
|
|
174
187
|
const cy = o.vertical ? o.main : o.perpCenter;
|
|
188
|
+
const u = o.unitsPerPx ?? 1;
|
|
175
189
|
if (isGoToCategory(advice.category)) {
|
|
176
|
-
return svg`<circle cx=${cx} cy=${cy} r=${ADVICE_POINT_DOT_DIAMETER / 2} fill=${style.fill} stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
190
|
+
return svg`<circle cx=${cx} cy=${cy} r=${(ADVICE_POINT_DOT_DIAMETER / 2) * u} fill=${style.fill} stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
177
191
|
}
|
|
178
192
|
const grey =
|
|
179
193
|
advice.category === AdviceCategory.caution
|
|
@@ -182,9 +196,9 @@ export function renderLinearAdvicePoint(
|
|
|
182
196
|
: style.stroke
|
|
183
197
|
: undefined;
|
|
184
198
|
const {length, thickness, radius} = ADVICE_POINT_TICK;
|
|
185
|
-
const w = o.vertical ? length : thickness;
|
|
186
|
-
const h = o.vertical ? thickness : length;
|
|
187
|
-
return svg`<rect x=${cx - w / 2} y=${cy - h / 2} width=${w} height=${h} rx=${radius} fill=${grey ?? style.fill} stroke=${grey ?? style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
199
|
+
const w = (o.vertical ? length : thickness) * u;
|
|
200
|
+
const h = (o.vertical ? thickness : length) * u;
|
|
201
|
+
return svg`<rect x=${cx - w / 2} y=${cy - h / 2} width=${w} height=${h} rx=${radius * u} fill=${grey ?? style.fill} stroke=${grey ?? style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
188
202
|
}
|
|
189
203
|
|
|
190
204
|
/** Where an area sits: the advice's range along the main axis, the bar across it. */
|
|
@@ -26,12 +26,19 @@ export function stripePattern(
|
|
|
26
26
|
id: string,
|
|
27
27
|
color: string,
|
|
28
28
|
width: number = ADVICE_STRIPE.width,
|
|
29
|
-
mirrored = false
|
|
29
|
+
mirrored = false,
|
|
30
|
+
unitsPerPx = 1
|
|
30
31
|
): SVGTemplateResult {
|
|
31
32
|
const t = STRIPE_TILE;
|
|
32
33
|
// A group drawn under a reflection shows the stripe sloping the other way;
|
|
33
|
-
// mirroring the tile back keeps every band on the same slope.
|
|
34
|
-
|
|
34
|
+
// mirroring the tile back keeps every band on the same slope. A band that
|
|
35
|
+
// is pixel-fixed inside a scaled drawing enlarges the tile by the same
|
|
36
|
+
// factor, so the stripes keep the design pitch on screen.
|
|
37
|
+
const transforms = [
|
|
38
|
+
mirrored ? 'scale(-1 1)' : '',
|
|
39
|
+
unitsPerPx !== 1 ? `scale(${unitsPerPx})` : '',
|
|
40
|
+
].filter(Boolean);
|
|
41
|
+
const transform = transforms.length ? transforms.join(' ') : nothing;
|
|
35
42
|
return svg`<pattern id=${id} patternUnits="userSpaceOnUse" width=${t} height=${t} patternTransform=${transform}>
|
|
36
43
|
<path d="M 0 0 L ${t} ${t} M ${t / 2} ${-t / 2} L ${(3 * t) / 2} ${t / 2} M ${-t / 2} ${t / 2} L ${t / 2} ${(3 * t) / 2}" stroke=${color} stroke-width=${width} stroke-linecap="square"/>
|
|
37
44
|
</pattern>`;
|
|
@@ -41,9 +48,10 @@ export function stripePattern(
|
|
|
41
48
|
export function hairlinePattern(
|
|
42
49
|
id: string,
|
|
43
50
|
color: string,
|
|
44
|
-
mirrored = false
|
|
51
|
+
mirrored = false,
|
|
52
|
+
unitsPerPx = 1
|
|
45
53
|
): SVGTemplateResult {
|
|
46
|
-
return stripePattern(id, color, ADVICE_HAIRLINE_WIDTH, mirrored);
|
|
54
|
+
return stripePattern(id, color, ADVICE_HAIRLINE_WIDTH, mirrored, unitsPerPx);
|
|
47
55
|
}
|
|
48
56
|
|
|
49
57
|
/** The alarm lattice: square dots on a grid, every other row shifted by half a pitch. */
|