54 lines
1.0 KiB
JavaScript
54 lines
1.0 KiB
JavaScript
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.isNew = false;
|
|
}
|
|
|
|
create() {
|
|
if (!this.isNew) {
|
|
const model = this.model;
|
|
const style = this.model.style;
|
|
|
|
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.fontFamily}`,
|
|
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();
|
|
}
|
|
}
|
|
|
|
export default EDetain;
|