@fmsim/machine 2.0.0-beta.110 → 2.0.0-beta.111

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fmsim/machine",
3
3
  "description": "Layout View를 구성하는 설비(machine)들과 유닛을 구현한 모듈입니다.",
4
4
  "author": "heartyoh",
5
- "version": "2.0.0-beta.110",
5
+ "version": "2.0.0-beta.111",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
8
8
  "things-scene": true,
@@ -55,5 +55,5 @@
55
55
  "prettier --write"
56
56
  ]
57
57
  },
58
- "gitHead": "ca7e4d4ea853a908f457e8c411f63370f25a131f"
58
+ "gitHead": "4ad2b756c574fae9c629720b8b94d2ccefd604b9"
59
59
  }
@@ -174,7 +174,8 @@ export function CapacityGaugeMixin<TBase extends Constructor<Component>>(Base: T
174
174
  const mode = this.gaugeMode
175
175
 
176
176
  if (mode === 'carrier' || mode === 'abnormal') {
177
- this.renderSegmentGauge(context, this.segments(mode))
177
+ // carrier/abnormal 모드는 세그먼트 값이 전부 0(데이터 없음)일 때 빈 막대 대신 '0%' 를 표시한다.
178
+ this.renderSegmentGauge(context, this.segments(mode), true)
178
179
  return
179
180
  }
180
181
 
@@ -250,7 +251,7 @@ export function CapacityGaugeMixin<TBase extends Constructor<Component>>(Base: T
250
251
  }
251
252
 
252
253
  /** 세그먼트 게이지 렌더 (carrier/abnormal 공통). bounds 방향으로 landscape/portrait 자동. */
253
- renderSegmentGauge(context: CanvasRenderingContext2D, segments: GaugeSegment[]) {
254
+ renderSegmentGauge(context: CanvasRenderingContext2D, segments: GaugeSegment[], zeroPercentWhenEmpty = false) {
254
255
  const { left, top, width, height } = (this as any).bounds
255
256
  const { lineWidth, strokeStyle, round, fillStyle = 'white' } = (this as any).state
256
257
  const landscape = width >= height
@@ -298,6 +299,19 @@ export function CapacityGaugeMixin<TBase extends Constructor<Component>>(Base: T
298
299
  }
299
300
  }
300
301
 
302
+ // 데이터가 전혀 없어(모든 ratio 0) 세그먼트가 하나도 안 그려진 경우 —
303
+ // carrier/abnormal 모드는 빈 막대 대신 '0%' 를 막대 중앙에 표시한다.
304
+ if (zeroPercentWhenEmpty && segments.every(s => s.ratio <= 0)) {
305
+ this._drawSegmentLabel(
306
+ context,
307
+ { key: 'EMPTY', label: '', count: 0, ratio: 0, color: '' },
308
+ 0,
309
+ 0,
310
+ width,
311
+ height
312
+ )
313
+ }
314
+
301
315
  // outline
302
316
  context.beginPath()
303
317
  context.setLineDash([])
@@ -20,7 +20,11 @@ export function ParentObjectMixin<TBase extends Constructor<Component>>(Base: TB
20
20
  //@ts-ignore
21
21
  const targets = this.root?.findAllById(parentObjectId || id) || []
22
22
  for (const target of targets) {
23
- if (target instanceof MCSMachine || target instanceof MCSUnit) {
23
+ // 자기 자신은 제외 — parentObjectId 미지정 시 id 로 룩업하면 자신이 잡히는데,
24
+ // 자신이 MCSMachine/MCSUnit(예: Crane 은 MCSUnit) 이면 자신을 parentObject 로
25
+ // 반환해버려 host=self→span 0→(0,0) 으로 이동하는 버그. 자신을 건너뛰면
26
+ // 아래 암묵적 this.parent(컨테이너) fallback 으로 정상 해석된다.
27
+ if (target !== this && (target instanceof MCSMachine || target instanceof MCSUnit)) {
24
28
  return target
25
29
  }
26
30
  }
@@ -110,7 +110,9 @@ export default class MCSVehicle extends MCSCarrierHolder {
110
110
 
111
111
  const afterNode = findNode(this, NodeId, NodeMachine)
112
112
  if (!afterNode) {
113
- console.warn(`Node not found. NodeId: ${NodeId}, NodeMachine: ${NodeMachine}`)
113
+ // 보드는 전체 노드의 부분 뷰 — 모든 노드를 그리지 않는다. 위치 NODEID 가 이 보드에
114
+ // 없는 노드를 가리키는 건 오류가 아니라 정상(그 노드는 이 보드에 미표시)이므로,
115
+ // 경고 없이 조용히 배치를 생략한다. (데이터 갱신마다 도는 hot path — 거짓 경보 방지.)
114
116
  return
115
117
  }
116
118