import { Component, ComponentNature, Properties, sceneComponent } from '@hatiolab/things-scene' import MCSTransport from './mcs-transport' const NATURE: ComponentNature = { mutable: false, resizable: true, rotatable: true, properties: [...MCSTransport.properties] } // const capacity = { ko: 'Capacity', en: 'Capacity', zh_CN: '容量' } // export function getLocaleLanguage() { // let localeValue // let nameOfCookie = 'miipLang' + '=' // let x = 0 // while (x <= document.cookie.length) { // let y = x + nameOfCookie.length // if (document.cookie.substring(x, y) == nameOfCookie) { // let endOfCookie // if ((endOfCookie = document.cookie.indexOf(';', y)) == -1) endOfCookie = document.cookie.length // localeValue = unescape(document.cookie.substring(y, endOfCookie)) // } // x = document.cookie.indexOf(' ', x) + 1 // if (x == 0) break // } // return localeValue // } @sceneComponent('STOCKER') export default class Stocker extends MCSTransport { static get nature() { return NATURE } getLegendFallback() { return (this.root as any).stokerLegendTheme || super.getLegendFallback() } containable(component: Component) { return ( super.containable(component) || ['Crane', 'CraneRail', 'Shelf', 'Port', 'MCSGaugeCapacityBar', 'StockerCapacityBar', 'StockerCarrierBar', 'StockerAbnormalBar', 'ZoneCapacityBar'].includes( component.state.type ) ) } onchangeData(after: Record, before: Record): void { /* MCSStatusMixin.onchangeData 의 statusColor → state.fillStyle 동기화 로직을 * 호출. 3D 경로에서는 mesh material 의 color 가 build 시점 한 번 결정되므로 * 데이터 변경 시 fillStyle 이 갱신되어야 MCSRealObject3D.onchange 의 * 'fillStyle in after' 분기를 타고 mesh rebuild 가 발생한다. * (2D 는 render() 가 매 프레임 statusColor getter 를 직접 사용하므로 영향 없음.) */ super.onchangeData(after, before) /* non-identifiable component 즉, StockerCapacityBar 에게 데이터를 전달함 */ this.components.filter(component => !component.isIdentifiable()).forEach(component => (component.data = this.data)) } }