2019-11-29 12:51:58 +08:00
|
|
|
import Group from 'zrender/src/container/Group';
|
|
|
|
import Rect from 'zrender/src/graphic/shape/Rect';
|
|
|
|
|
|
|
|
export default class EMouse extends Group {
|
2019-12-12 15:31:01 +08:00
|
|
|
constructor(device) {
|
|
|
|
super();
|
|
|
|
this.device = device;
|
|
|
|
this.zlevel = device.zlevel;
|
|
|
|
this.style = device.style;
|
|
|
|
this.create();
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2019-12-12 15:31:01 +08:00
|
|
|
create() {
|
|
|
|
this.border = new Rect({
|
|
|
|
silent: true,
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: 0,
|
2021-02-19 17:27:10 +08:00
|
|
|
shape: {
|
|
|
|
x: 0,
|
|
|
|
y: 0,
|
|
|
|
width: 0,
|
|
|
|
height: 0
|
|
|
|
},
|
2019-12-12 15:31:01 +08:00
|
|
|
style: {
|
|
|
|
lineDash: this.style.StationStand.mouseOverStyle.borderLineDash,
|
|
|
|
stroke: this.style.StationStand.mouseOverStyle.borderLineColor,
|
|
|
|
fill: this.style.transparentColor
|
|
|
|
}
|
|
|
|
});
|
2021-02-19 17:27:10 +08:00
|
|
|
|
2019-12-12 15:31:01 +08:00
|
|
|
this.border.hide();
|
|
|
|
this.add(this.border);
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2019-12-12 15:31:01 +08:00
|
|
|
mouseover(e) {
|
2021-02-19 17:27:10 +08:00
|
|
|
const model = this.device.model;
|
|
|
|
const mapDevice = this.device.mapDevice;
|
|
|
|
const psdModel = mapDevice[model.psdCode];
|
|
|
|
const rect = this.device.getBoundingRect().clone();
|
|
|
|
|
2021-02-20 17:02:40 +08:00
|
|
|
if (psdModel && psdModel.instance) {
|
|
|
|
rect.union( psdModel.instance.getBoundingRect());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.style.StationStand.mouseOverStyle.standBackgroundColor) {
|
2021-02-22 16:29:45 +08:00
|
|
|
this.device.solidStand && this.device.solidStand.removeHover();
|
|
|
|
this.device.solidStand && this.device.solidStand.addHover({
|
2021-02-20 17:02:40 +08:00
|
|
|
fill: this.device.__over
|
|
|
|
? this.style.StationStand.mouseOverStyle.standBackgroundColorOver
|
|
|
|
: this.style.StationStand.mouseOverStyle.standBackgroundColor
|
2021-02-22 16:29:45 +08:00
|
|
|
});
|
2021-02-19 17:27:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
this.border.setShape(rect);
|
2019-12-12 15:31:01 +08:00
|
|
|
this.border.show();
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2019-12-12 15:31:01 +08:00
|
|
|
mouseout(e) {
|
2021-02-22 17:49:55 +08:00
|
|
|
if (!this.device.__down) {
|
2021-02-20 17:02:40 +08:00
|
|
|
if (this.style.StationStand.mouseOverStyle.standBackgroundColor) {
|
2021-02-22 16:29:45 +08:00
|
|
|
this.device.solidStand && this.device.solidStand.removeHover();
|
2021-02-20 17:02:40 +08:00
|
|
|
}
|
|
|
|
this.border.hide();
|
2019-12-12 15:31:01 +08:00
|
|
|
}
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|