2019-12-05 10:25:07 +08:00
|
|
|
import Group from 'zrender/src/container/Group';
|
2021-02-19 17:27:10 +08:00
|
|
|
import Text from 'zrender/src/graphic/Text';
|
2019-12-05 10:25:07 +08:00
|
|
|
|
|
|
|
export default class EMouse extends Group {
|
|
|
|
constructor(device) {
|
|
|
|
super();
|
|
|
|
this.device = device;
|
|
|
|
this.create();
|
|
|
|
}
|
|
|
|
create() {
|
2021-02-19 17:27:10 +08:00
|
|
|
this.text = new Text({
|
|
|
|
_subType: 'Text',
|
|
|
|
zlevel: this.device.zlevel,
|
|
|
|
z: this.device.z + 1,
|
|
|
|
position: [0, 0],
|
|
|
|
style: {
|
|
|
|
x: 0,
|
|
|
|
y: this.device.model.position.y + this.device.style.Station.StationControl.lamp.radiusR + this.device.style.Station.StationControl.text.distance - 25,
|
|
|
|
fontWeight: this.device.style.Station.StationControl.mouseOverStyle.fontWeight,
|
|
|
|
fontSize: this.device.style.Station.StationControl.mouseOverStyle.fontSize,
|
|
|
|
fontFamily: this.device.style.fontFamily,
|
|
|
|
text: this.device.model.name,
|
|
|
|
textFill: this.device.style.Station.StationControl.mouseOverStyle.fontColor,
|
|
|
|
textAlign: this.device.style.Station.StationControl.mouseOverStyle.textAlign,
|
|
|
|
textVerticalAlign: this.device.style.Station.StationControl.mouseOverStyle.textVerticalAlign
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.add(this.text);
|
|
|
|
this.text.hide();
|
2019-12-05 10:25:07 +08:00
|
|
|
}
|
2021-02-19 17:27:10 +08:00
|
|
|
mouseover(e) {
|
|
|
|
if (e.target &&
|
|
|
|
e.target.type == 'text' &&
|
|
|
|
e.target._subType == 'ControlSignal') {
|
|
|
|
this.text.setStyle({x: e.target.style.x});
|
|
|
|
this.text.show();
|
|
|
|
}
|
2019-12-05 10:25:07 +08:00
|
|
|
}
|
|
|
|
|
2021-02-19 17:27:10 +08:00
|
|
|
mouseout(e) {
|
|
|
|
if (!this.device.model.down) {
|
|
|
|
if (e.target) {
|
|
|
|
this.text.hide();
|
|
|
|
}
|
2019-12-05 10:25:07 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|