rt-sim-training-client/src/jmapNew/shape/Switch/ESwLnversion.js
2020-06-01 10:27:34 +08:00

63 lines
1.4 KiB
JavaScript

import Group from 'zrender/src/container/Group';
import Polygon from 'zrender/src/graphic/shape/Polygon';
class ESwLnversion extends Group {
constructor(model) {
super();
this.model = model;
this.create();
}
create() {
const model = this.model;
const style = this.model.style;
this.relocShelter = new Polygon({ // 遮盖B区段范围
zlevel: model.zlevel,
z: model.z,
shape: {
points: model.shelterPoints
},
style: {
fill: style.backgroundColor
// fill: 'yellow'
},
cursor: model.cursor,
onmouseover: model.onmouseover,
onmouseout: model.onmouseout
});
this.hide();
this.add(this.relocShelter);
}
hide() {
this.relocShelter.hide();
this.relocShelter.setStyle({ fill: this.model.style.backgroundColor });
this.stopAnimation(false);
}
show() {
this.relocShelter.show();
}
setColor(color) {
this.relocShelter.setStyle({ fill: color });
}
stopAnimation(flag) {
this.relocShelter.stopAnimation(flag);
}
getSection() {
return this.relocShelter;
}
animateStyle(cb) {
this.eachChild((child) => {
cb(child);
});
}
}
export default ESwLnversion;