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

63 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-11-29 12:51:58 +08:00
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);
}
2020-06-01 10:27:34 +08:00
getSection() {
return this.relocShelter;
}
animateStyle(cb) {
this.eachChild((child) => {
cb(child);
});
}
2019-11-29 12:51:58 +08:00
}
export default ESwLnversion;