Эх сурвалжийг харах

perf(views): 优化“监测点”控件异常判断逻辑

wangcong 2 сар өмнө
parent
commit
ebc6b9414a

+ 6 - 1
src/views/EnvArea/pens/monitorPoint.ts

@@ -1,6 +1,11 @@
 import { getFont, Pen } from "@meta2d/core";
 import { MonitoringPointData } from "@/types";
 
+const isPointNormal = (point: MonitoringPointData) => {
+  const { temperature, humidity } = point;
+  return temperature !== null && humidity !== null
+}
+
 export interface MonitorPointPen extends Pen {
   monitorPointInfo: MonitoringPointData
 }
@@ -12,7 +17,7 @@ export function monitorPoint(
   const { x, y, width, height } = pen.calculative.worldRect;
   const { name, temperature, humidity } = pen.monitorPointInfo;
   const isLock = meta2d.data().locked;
-  const isNormal = true;
+  const isNormal = isPointNormal(pen.monitorPointInfo);
   ctx.save();
 
   // 状态图标中心坐标