Skip to content

Commit

Permalink
[fix]叠加多个动画图层 不显示
Browse files Browse the repository at this point in the history
  • Loading branch information
luoxiao-supermap committed May 9, 2024
1 parent 38962eb commit efce3fa
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/core/src/services/layer/LayerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class LayerService

private sceneInited: boolean = false;

private animateInstanceCount: number = 0;
private animateInstanceCount: object = {};

// TODO: 是否开启 shader 中的颜色拾取计算
private shaderPicking: boolean = true;
Expand Down Expand Up @@ -289,16 +289,19 @@ export default class LayerService
}

public startAnimate(id: any) {
if (this.animateInstanceCount++ === 0) {
this.animateInstanceCount[id] = this.animateInstanceCount[id] || 0
if (this.animateInstanceCount[id]++ === 0) {
console.log('startAnimate', id)
this.clock.start();
this.runRender(id);
}
}

public stopAnimate() {
if (--this.animateInstanceCount === 0) {
if (--this.animateInstanceCount[id] === 0) {
this.stopRender();
this.clock.stop();
delete this.animateInstanceCount[id];
}
}

Expand Down

0 comments on commit efce3fa

Please sign in to comment.