rt-sim-training-client/src/jmap/shape/element/ETextName.js

50 lines
987 B
JavaScript
Raw Normal View History

2019-07-16 16:03:56 +08:00
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
/** 名称元素*/
export default class ETextName extends Group {
constructor(model) {
super();
this.model = model;
this.zlevel = model.zlevel;
this.z = model.z;
this._create();
}
_create() {
this.TextName = new Text({
_subType: this.model._subType,
zlevel: this.zlevel,
z: this.z,
2019-07-17 09:08:23 +08:00
silent: this.model.silent || false,
2019-07-16 16:03:56 +08:00
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,
2019-07-17 09:08:23 +08:00
textPosition: this.model.textPosition || 'inside',
textVerticalAlign: this.model.textVerticalAlign || null
2019-07-16 16:03:56 +08:00
}
});
this.add(this.TextName);
}
setStyle(model) {
this.TextName.setStyle(model);
}
2019-07-16 18:37:49 +08:00
setColor(color) {
this.TextName.setStyle('textFill', color);
}
2019-07-16 16:03:56 +08:00
hide() {
this.TextName.hide();
}
show() {
this.TextName.show();
}
}