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

58 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;
2020-03-27 10:17:24 +08:00
this.level = null;
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,
2020-03-27 10:17:24 +08:00
fontWeight: style.textStyle.fontWeight,
fontSize: style.StationStand.stopTime.textFontSize,
fontFamily: style.fontFamily,
text: model.name,
textFill: style.StationStand.level.textColor,
2020-03-27 10:17:24 +08:00
textAlign: style.textStyle.textAlign,
textVerticalAlign: style.textStyle.textVerticalAlign
}
});
this.add(this.level);
}
}
setName(val) {
this.create();
this.level.setStyle('text', val);
}
setColor(color) {
this.create();
this.level.setStyle('textFill', color);
}
2020-03-27 17:26:17 +08:00
hideMode() {
2020-03-27 10:17:24 +08:00
this.level && this.level.hide();
}
2020-03-27 17:26:17 +08:00
showMode() {
this.create();
this.level.show();
}
2019-11-29 12:51:58 +08:00
}
export default ELevel;