46 lines
919 B
JavaScript
46 lines
919 B
JavaScript
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,
|
|
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.TextName);
|
|
}
|
|
|
|
setStyle(model) {
|
|
this.TextName.setStyle(model);
|
|
}
|
|
|
|
hide() {
|
|
this.TextName.hide();
|
|
}
|
|
|
|
show() {
|
|
this.TextName.show();
|
|
}
|
|
}
|