2019-12-05 10:25:07 +08:00
|
|
|
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.selected = false;
|
|
|
|
this.create();
|
|
|
|
}
|
|
|
|
create() {
|
2019-12-05 15:48:01 +08:00
|
|
|
if (this.device && this.device.model.visible) {
|
2019-12-18 16:20:30 +08:00
|
|
|
const stationTextRect = this.device.stationText.getBoundingRect().clone();
|
2019-12-05 10:25:07 +08:00
|
|
|
this.lineBorder = new Rect({
|
|
|
|
zlevel: this.device.zlevel,
|
|
|
|
z: this.device.z + 1,
|
|
|
|
shape: stationTextRect,
|
|
|
|
style: {
|
2019-12-13 14:19:38 +08:00
|
|
|
fill: 'rgba(0,255,255,0.6)'
|
2019-12-05 10:25:07 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
this.add(this.lineBorder);
|
|
|
|
this.lineBorder.hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mouseover() {
|
|
|
|
this.lineBorder && this.lineBorder.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
mouseout() {
|
|
|
|
!this.selected && this.lineBorder && this.lineBorder.hide();
|
|
|
|
}
|
|
|
|
drawSelected(selected) {
|
|
|
|
if (selected && this.lineBorder) {
|
|
|
|
this.lineBorder && this.lineBorder.show();
|
|
|
|
this.selected = true;
|
|
|
|
} else {
|
|
|
|
this.lineBorder && this.lineBorder.hide();
|
|
|
|
this.selected = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|