From 40c2583b1241fb93520df715e69946abb389a5c2 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Tue, 15 Aug 2023 18:08:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=BD=A6=E6=8A=A5=E9=94=99=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/draw-app/dialogs/AddTrainDialog.vue | 2 +- src/graphics/train/Train.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/draw-app/dialogs/AddTrainDialog.vue b/src/components/draw-app/dialogs/AddTrainDialog.vue index 0fee054..be0fb05 100644 --- a/src/components/draw-app/dialogs/AddTrainDialog.vue +++ b/src/components/draw-app/dialogs/AddTrainDialog.vue @@ -57,7 +57,7 @@ import { ref } from 'vue'; const props = defineProps({ dev: { - type: Section || Turnout, + type: [Section, Turnout], required: true, }, kmLength: { diff --git a/src/graphics/train/Train.ts b/src/graphics/train/Train.ts index 8e1e348..8e9d9f6 100644 --- a/src/graphics/train/Train.ts +++ b/src/graphics/train/Train.ts @@ -421,6 +421,9 @@ export class Train extends JlGraphic { } allLength = Math.abs(B - A); } + if (allLength == 0) { + allLength = 1; + } if (this.states.headOffset > allLength) { console.error('偏移长度超出最大长度'); return;