Skip to content

Commit

Permalink
Merge pull request #243 from Jeffy2012/fix-line-point-animation
Browse files Browse the repository at this point in the history
Fix line point animation
  • Loading branch information
paleface001 committed Nov 16, 2019
2 parents 4b8b9db + 15e0593 commit c9a2ae5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
10 changes: 9 additions & 1 deletion src/plots/area/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,15 @@ export default class AreaLayer<T extends AreaLayerConfig = AreaLayerConfig> exte

protected annotation() {}

protected animation() {}
protected animation() {
const props = this.options;
if (props.animation === false) {
// 关闭动画
this.area.animate = false;
if (this.line) this.line.animate = false;
if (this.point) this.point.animate = false;
}
}

protected label() {
const props = this.options;
Expand Down
1 change: 1 addition & 0 deletions src/plots/line/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export default class LineLayer<T extends LineLayerConfig = LineLayerConfig> exte
if (props.animation === false) {
// 关闭动画
this.line.animate = false;
if (this.point) this.point.animate = false;
} else if (_.has(props, 'animation')) {
// 根据动画类型区分图形动画和群组动画
if (props.animation.type === 'clipingWithData') {
Expand Down
20 changes: 17 additions & 3 deletions src/plots/radar/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ export default class RadarLayer extends ViewLayer<RadarLayerConfig> {
});
}
public type: string = 'radar';
public line: any;
public point: any;
public area: any;
public baseElement: any;
public lineElement: any; // 保存line、area、point的配置项,用于后续的label、tooltip
public pointElement: any;
Expand Down Expand Up @@ -293,28 +296,39 @@ export default class RadarLayer extends ViewLayer<RadarLayerConfig> {
plot: this,
});
this.setConfig('element', area);
this.area = area;
}
/** 配置线 */
if (props.line.visible) {
if (props.line && props.line.visible) {
const line = getGeom('line', 'guide', {
plot: this,
});
this.setConfig('element', line);
this.line = line;
}
/** 配置点 */
if (props.point.visible) {
if (props.point && props.point.visible) {
const point = getGeom('point', 'guide', {
plot: this,
});
this.setConfig('element', point);
this.point = point;
}
}

protected label() {}

protected annotation() {}

protected animation() {}
protected animation() {
const props = this.options;
if (props.animation === false) {
// 关闭动画
if (this.area) this.area.animate = false;
if (this.line) this.line.animate = false;
if (this.point) this.point.animate = false;
}
}

protected parserEvents(eventParser) {
super.parserEvents(EventParser);
Expand Down

0 comments on commit c9a2ae5

Please sign in to comment.