bugfix - 计轴生成报错修改

This commit is contained in:
Yuan 2023-12-06 16:24:43 +08:00
parent 8ce7c5994e
commit 34bfb15a22

View File

@ -322,7 +322,9 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
return p !== port && p; return p !== port && p;
}); });
otherPort.forEach((port) => { otherPort.forEach((port) => {
const portIndex = DevicePort[port] as unknown as number; const portIndex = Object.values(DevicePort).findIndex(
(p) => p === port
);
const axleCountingPs1 = turnout.localToCanvasPoints( const axleCountingPs1 = turnout.localToCanvasPoints(
...points[portIndex] ...points[portIndex]
)[points[portIndex].length - 1]; )[points[portIndex].length - 1];
@ -336,7 +338,9 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
return p !== port[0] && p !== port[1] && p; return p !== port[0] && p !== port[1] && p;
}); });
if (otherPort.length) { 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( const axleCountingPs1 = turnout.localToCanvasPoints(
...points[portIndex] ...points[portIndex]
)[points[portIndex].length - 1]; )[points[portIndex].length - 1];