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 {
|
2020-01-13 16:52:00 +08:00
|
|
|
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',
|
|
|
|
fontSize: style.StationStand.common.textFontSize,
|
|
|
|
fontFamily: style.fontFamily,
|
|
|
|
text: model.name,
|
|
|
|
textFill: style.StationStand.level.textColor,
|
|
|
|
textAlign: '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;
|