修改代码

This commit is contained in:
ival 2019-07-24 10:13:01 +08:00
parent 7609233eb5
commit 8a4239a865
10 changed files with 151 additions and 119 deletions

View File

@ -15,6 +15,8 @@ class ESigPass extends Group {
const style = this.model.style;
const rotation = model.drict != 1? 0 : Math.PI;
const point = arrows(model.x, model.y, style.Signal.signalAutoWidth, style.Signal.lamp.signalR * 0.8);
this.isNew = true;
this.arrows = new Polygon({
zlevel: model.zlevel,
z: model.z,
@ -29,7 +31,6 @@ class ESigPass extends Group {
}
});
this.add(this.arrows);
this.isNew = true;
}
}
@ -48,8 +49,10 @@ class ESigPass extends Group {
// 箭头闪烁
arrowsAnimation() {
this._create();
const style = this.model.style;
const fill = this.arrows.style.Signal.fill;
this.arrows.animate(true)
.when(1000, { fill: style.backgroundColor, stroke: style.style.backgroundColor })
.when(2000, { fill: fill, stroke: style.style.Signal.sidelineColor })

View File

@ -18,6 +18,7 @@ class ESigButton extends Group {
const padding = 1;
const r = style.Signal.lamp.signalR * 0.8;
this.isNew = true;
this.sigNormalButtom = new Rect({
zlevel: model.zlevel,
z: model.z,
@ -89,7 +90,6 @@ class ESigButton extends Group {
this.add(this.sigNormalButtom);
this.add(this.sigReentryButton);
this.hide();
this.isNew = true;
}
}

View File

@ -11,6 +11,8 @@ class ESigDelay extends Group {
_create() {
if (!this.isNew) {
const model = this.model;
this.isNew = true;
this.name = new Text({
_subType: model._subType,
zlevel: model.zlevel,
@ -28,7 +30,6 @@ class ESigDelay extends Group {
}
});
this.add(this.name);
this.isNew = true;
}
}

View File

@ -13,6 +13,8 @@ class ESigDrict extends Group {
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
this.isNew = true;
this.sigDrict = new Polygon({
zlevel: model.zlevel,
z: model.z,
@ -27,7 +29,6 @@ class ESigDrict extends Group {
});
this.add(this.sigDrict);
this.isNew = true;
}
}

View File

@ -5,40 +5,47 @@ class EDetain extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
const style = this.model.style;
this.detain = new Text({
zlevel: model.zlevel,
z: model.z,
position: [0, 0],
style: {
x: model.x,
y: model.y,
text: style.StationStand.detainCar.text,
textAlign: model.textAlign,
textVerticalAlign: model.textVerticalAlign,
fontSize: `${style.StationStand.stand.headFontSize} px ${style.textFontFormat}`,
textFill: style.StationStand.detainCar.centerTrainColor,
textStroke: style.backgroundColor
}
});
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
this.add(this.detain);
this.isNew = true;
this.detain = new Text({
zlevel: model.zlevel,
z: model.z,
position: [0, 0],
style: {
x: model.x,
y: model.y,
text: style.StationStand.detainCar.text,
textAlign: model.textAlign,
textVerticalAlign: model.textVerticalAlign,
fontSize: `${style.StationStand.stand.headFontSize} px ${style.textFontFormat}`,
textFill: style.StationStand.detainCar.centerTrainColor,
textStroke: style.backgroundColor
}
});
this.add(this.detain);
}
}
setColor(color) {
this._create();
this.detain.setStyle('textFill', color);
}
hide() {
this._create();
this.detain.hide();
}
show() {
this._create();
this.detain.show();
}
}

View File

@ -5,46 +5,49 @@ class EJump extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
const style = this.model.style;
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
this.jump = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: model.x,
y: model.y,
text: model.name,
textFill: style.StationStand.level.textColor,
textAlign: 'middle',
textFont: `${style.StationStand.common.textFontSize} px ${style.textFontFormat}`
}
});
this.isNew = true;
this.jump = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: model.x,
y: model.y,
text: model.name,
textFill: style.StationStand.level.textColor,
textAlign: 'middle',
textFont: `${style.StationStand.common.textFontSize} px ${style.textFontFormat}`
}
});
this.add(this.jump);
this.add(this.jump);
}
}
setName(val) {
this.jump.attr({
style: {
text: val
}
});
this._create();
this.jump.setStyle('text', val);
}
setColor(color) {
this._create();
this.jump.setStyle('textFill', color);
}
hide() {
this._create();
this.jump.hide();
}
show() {
this._create();
this.jump.show();
}
}

View File

@ -5,46 +5,49 @@ class ELevel extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
const style = this.model.style;
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
this.level = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: model.x,
y: model.y,
text: model.name,
textFill: style.StationStand.level.textColor,
textAlign: 'middle',
textFont: `${style.StationStand.common.textFontSize} px ${style.textFontFormat}`
}
});
this.isNew = true;
this.level = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: model.x,
y: model.y,
text: model.name,
textFill: style.StationStand.level.textColor,
textAlign: 'middle',
textFont: `${style.StationStand.common.textFontSize} px ${style.textFontFormat}`
}
});
this.add(this.level);
this.add(this.level);
}
}
setName(val) {
this.level.attr({
style: {
text: val
}
});
this._create();
this.level.setStyle('text', val);
}
setColor(color) {
this._create();
this.level.setStyle('textFill', color);
}
hide() {
this._create();
this.level.hide();
}
show() {
this._create();
this.level.show();
}
}

View File

@ -6,36 +6,42 @@ class EReentry extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
if (!this.isNew) {
const model = this.model;
this.reentry = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points: flashlight(model.x, model.y, model.drict, 10, 5, 0, 0, 4)
},
style: {
lineWidth: model.lineWidth,
fill: model.fill
}
});
this.isNew = true;
this.reentry = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points: flashlight(model.x, model.y, model.drict, 10, 5, 0, 0, 4)
},
style: {
lineWidth: model.lineWidth,
fill: model.fill
}
});
this.add(this.reentry);
this.add(this.reentry);
}
}
setColor(color) {
this._create();
this.reentry.setStyle('textFill', color);
}
hide() {
this._create();
this.reentry.hide();
}
show() {
this._create();
this.reentry.show();
}
}

View File

@ -5,37 +5,42 @@ class ESafeEmergent extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
const style = this.model.style;
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
this.emergent = new Isogon({
zlevel: model.zlevel,
z: model.z,
shape: {
x: model.x,
y: model.y,
r: model.r,
n: model.n
},
style: {
lineWidth: 0,
stroke: style.StationStand.standEmergent.closeColor,
fill: style.StationStand.standEmergent.closeColor
}
});
this.isNew = true;
this.emergent = new Isogon({
zlevel: model.zlevel,
z: model.z,
shape: {
x: model.x,
y: model.y,
r: model.r,
n: model.n
},
style: {
lineWidth: 0,
stroke: style.StationStand.standEmergent.closeColor,
fill: style.StationStand.standEmergent.closeColor
}
});
this.add(this.emergent);
this.add(this.emergent);
}
}
hide() {
this._create();
this.emergent.hide();
}
show() {
this._create();
this.emergent.show();
}
}

View File

@ -5,46 +5,49 @@ class ETime extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
const style = this.model.style;
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
this.time = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: model.x,
y: model.y,
text: model.name,
textFill: style.StationStand.stopTime.textColor,
textAlign: 'middle',
textFont: `${style.StationStand.common.textFontSize} px ${style.textFontFormat}`
}
});
this.isNew = true;
this.time = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: model.x,
y: model.y,
text: model.name,
textFill: style.StationStand.stopTime.textColor,
textAlign: 'middle',
textFont: `${style.StationStand.common.textFontSize} px ${style.textFontFormat}`
}
});
this.add(this.time);
this.add(this.time);
}
}
setName(val) {
this.time.attr({
style: {
text: val
}
});
this._create();
this.time.setStyle('text', val);
}
setColor(color) {
this._create();
this.time.setStyle('textFill', color);
}
hide() {
this._create();
this.time.hide();
}
show() {
this._create();
this.time.show();
}
}