大铁线路 信号机按钮添加边框

This commit is contained in:
joylink_cuiweidong 2022-08-15 14:25:36 +08:00
parent 75fd967879
commit 4b0b2fa156
3 changed files with 61 additions and 33 deletions

View File

@ -265,6 +265,8 @@ class SkinCode extends defaultStyle {
this[deviceType.SignalButton] = {
width:12,
borderLine:1,
isShowBorder:true,
guideColor: 'rgb(80,80,255)',
trainColor:'rgb(0,128,0)',
strokeColor:'rgb(128,128,128)'

View File

@ -115,14 +115,15 @@ export default class SignalButton extends Group {
}
this.add(this.rectButton);
}
const width = this.style.SignalButton && this.style.SignalButton.width ? this.style.SignalButton.width : 14;
this.leftLine = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: computedPosition.x + 1,
y1: computedPosition.y + 1,
x2: computedPosition.x + 13,
y2: computedPosition.y + 13
x2: computedPosition.x + width - 1,
y2: computedPosition.y + width - 1
},
style: {
lineWidth: 2,
@ -135,10 +136,10 @@ export default class SignalButton extends Group {
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: computedPosition.x + 13,
x1: computedPosition.x + width - 1,
y1: computedPosition.y + 1,
x2: computedPosition.x + 1,
y2: computedPosition.y + 13
y2: computedPosition.y + width - 1
},
style: {
lineWidth: 2,
@ -147,70 +148,74 @@ export default class SignalButton extends Group {
});
this.add(this.rightLine);
this.rightLine.hide();
const borderLine = this.style.SignalButton && this.style.SignalButton.borderLine ? this.style.SignalButton.borderLine : 2;
const isShowBorder = this.style.SignalButton && this.style.SignalButton.isShowBorder;
// 接车按钮 通过按钮 引导按钮
const showBorderBtn = ['PICK', 'PASS', 'GUIDE'];
this.leftBoard = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: computedPosition.x - 1,
y1: computedPosition.y - 1,
x2: computedPosition.x - 1,
y2: computedPosition.y + 15
x1: computedPosition.x - (borderLine - 1),
y1: computedPosition.y - (borderLine - 1),
x2: computedPosition.x - (borderLine - 1),
y2: computedPosition.y + width + (borderLine - 1)
},
style: {
lineWidth: 2,
lineWidth: borderLine,
stroke: '#FFFFFF'
}
});
this.add(this.leftBoard);
this.leftBoard.hide();
if (!(isShowBorder && showBorderBtn.includes(model.type))) { this.leftBoard.hide(); }
this.topBoard = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: computedPosition.x - 1,
y1: computedPosition.y - 1,
x2: computedPosition.x + 15,
y2: computedPosition.y - 1
x1: computedPosition.x - (borderLine - 1),
y1: computedPosition.y - (borderLine - 1),
x2: computedPosition.x + width + (borderLine - 1),
y2: computedPosition.y - (borderLine - 1)
},
style: {
lineWidth: 2,
lineWidth: borderLine,
stroke: '#FFFFFF'
}
});
this.add(this.topBoard);
this.topBoard.hide();
if (!(isShowBorder && showBorderBtn.includes(model.type))) { this.topBoard.hide(); }
this.rightBoard = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: computedPosition.x + 15,
y1: computedPosition.y - 1,
x2: computedPosition.x + 15,
y2: computedPosition.y + 15
x1: computedPosition.x + width + (borderLine - 1),
y1: computedPosition.y - (borderLine - 1),
x2: computedPosition.x + width + (borderLine - 1),
y2: computedPosition.y + width + (borderLine - 1)
},
style: {
lineWidth: 2,
lineWidth: borderLine,
stroke: '#A0A0A0'
}
});
this.add(this.rightBoard);
this.rightBoard.hide();
if (!(isShowBorder && showBorderBtn.includes(model.type))) { this.rightBoard.hide(); }
this.bottomBoard = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: computedPosition.x - 1,
y1: computedPosition.y + 15,
x2: computedPosition.x + 15,
y2: computedPosition.y + 15
x1: computedPosition.x - (borderLine - 1),
y1: computedPosition.y + width + (borderLine - 1),
x2: computedPosition.x + width + (borderLine - 1),
y2: computedPosition.y + width + (borderLine - 1)
},
style: {
lineWidth: 2,
lineWidth: borderLine,
stroke: '#A0A0A0'
}
});
this.add(this.bottomBoard);
this.bottomBoard.hide();
if (!(isShowBorder && showBorderBtn.includes(model.type))) { this.bottomBoard.hide(); }
const hasTextList = ['PASS', 'ASSIST', 'PICK_ASSIST', 'DEPART_ASSIST', 'ACCIDENT', 'CHANGE_DIRECTION', 'RECOVERY', 'OCCLUSION'];
if (hasTextList.includes(model.type) || (this.style.SignalButton && this.style.SignalButton.showName)) {
this.buttonText = new Text({
@ -280,10 +285,10 @@ export default class SignalButton extends Group {
this.arcShapeDock1 && this.arcShapeDock1.show();
this.arcShapeDock2 && this.arcShapeDock2.show();
this.buttonText && this.buttonText.show();
this.leftBoard && this.leftBoard.hide();
this.rightBoard && this.rightBoard.hide();
this.topBoard && this.topBoard.hide();
this.bottomBoard && this.bottomBoard.hide();
// this.leftBoard && this.leftBoard.hide();
// this.rightBoard && this.rightBoard.hide();
// this.topBoard && this.topBoard.hide();
// this.bottomBoard && this.bottomBoard.hide();
}
blockShow() {
this.rightLine && this.rightLine.show();
@ -304,6 +309,25 @@ export default class SignalButton extends Group {
}
}
}
const isShowBorder = this.style.SignalButton && this.style.SignalButton.isShowBorder;
// 接车按钮 通过按钮 引导按钮
const showBorderBtn = ['PICK', 'PASS', 'GUIDE'];
if (isShowBorder && showBorderBtn.includes(model.type)) {
if (this.rectButton) {
if (model.hasSelected) {
this.leftBoard && this.leftBoard.hide();
this.rightBoard && this.rightBoard.hide();
this.topBoard && this.topBoard.hide();
this.bottomBoard && this.bottomBoard.hide();
} else {
this.leftBoard && this.leftBoard.show();
this.rightBoard && this.rightBoard.show();
this.topBoard && this.topBoard.show();
this.bottomBoard && this.bottomBoard.show();
}
}
}
// { value: 'PICK', label: '接车按钮' },
// { value: 'SHUNT_TERMINAL', label: '调车终端按钮' },
if (!store.getters['map/checkDeviceShow'](this._code)) {

View File

@ -191,7 +191,9 @@ class StationStand extends Group {
}
if (this.style.Section.remainTime) {
const section = this.mapDevice[model.standTrackCode];
if (model.remainTime) {
// model.trainParking = true;
// model.remainTime = 20;
if (model.trainParking && model.remainTime) {
section.instance && section.instance.showRemainTime(model.remainTime);
} else {
section.instance && section.instance.hideRemainTime();