2020-02-18 18:39:12 +08:00
|
|
|
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,
|
2020-02-28 15:20:26 +08:00
|
|
|
// fill: 'green',
|
2020-02-18 18:39:12 +08:00
|
|
|
lineWidth: 0,
|
|
|
|
stroke: style.Section.line.spareColor
|
|
|
|
},
|
|
|
|
cursor: model.cursor,
|
|
|
|
onmouseover: model.onmouseover,
|
|
|
|
onmouseout: model.onmouseout
|
|
|
|
});
|
|
|
|
|
|
|
|
this.hide();
|
|
|
|
this.add(this.section);
|
|
|
|
}
|
|
|
|
|
|
|
|
hide() {
|
|
|
|
this.section.hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
show() {
|
|
|
|
this.section.show();
|
|
|
|
}
|
|
|
|
|
2020-03-24 13:39:20 +08:00
|
|
|
setColor(color) {
|
|
|
|
this.section.setStyle({ fill: color });
|
|
|
|
}
|
|
|
|
|
2020-02-18 18:39:12 +08:00
|
|
|
stopAnimation(flag) {
|
|
|
|
this.section.stopAnimation(flag);
|
|
|
|
}
|
|
|
|
|
|
|
|
getSection() {
|
|
|
|
return this.section;
|
|
|
|
}
|
|
|
|
|
|
|
|
setStyle(styles) {
|
|
|
|
this.eachChild((child) => {
|
|
|
|
if (child.setStyle) {
|
|
|
|
child.setStyle(styles);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-03-24 13:39:20 +08:00
|
|
|
animateStyle(cb) {
|
|
|
|
this.eachChild((child) => {
|
|
|
|
cb(child);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-02-18 18:39:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export default ETriangle;
|