2019-07-31 11:06:14 +08:00
|
|
|
import Group from 'zrender/src/container/Group';
|
2019-07-31 14:59:38 +08:00
|
|
|
import Rect from 'zrender/src/graphic/shape/Rect';
|
2019-07-31 11:06:14 +08:00
|
|
|
|
|
|
|
export default class EMouse extends Group {
|
|
|
|
constructor(device) {
|
|
|
|
super();
|
|
|
|
this.device = device;
|
2019-07-31 14:59:38 +08:00
|
|
|
this.zlevel = device.zlevel;
|
|
|
|
this.style = device.style;
|
2019-07-31 11:06:14 +08:00
|
|
|
this.down = true;
|
2019-07-31 14:59:38 +08:00
|
|
|
this.create();
|
|
|
|
}
|
|
|
|
|
|
|
|
create() {
|
|
|
|
this.lampRect = new Rect({
|
|
|
|
silent: true,
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: 6,
|
|
|
|
shape: this.device.getBoundingRect(),
|
|
|
|
style: {
|
2019-08-02 14:17:43 +08:00
|
|
|
lineDash: this.style.Signal.mouseOverStyle.borderLineDash,
|
|
|
|
stroke: this.style.Signal.mouseOverStyle.borderLineColor,
|
2019-07-31 14:59:38 +08:00
|
|
|
fill: this.style.transparentColor
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
this.nameRect = new Rect({
|
|
|
|
silent: true,
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: 5,
|
|
|
|
shape: this.device.sigName.getBoundingRect(),
|
|
|
|
style: {
|
2019-08-02 14:17:43 +08:00
|
|
|
lineDash: this.style.Signal.mouseOverStyle.borderLineDash,
|
|
|
|
stroke: this.style.Signal.mouseOverStyle.borderLineColor,
|
|
|
|
fill: this.style.Signal.mouseOverStyle.nameBackgroundColor
|
2019-07-31 14:59:38 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
this.lampRect.hide();
|
|
|
|
this.nameRect.hide();
|
|
|
|
this.add(this.lampRect);
|
|
|
|
this.add(this.nameRect);
|
2019-07-31 11:06:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
mouseover(e) {
|
2019-07-31 14:59:38 +08:00
|
|
|
this.nameRect.show();
|
|
|
|
this.lampRect.show();
|
|
|
|
this.device.lamps.forEach(elem => {
|
2019-08-02 14:17:43 +08:00
|
|
|
elem.setBorderColor(this.style.Signal.mouseOverStyle.lampBorderLineColor);
|
2019-07-31 14:59:38 +08:00
|
|
|
});
|
|
|
|
this.device.sigName.setColor(this.style.backgroundColor);
|
2019-07-31 11:06:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
mouseout(e) {
|
2019-08-05 18:42:37 +08:00
|
|
|
if (!this.down) {
|
|
|
|
this.nameRect.hide();
|
|
|
|
this.lampRect.hide();
|
|
|
|
this.device.lamps.forEach(elem => {
|
|
|
|
elem.setBorderColor(this.style.Signal.lamp.borderColor);
|
|
|
|
});
|
|
|
|
this.device.setState(this.device.model);
|
|
|
|
}
|
2019-07-31 11:06:14 +08:00
|
|
|
}
|
|
|
|
}
|