rt-sim-training-client/src/jmapNew/shape/Switch/ESwLocal.js

63 lines
1.3 KiB
JavaScript

import Group from 'zrender/src/container/Group';
import Polygon from 'zrender/src/graphic/shape/Polygon';
class ESwLocal extends Group {
constructor(model) {
super();
this.model = model;
this.create();
}
create() {
const model = this.model;
const style = this.model.style;
this.locShelter = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points: model.shelterPoints
},
style: {
fill: style.backgroundColor
// fill: 'red'
},
cursor: model.cursor,
onmouseover: model.onmouseover,
onmouseout: model.onmouseout
});
this.add(this.locShelter);
this.locShelter.show();
}
hide() {
this.locShelter.hide();
this.locShelter.setStyle({ fill: this.model.style.backgroundColor });
this.stopAnimation(false);
}
show() {
this.locShelter.show();
}
stopAnimation(flag) {
this.locShelter.stopAnimation(flag);
}
setColor(color) {
this.locShelter.setStyle({ fill: color });
}
animateStyle(cb) {
this.eachChild((child) => {
cb(child);
});
}
getLocal() {
return this.locShelter;
}
}
export default ESwLocal;