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({ _subType: 'Text', zlevel: this.device.zlevel, z: this.device.z + 1, position: [0, 0], style: { x: 0, y: this.device.model.position.y + this.device.style.Station.StationControl.lamp.radiusR + this.device.style.Station.StationControl.text.distance - 25, fontWeight: this.device.style.Station.StationControl.mouseOverStyle.fontWeight, fontSize: this.device.style.Station.StationControl.mouseOverStyle.fontSize, fontFamily: this.device.style.fontFamily, text: this.device.model.name, textFill: this.device.style.Station.StationControl.mouseOverStyle.fontColor, textAlign: this.device.style.Station.StationControl.mouseOverStyle.textAlign, textVerticalAlign: this.device.style.Station.StationControl.mouseOverStyle.textVerticalAlign } }); this.add(this.text); this.text.hide(); } mouseover(e) { if (e.target && e.target.type == 'text' && e.target._subType == 'ControlSignal') { this.text.setStyle({x: e.target.style.x}); this.text.show(); } } mouseout(e) { if (!this.device.__down) { if (e.target) { this.text.hide(); } } } }