rt-sim-training-client/src/jmapNew/shape/StationStand/EDetain.js

47 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-11-29 12:51:58 +08:00
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
class EDetain extends Group {
constructor(model) {
super();
this.model = model;
this.detain = null;
2020-03-07 19:12:19 +08:00
this.create();
}
2020-03-26 15:04:52 +08:00
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,
fontSize: `${style.StationStand.detainCar.fontSize} px ${style.fontFamily}`,
textFill: style.StationStand.detainCar.centerTrainColor,
textStroke: style.backgroundColor,
textAlign: style.textStyle.textAlign,
textVerticalAlign: style.textStyle.textVerticalAlign
}
2020-03-26 15:04:52 +08:00
});
this.add(this.detain);
}
setColor(color) {
this.detain.setStyle('textFill', color);
}
hide() {
this.detain.hide();
}
2020-03-26 15:04:52 +08:00
show() {
2020-03-07 19:12:19 +08:00
this.detain.show();
}
2019-11-29 12:51:58 +08:00
}
export default EDetain;