From 34bfb15a227ee22820a469bb2ea5697564c6e31e Mon Sep 17 00:00:00 2001 From: Yuan Date: Wed, 6 Dec 2023 16:24:43 +0800 Subject: [PATCH] =?UTF-8?q?bugfix=20-=20=E8=AE=A1=E8=BD=B4=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=8A=A5=E9=94=99=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/axleCounting/AxleCountingDrawAssistant.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/graphics/axleCounting/AxleCountingDrawAssistant.ts b/src/graphics/axleCounting/AxleCountingDrawAssistant.ts index 401d095..bceed26 100644 --- a/src/graphics/axleCounting/AxleCountingDrawAssistant.ts +++ b/src/graphics/axleCounting/AxleCountingDrawAssistant.ts @@ -322,7 +322,9 @@ export class AxleCountingDraw extends GraphicDrawAssistant< return p !== port && p; }); otherPort.forEach((port) => { - const portIndex = DevicePort[port] as unknown as number; + const portIndex = Object.values(DevicePort).findIndex( + (p) => p === port + ); const axleCountingPs1 = turnout.localToCanvasPoints( ...points[portIndex] )[points[portIndex].length - 1]; @@ -336,7 +338,9 @@ export class AxleCountingDraw extends GraphicDrawAssistant< return p !== port[0] && p !== port[1] && p; }); if (otherPort.length) { - const portIndex = DevicePort[otherPort[0]] as unknown as number; + const portIndex = Object.values(DevicePort).findIndex( + (p) => p === otherPort[0] + ); const axleCountingPs1 = turnout.localToCanvasPoints( ...points[portIndex] )[points[portIndex].length - 1];