rt-sim-training-client/src/jmapNew/shape/TrainWindow/EMouse.js

38 lines
1.0 KiB
JavaScript

export default class EMouse {
constructor(device) {
this.device = device;
}
mouseover(e) {
if (this.device.prdType) {
this.device.setVisible(true);
const instance = this.device.getInstanceByCode(this.device.model.sectionCode);
if (instance && instance.mouseEvent && instance.mouseEvent.mouseover) {
instance.mouseEvent.mouseEnter(e);
}
}
}
mouseout(e) {
if (this.device.prdType) {
this.device.setVisible(false);
const instance = this.device.getInstanceByCode(this.device.model.sectionCode);
if (instance && instance.mouseEvent && instance.mouseEvent.mouseout) {
instance.mouseEvent.mouseLeave(e);
}
}
}
mouseEnter() {
if (this.device.prdType) {
this.device.setVisible(true);
}
}
mouseLeave() {
if (this.device.prdType ) {
this.device.setVisible(false);
}
}
}