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

72 lines
1.5 KiB
JavaScript
Raw Normal View History

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();
}
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);
}
});
}
animateStyle(cb) {
this.eachChild((child) => {
cb(child);
});
}
2020-02-18 18:39:12 +08:00
}
export default ETriangle;