2019-07-31 18:24:28 +08:00
|
|
|
import Group from 'zrender/src/container/Group';
|
|
|
|
import Text from 'zrender/src/graphic/Text';
|
|
|
|
|
|
|
|
export default class EMouse extends Group {
|
|
|
|
constructor(device) {
|
|
|
|
super();
|
|
|
|
this.device = device;
|
|
|
|
this.down = true;
|
2019-08-02 14:17:43 +08:00
|
|
|
this.create();
|
2019-07-31 18:24:28 +08:00
|
|
|
}
|
2019-08-02 14:17:43 +08:00
|
|
|
create() {
|
2019-07-31 18:24:28 +08:00
|
|
|
this.text = new Text({
|
|
|
|
_subType: 'Text',
|
|
|
|
zlevel: this.device.zlevel,
|
|
|
|
z: this.device.z+1,
|
|
|
|
position: [0, 0],
|
|
|
|
style: {
|
|
|
|
x: this.device.model.position.x - this.device.style.StationControl.stationControlDistance / 2 + this.device.style.StationControl.stationOffset.x,
|
2019-08-02 10:39:59 +08:00
|
|
|
y: this.device.model.position.y + this.device.style.StationControl.stationOffset.y + this.device.style.StationControl.stationControlmodeR + this.device.style.nameDistance-40,
|
2019-07-31 18:24:28 +08:00
|
|
|
fontWeight: this.device.style.StationControl.mouseOverStyle.fontWeight,
|
|
|
|
fontSize: this.device.style.StationControl.mouseOverStyle.fontSize,
|
|
|
|
fontFamily: this.device.style.StationControl.mouseOverStyle.fontFormat,
|
|
|
|
text: '填充',
|
|
|
|
textFill: this.device.style.StationControl.mouseOverStyle.fontColor,
|
|
|
|
textAlign: this.device.style.StationControl.mouseOverStyle.textAlign,
|
|
|
|
textVerticalAlign: this.device.style.StationControl.mouseOverStyle.textVerticalAlign
|
|
|
|
}
|
|
|
|
});
|
2019-08-02 14:17:43 +08:00
|
|
|
|
2019-07-31 18:24:28 +08:00
|
|
|
this.add(this.text);
|
2019-08-02 10:39:59 +08:00
|
|
|
this.text.hide();
|
2019-07-31 18:24:28 +08:00
|
|
|
}
|
|
|
|
setTextContext(text) {
|
|
|
|
if (text) {
|
|
|
|
this.text.setStyle('text', text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mouseover(e) {
|
|
|
|
let name = '';
|
|
|
|
switch (e.target.parent._subType) {
|
|
|
|
case 'emergency':
|
|
|
|
name = '紧急站控';
|
|
|
|
break;
|
|
|
|
case 'center':
|
|
|
|
name = '中控';
|
|
|
|
break;
|
|
|
|
case 'substation':
|
|
|
|
name = '站控';
|
|
|
|
break;
|
|
|
|
}
|
2019-08-02 10:39:59 +08:00
|
|
|
// debugger;
|
2019-07-31 18:24:28 +08:00
|
|
|
this.setTextContext(name);
|
2019-08-02 10:39:59 +08:00
|
|
|
this.text.show();
|
2019-07-31 18:24:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
mouseout(e) {
|
2019-08-02 10:39:59 +08:00
|
|
|
this.text.hide();
|
2019-07-31 18:24:28 +08:00
|
|
|
}
|
|
|
|
}
|