import { Component, ComponentNature, sceneComponent } from '@hatiolab/things-scene' import MCSTransport from './mcs-transport' const NATURE: ComponentNature = { mutable: false, resizable: true, rotatable: true, properties: [...MCSTransport.properties] } @sceneComponent('OHTLine') export default class OHTLine extends MCSTransport { static get nature() { return NATURE } get auxColor() { return '#333' } getLegendFallback() { return (this.root as any).ohtlineLegendTheme || super.getLegendFallback() } containable(component: Component) { return ['OHT', 'Node'].includes(component.state.type) } render(context: CanvasRenderingContext2D) { const { left, top, width, height } = this.bounds context.beginPath() context.translate(left, top) context.fillStyle = this.statusColor! context.strokeStyle = this.auxColor! context.fillRect(0, 0, width, height) context.fill() context.stroke() context.translate(-left, -top) } }