From a59e51eafdd2aaae91813db769c88cdb15cbcaa4 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Fri, 5 Jan 2024 15:36:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=BD=A6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/packages/Train/Train.js | 17 ++++++++++------- components/packages/Train/TrainConfig.d.ts | 3 ++- components/packages/Train/TrainConfig.js | 9 ++++++++- src/packages/Train/Train.ts | 17 ++++++++++------- src/packages/Train/TrainConfig.ts | 12 ++++++++++-- 5 files changed, 40 insertions(+), 18 deletions(-) diff --git a/components/packages/Train/Train.js b/components/packages/Train/Train.js index ac59612..13a81ff 100644 --- a/components/packages/Train/Train.js +++ b/components/packages/Train/Train.js @@ -144,6 +144,8 @@ class TrainBody extends Container { codeAGraph.position.set(-bodyBWH.width / 2, 0); codeBGraph.position.set(bodyAWH.width / 2, 0); } + codeAGraph.updateOnScaled(); + codeBGraph.updateOnScaled(); if (this.train.constDatas.hasBodyRact) { const bodyRact = this.bodyRact; const { width: bodyWidth, height: bodyHeight } = this.getBodyWH(); @@ -246,16 +248,17 @@ class Train extends JlGraphic { } // 设置驾驶模式对应颜色 setDiriveModelColor(s) { - const DiriveModelColorEnum = this.constDatas.DiriveModelColorEnum; - let aColor = DiriveModelColorEnum.AM; - let pColor = DiriveModelColorEnum.SM; + const aModelColorEnum = this.constDatas.arrowDiriveModelColorEnum; + const pModelColorEnum = this.constDatas.pauseDiriveModelColorEnum; + let aColor = aModelColorEnum.AM; + let pColor = pModelColorEnum.AM; if (s == EnumDiriveModel.SM) { - aColor = DiriveModelColorEnum.SM; - pColor = DiriveModelColorEnum.SM; + aColor = aModelColorEnum.SM; + pColor = pModelColorEnum.SM; } else if (s == EnumDiriveModel.RM) { - aColor = DiriveModelColorEnum.RM; - pColor = DiriveModelColorEnum.RM; + aColor = aModelColorEnum.RM; + pColor = pModelColorEnum.RM; } this.trainHead.arrowColor = aColor; this.trainHead.pauseColor = pColor; diff --git a/components/packages/Train/TrainConfig.d.ts b/components/packages/Train/TrainConfig.d.ts index f732a86..fdef150 100644 --- a/components/packages/Train/TrainConfig.d.ts +++ b/components/packages/Train/TrainConfig.d.ts @@ -15,7 +15,8 @@ export interface ITrainConstsConfig { borderColor: string; arrowDefaultColor: string; pauseDefaultColor: string; - DiriveModelColorEnum: DiriveModelColor; + arrowDiriveModelColorEnum: DiriveModelColor; + pauseDiriveModelColorEnum: DiriveModelColor; typeColorEnum: TypeColor; statusTextColor: IStatusTextColor; statusTextTransform?: IStatusTextColor; diff --git a/components/packages/Train/TrainConfig.js b/components/packages/Train/TrainConfig.js index 29a2eca..87b0827 100644 --- a/components/packages/Train/TrainConfig.js +++ b/components/packages/Train/TrainConfig.js @@ -41,13 +41,20 @@ function getTrainConsts() { bodyBgColor: '0x737373', // body背景色 arrowDefaultColor: '0x00FF00', // 箭头默认颜色 pauseDefaultColor: '0x00FF00', // 停止默认颜色 - DiriveModelColorEnum: { + arrowDiriveModelColorEnum: { AM: '0x00FF00', // ATO自动驾驶 SM: '0xFFFF00', // ATP 监控下的人工驾驶模式 RM: '0xFFC837', // 限制人工驾驶模式 NRM: '0xA0522D', // 非限制人工驾驶模式 red: '0xF80103', // 红色表示通信中断 }, + pauseDiriveModelColorEnum: { + AM: '0xFFFF00', // ATO自动驾驶 + SM: '0xFFFF00', // ATP 监控下的人工驾驶模式 + RM: '0xFFC837', // 限制人工驾驶模式 + NRM: '0xA0522D', // 非限制人工驾驶模式 + red: '0xF80103', // 红色表示通信中断 + }, typeColorEnum: { accuracy: '0xffffff', // 准点 early: '0x00FF00', // 早点 diff --git a/src/packages/Train/Train.ts b/src/packages/Train/Train.ts index 9d8baba..eaad4e0 100644 --- a/src/packages/Train/Train.ts +++ b/src/packages/Train/Train.ts @@ -162,6 +162,8 @@ class TrainBody extends Container { codeAGraph.position.set(-bodyBWH.width / 2, 0); codeBGraph.position.set(bodyAWH.width / 2, 0); } + codeAGraph.updateOnScaled(); + codeBGraph.updateOnScaled(); if (this.train.constDatas.hasBodyRact) { const bodyRact = this.bodyRact; const { width: bodyWidth, height: bodyHeight } = this.getBodyWH(); @@ -282,15 +284,16 @@ export class Train extends JlGraphic { // 设置驾驶模式对应颜色 setDiriveModelColor(s: EnumDiriveModel) { - const DiriveModelColorEnum = this.constDatas.DiriveModelColorEnum; - let aColor = DiriveModelColorEnum.AM; - let pColor = DiriveModelColorEnum.SM; + const aModelColorEnum = this.constDatas.arrowDiriveModelColorEnum; + const pModelColorEnum = this.constDatas.pauseDiriveModelColorEnum; + let aColor = aModelColorEnum.AM; + let pColor = pModelColorEnum.AM; if (s == EnumDiriveModel.SM) { - aColor = DiriveModelColorEnum.SM; - pColor = DiriveModelColorEnum.SM; + aColor = aModelColorEnum.SM; + pColor = pModelColorEnum.SM; } else if (s == EnumDiriveModel.RM) { - aColor = DiriveModelColorEnum.RM; - pColor = DiriveModelColorEnum.RM; + aColor = aModelColorEnum.RM; + pColor = pModelColorEnum.RM; } this.trainHead.arrowColor = aColor; this.trainHead.pauseColor = pColor; diff --git a/src/packages/Train/TrainConfig.ts b/src/packages/Train/TrainConfig.ts index d9dfda8..70b34ef 100644 --- a/src/packages/Train/TrainConfig.ts +++ b/src/packages/Train/TrainConfig.ts @@ -16,7 +16,8 @@ export interface ITrainConstsConfig{ borderColor: string; // 边框的颜色 arrowDefaultColor: string; // 箭头默认颜色 pauseDefaultColor: string; // 停止默认颜色 - DiriveModelColorEnum: DiriveModelColor; + arrowDiriveModelColorEnum: DiriveModelColor; + pauseDiriveModelColorEnum: DiriveModelColor; typeColorEnum: TypeColor; statusTextColor: IStatusTextColor; statusTextTransform?: IStatusTextColor; // 状态文字转换 @@ -87,13 +88,20 @@ export function getTrainConsts(): ITrainConstsConfig { bodyBgColor: '0x737373', // body背景色 arrowDefaultColor: '0x00FF00', // 箭头默认颜色 pauseDefaultColor: '0x00FF00', // 停止默认颜色 - DiriveModelColorEnum: { // 驾驶模式对应颜色 + arrowDiriveModelColorEnum: { // 箭头在驾驶模式对应颜色 AM: '0x00FF00', // ATO自动驾驶 SM: '0xFFFF00', // ATP 监控下的人工驾驶模式 RM: '0xFFC837', // 限制人工驾驶模式 NRM: '0xA0522D', // 非限制人工驾驶模式 red: '0xF80103', // 红色表示通信中断 }, + pauseDiriveModelColorEnum: { // 停止在驾驶模式对应颜色 + AM: '0xFFFF00', // ATO自动驾驶 + SM: '0xFFFF00', // ATP 监控下的人工驾驶模式 + RM: '0xFFC837', // 限制人工驾驶模式 + NRM: '0xA0522D', // 非限制人工驾驶模式 + red: '0xF80103', // 红色表示通信中断 + }, typeColorEnum: { // 识别号颜色 accuracy: '0xffffff', // 准点 early: '0x00FF00', // 早点