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

63 lines
1.3 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 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);
2020-03-27 10:02:41 +08:00
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;
}
2019-11-29 12:51:58 +08:00
}
export default ESwLocal;