62 lines
1.3 KiB
JavaScript
62 lines
1.3 KiB
JavaScript
|
import Group from 'zrender/src/container/Group';
|
||
|
import Polyline from 'zrender/src/graphic/shape/Polyline';
|
||
|
|
||
|
class ETriangle extends Group {
|
||
|
constructor(model) {
|
||
|
super();
|
||
|
this.model = model;
|
||
|
this.create();
|
||
|
}
|
||
|
|
||
|
create() {
|
||
|
const model = this.model;
|
||
|
const style = this.model.style;
|
||
|
this.section = new Polyline({ // 平行四边形
|
||
|
zlevel: model.zlevel,
|
||
|
z: model.z + 1,
|
||
|
shape: {
|
||
|
points: model.sectionPoints
|
||
|
},
|
||
|
style: {
|
||
|
fill: style.Section.line.spareColor,
|
||
|
lineWidth: 0,
|
||
|
stroke: style.Section.line.spareColor
|
||
|
// 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;
|
||
|
}
|
||
|
|
||
|
setStyle(styles) {
|
||
|
this.eachChild((child) => {
|
||
|
if (child.setStyle) {
|
||
|
child.setStyle(styles);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
export default ETriangle;
|