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

60 lines
1.2 KiB
JavaScript
Raw Normal View History

import Group from 'zrender/src/container/Group';
import Polygon from 'zrender/src/graphic/shape/Polygon';
class ERhomboid extends Group {
constructor(model) {
super();
this.model = model;
this.create();
}
create() {
const model = this.model;
const style = this.model.style;
this.section = new Polygon({ // 平行四边形
zlevel: model.zlevel,
z: model.z + 1,
shape: {
points: model.sectionPoints
},
style: {
fill: style.Section.line.spareColor
2020-02-18 18:39:12 +08:00
// fill: 'green'
},
cursor: model.cursor,
onmouseover: model.onmouseover,
onmouseout: model.onmouseout
});
this.hide();
this.add(this.section);
}
hide() {
this.section.hide();
}
show() {
this.section.show();
}
stopAnimation(flag) {
this.section.stopAnimation(flag);
}
getSection() {
return this.section;
}
2020-02-11 15:24:17 +08:00
setStyle(styles) {
this.eachChild((child) => {
if (child.setStyle) {
child.setStyle(styles);
}
});
}
}
export default ERhomboid;