diff --git a/src/jmapNew/config/skinCode/haerbin_01.js b/src/jmapNew/config/skinCode/haerbin_01.js index fdb1a1d4f..53293dcda 100644 --- a/src/jmapNew/config/skinCode/haerbin_01.js +++ b/src/jmapNew/config/skinCode/haerbin_01.js @@ -250,7 +250,7 @@ class SkinCode extends defaultStyle { }, trainDepart:{ // 停车计时 insideOffset:{ x: 25, y: -21}, // 内站台停车计时偏移量 - outsideOffset: { x: -25, y: 21}, // 外站台停车计时偏移量 + outsideOffset: { x: -25, y: -11}, // 外站台停车计时偏移量 textFill: '#00FF00', // 文字颜色 textBorderColor: '#00FF00', // 文字边框颜色 fontSize: 10 // 字体大小 diff --git a/src/jmapNew/shape/StationStand/ETrainDepart.js b/src/jmapNew/shape/StationStand/ETrainDepart.js index 27fddccd9..019d4c59a 100644 --- a/src/jmapNew/shape/StationStand/ETrainDepart.js +++ b/src/jmapNew/shape/StationStand/ETrainDepart.js @@ -5,36 +5,31 @@ class ETrainDepart extends Group { constructor(model) { super(); this.model = model; - this.isNew = false; - this.timeStart = 30; - this.time = null; + this.create(); } - create(text) { - if (!this.isNew) { - const model = this.model; - const style = this.model.style; - this.isNew = true; - this.trainDepart = new Text({ - zlevel: model.zlevel, - z: model.z, - position: [0, 0], - style: { - x: model.x, - y: model.y, - text: text, - textAlign: style.textStyle.textAlign, - fontSize: style.StationStand.trainDepart.fontSize, - fontFamily: style.fontFamily, - textFill: style.StationStand.trainDepart.textFill, - textVerticalAlign: style.textStyle.textVerticalAlign, - textBorderColor: style.StationStand.trainDepart.textBorderColor, - textPadding: 2, - textBorderWidth: 1 - } - }); - this.add(this.trainDepart); - } + create() { + const model = this.model; + const style = this.model.style; + this.trainDepart = new Text({ + zlevel: model.zlevel, + z: model.z, + position: [0, 0], + style: { + x: model.x, + y: model.y, + text: '000', + textAlign: style.textStyle.textAlign, + fontSize: style.StationStand.trainDepart.fontSize, + fontFamily: style.fontFamily, + textFill: style.StationStand.trainDepart.textFill, + textVerticalAlign: style.textStyle.textVerticalAlign, + textBorderColor: style.StationStand.trainDepart.textBorderColor, + textPadding: 2, + textBorderWidth: 1 + } + }); + this.add(this.trainDepart); } setColor(color) { @@ -44,35 +39,17 @@ class ETrainDepart extends Group { hideMode() { this.trainDepart && this.trainDepart.hide(); - // if (this.time) { - // clearInterval(this.time); - // this.timeStart = 30; - // } } - showMode() { - // this.timeStart = 30; - this.create(`0${this.timeStart}`); + showMode(remainTime) { + if (remainTime < 10) { + remainTime = '00' + remainTime; + } else { + remainTime = '0' + remainTime; + } + this.trainDepart.setStyle('text', remainTime); this.trainDepart.show(); - setTimeout(() => { - this.animition(); - }, 1000); - } - animition() { - this.time && clearInterval(this.time); - this.time = setInterval(() => { - this.timeStart--; - if (this.timeStart >= 0) { - if (this.timeStart < 10) { - this.trainDepart.setStyle('text', `00${this.timeStart}`); - } else { - this.trainDepart.setStyle('text', `0${this.timeStart}`); - } - } else { - clearInterval(this.time); - this.timeStart = 30; - } - }, 1000); + } } diff --git a/src/jmapNew/shape/StationStand/index.js b/src/jmapNew/shape/StationStand/index.js index ea0f69831..aa2d96b60 100644 --- a/src/jmapNew/shape/StationStand/index.js +++ b/src/jmapNew/shape/StationStand/index.js @@ -398,7 +398,7 @@ class StationStand extends Group { this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.stopColor); } else { this.trainStop && this.trainStop.showMode(); - this.trainDepart && this.trainDepart.showMode(); + this.trainDepart && this.trainDepart.showMode(this.model.remainTime); } }