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.create(); } create() { this.text = new Text({ zlevel: this.device.zlevel, z: this.device.z + 1, position: [0, 0], style: { x: this.device.model.position.x, y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30, fontWeight: 'normal', fontSize: this.device.style.LcControl.mouseOverStyle.fontSize, fontFamily: this.device.style.LcControl.mouseOverStyle.fontFamily, text: this.device.model.name, textFill: this.device.style.LcControl.mouseOverStyle.fontColor, textAlign: this.device.style.LcControl.mouseOverStyle.textAlign, textVerticalAlign: this.device.style.LcControl.mouseOverStyle.textVerticalAlign } }); this.add(this.text); this.text.hide(); } mouseover(e) { if (e.target && e.target._subType == 'Text') { this.text.show(); } else { this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor); this.device.control.setTextColor(this.device.style.LcControl.mouseOverStyle.textColor); this.device.control.setTextBorder(true); this.device.control.setArcBorder(true); } } mouseout(e) { if (!this.device.model.down) { if (e.target && e.target._subType == 'Text') { this.text.hide(); } else { this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor); this.device.control.setTextColor('#FFFFFF'); this.device.control.setTextBorder(false); this.device.control.setArcBorder(false); } } } }