rt-sim-training-client/src/jmapNew/shape/Signal/EMouse.js
lVAL 08de82a230 线路:宁波1
问题:站台部分操作完成后,深蓝色高亮未清除干净
2021-02-22 17:49:55 +08:00

64 lines
1.9 KiB
JavaScript

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.lampRect = new Rect({
silent: true,
zlevel: this.zlevel,
z: 6,
shape: this.device.getBoundingRect(),
style: {
lineDash: this.style.Signal.mouseOverStyle.borderLineDash,
stroke: this.style.Signal.mouseOverStyle.borderLineColor,
fill: this.style.transparentColor
}
});
this.nameRect = new Rect({
silent: true,
zlevel: this.zlevel,
z: 5,
shape: this.device.sigName.getBoundingRect(),
style: {
lineDash: this.style.Signal.mouseOverStyle.borderLineDash,
stroke: this.style.Signal.mouseOverStyle.borderLineColor,
fill: this.style.Signal.mouseOverStyle.nameBackgroundColor
}
});
this.lampRect.hide();
this.nameRect.hide();
this.add(this.lampRect);
this.add(this.nameRect);
}
mouseover(e) {
this.nameRect.show();
this.lampRect.show();
this.device.lamps.forEach(elem => {
elem.setBorderColor(this.style.Signal.mouseOverStyle.lampBorderLineColor);
});
this.device.sigName && this.device.sigName.setColor(this.style.backgroundColor);
}
mouseout(e) {
if (!this.device.__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);
}
}
}