import {LitElement, SVGTemplateResult, html, svg, unsafeCSS} from 'lit';
import {customElement, property} from 'lit/decorators.js';
import compentStyle from './watch-flat.css?inline';
import {Tickmark, TickmarkStyle, tickmark} from './tickmark-flat';
import {rect} from '../../svghelpers/rectangular';
import {Label} from '../compass-flat/compass-flat';
@customElement('obc-watch-flat')
export class ObcWatchFlat extends LitElement {
@property({type: Number}) width = 352;
@property({type: Number}) height = 72;
@property({type: Number}) padding = 0;
@property({type: Number}) rotation = 0;
@property({type: Number}) tickmarkSpacing = 0;
@property({type: Number}) angleSetpoint: number | undefined;
@property({type: Array, attribute: false}) tickmarks: Tickmark[] = [];
@property({type: Array, attribute: false}) labels: Label[] = [];
@property({type: Array, attribute: false}) FOVIndicator: SVGTemplateResult[] =
[];
@property({type: Number}) trackHeight = (2 / 3) * this.height;
@property({type: Number}) ticksHeight = this.height - this.trackHeight;
@property({type: Number}) borderRadius = 8;
private renderClipPath(offsetY: number = 0): SVGTemplateResult {
return svg`
`;
}
private renderLabelMask(): SVGTemplateResult {
return svg`
`;
}
private renderLabels(scale: number): SVGTemplateResult[] {
const labels: SVGTemplateResult[] = [];
for (const l of this.labels) {
labels.push(
svg`
${l.text}
`
);
}
return labels;
}
private watchFace(): SVGTemplateResult {
const strokeWidth = 1;
return svg`
${this.renderClipPath()}
${this.renderClipPath(-40)}
${rect('frame-track', {
width: this.width,
height: this.trackHeight,
y: this.height / 2 - this.trackHeight,
strokeWidth: strokeWidth,
strokeColor: 'var(--instrument-frame-secondary-color)',
strokePosition: 'inside',
fillColor: 'var(--instrument-frame-secondary-color)',
borderRadius: 0,
})}
${rect('frame-ticks', {
width: this.width,
height: this.ticksHeight,
y: this.height / 2 - this.trackHeight - this.ticksHeight,
strokeWidth: strokeWidth,
strokeColor: 'var(--instrument-frame-primary-color)',
strokePosition: 'inside',
fillColor: 'var(--instrument-frame-primary-color)',
borderRadius: 0,
})}
${rect('frame-outline', {
width: this.width,
height: this.height,
strokeWidth: strokeWidth,
strokeColor: 'var(--instrument-frame-tertiary-color)',
strokePosition: 'inside',
fillColor: 'none',
borderRadius: this.borderRadius,
})}
`;
}
override render() {
const width = (this.width / 2 + this.padding) * 2;
const viewBox = `-${width / 2} -${this.height / 2} ${width} ${this.height}`;
const scale = this.clientWidth / width;
return html`
`;
}
static override styles = unsafeCSS(compentStyle);
}
declare global {
interface HTMLElementTagNameMap {
'obc-watch-flat': ObcWatchFlat;
}
}