rt-sim-training-client/src/jmap/shape/Signal/ESigName.js

51 lines
954 B
JavaScript
Raw Normal View History

2019-07-19 09:23:56 +08:00
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
class ESigName extends Group {
constructor(model) {
super();
this.model = model;
this.zlevel = model.zlevel;
this.z = model.z;
this._create();
}
_create() {
this.name = new Text({
_subType: this.model._subType,
zlevel: this.zlevel,
z: this.z,
silent: this.model.silent || false,
style: {
x: this.model.x,
y: this.model.y,
text: this.model.text,
textFont: this.model.textFont,
textFill: this.model.textFill,
textAlign: this.model.textAlign,
textPosition: this.model.textPosition || 'inside',
textVerticalAlign: this.model.textVerticalAlign || null
}
});
this.add(this.name);
}
setStyle(model) {
this.name.setStyle(model);
}
setColor(color) {
this.name.setStyle('textFill', color);
}
hide() {
this.name.hide();
}
show() {
this.name.show();
}
}
export default ESigName;