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

59 lines
1.4 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 ELevel 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.level = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: model.x,
y: model.y,
fontWeight: 'normal',
2020-02-17 17:50:15 +08:00
fontSize: style.StationStand.stopTime.textFontSize || style.StationStand.common.textFontSize,
fontFamily: style.fontFamily,
text: model.name,
textFill: style.StationStand.level.textColor,
2020-02-17 17:50:15 +08:00
textAlign: 'center',
textVerticalAlign: 'middle'
}
});
this.add(this.level);
}
}
setName(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();
}
2019-11-29 12:51:58 +08:00
}
export default ELevel;