2019-07-17 09:17:49 +08:00
|
|
|
import Polygon from 'zrender/src/graphic/shape/Polygon';
|
|
|
|
import Group from 'zrender/src/container/Group';
|
|
|
|
|
|
|
|
class ESigAuto extends Group {
|
|
|
|
constructor(model) {
|
|
|
|
super();
|
|
|
|
this.model = model;
|
|
|
|
this._create();
|
|
|
|
}
|
|
|
|
|
|
|
|
_create() {
|
|
|
|
const model = this.model;
|
|
|
|
|
|
|
|
this.arrows = new Polygon({
|
|
|
|
zlevel: model.zlevel,
|
|
|
|
z: model.z,
|
|
|
|
shape: {
|
2019-07-17 18:18:28 +08:00
|
|
|
points: model.point
|
2019-07-17 09:17:49 +08:00
|
|
|
},
|
|
|
|
style: {
|
2019-07-17 18:18:28 +08:00
|
|
|
stroke: model.stroke,
|
|
|
|
lineWidth: model.lineWidth,
|
|
|
|
fill: model.fill
|
2019-07-17 09:17:49 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
this.add(this.arrows);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 停止动画
|
|
|
|
animationRecover() {
|
|
|
|
this.arrows.stopAnimation(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 箭头颜色
|
|
|
|
setColor(color) {
|
|
|
|
this.arrows.setStyle('fill', color);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 箭头闪烁
|
|
|
|
arrowsAnimation() {
|
|
|
|
const style = this.model.style;
|
|
|
|
const fill = this.arrows.style.Signal.fill;
|
|
|
|
this.arrows.animate(true)
|
|
|
|
.when(1000, { fill: style.backgroundColor, stroke: style.style.backgroundColor })
|
|
|
|
.when(2000, { fill: fill, stroke: style.style.Signal.sidelineColor })
|
|
|
|
.when(3000, { fill: style.style.backgroundColor, stroke: style.style.backgroundColor })
|
|
|
|
.when(4000, { fill: fill, stroke: style.style.Signal.sidelineColor })
|
|
|
|
.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ESigAuto;
|