import Group from 'zrender/src/container/Group'; import Text from 'zrender/src/graphic/Text'; export default class EMouse extends Group { constructor(device) { super(); this.device = device; this.down = false; this.create(); } create() { this.text = new Text({ _subType: 'Text', zlevel: this.device.zlevel, z: this.device.z+1, position: [0, 0], style: { x: this.device.model.position.x - this.device.style.StationControl.lamp.distance / 2 + this.device.style.StationControl.lamp.offset.x, y: this.device.model.position.y + this.device.style.StationControl.lamp.offset.y + this.device.style.StationControl.lamp.radiusR + this.device.style.StationControl.text.distance-40, fontWeight: this.device.style.StationControl.mouseOverStyle.fontWeight, fontSize: this.device.style.StationControl.mouseOverStyle.fontSize, fontFamily: this.device.style.StationControl.mouseOverStyle.fontFormat, text: '填充', textFill: this.device.style.StationControl.mouseOverStyle.fontColor, textAlign: this.device.style.StationControl.mouseOverStyle.textAlign, textVerticalAlign: this.device.style.StationControl.mouseOverStyle.textVerticalAlign } }); this.add(this.text); this.text.hide(); } setTextContext(text) { if (text) { this.text.setStyle('text', text); } } mouseover(e) { let name = ''; switch (e.target.parent._subType) { case 'emergency': name = '紧急站控'; break; case 'center': name = '中控'; break; case 'substation': name = '站控'; break; } // debugger; this.setTextContext(name); this.text.show(); } mouseout(e) { if (!this.down) { this.text.hide(); } } }