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.create(); } create() { const model = this.model; this.name = new Text({ _subType: 'SignalLamp', _val: '3', zlevel: model.zlevel, z: model.z, silent: model.silent, style: { textBorderColor: 'red', textBorderWidth: 0, x: model.x, y: model.y, fontWeight: model.fontWeight, fontSize: model.fontSize, fontFamily: model.fontFamily, text: model.text, textFill: model.textFill, textAlign: model.textAlign, textPosition: model.textPosition || 'inside', textVerticalAlign: 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;