import Group from 'zrender/src/container/Group'; import Rect from 'zrender/src/graphic/shape/Rect'; export default class EMouse extends Group { constructor(device) { super(); this.device = device; this.zlevel = device.zlevel; this.style = device.style; this.create(); } create() { this.border = new Rect({ silent: true, zlevel: this.zlevel, z: 0, shape: { x: 0, y: 0, width: 0, height: 0 }, style: { lineDash: this.style.StationStand.mouseOverStyle.borderLineDash, stroke: this.style.StationStand.mouseOverStyle.borderLineColor, fill: this.style.transparentColor } }); this.border.hide(); this.add(this.border); } mouseover(e) { const model = this.device.model; const mapDevice = this.device.mapDevice; const psdModel = mapDevice[model.psdCode]; const rect = this.device.getBoundingRect().clone(); if (psdModel && psdModel.instance) { rect.union( psdModel.instance.getBoundingRect()); } if (this.style.StationStand.mouseOverStyle.standBackgroundColor) { this.device.solidStand && this.device.solidStand.removeHover(); this.device.solidStand && this.device.solidStand.addHover({ fill: this.device.__over ? this.style.StationStand.mouseOverStyle.standBackgroundColorOver : this.style.StationStand.mouseOverStyle.standBackgroundColor }); } this.border.setShape(rect); this.border.show(); } mouseout(e) { if (!this.device.__down) { if (this.style.StationStand.mouseOverStyle.standBackgroundColor) { this.device.solidStand && this.device.solidStand.removeHover(); } this.border.hide(); } } }