Skip to content

Commit 8527ff9

Browse files
[fix]修复动画图层显隐问题l7
1 parent 01b4dde commit 8527ff9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/mapboxgl/overlay/L7Layer.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ export class L7Layer {
5353

5454
setVisibility(visibility) {
5555
if (this.animateStatus) {
56-
this.scene.layerService.stopAnimate(this.l7layer.id);
56+
this.scene.layerService.stopAnimate();
57+
this.animateStatus = false;
5758
}
5859
visibility ? this.l7layer.show() : this.l7layer.hide();
59-
this.map.style.setLayoutProperty(this.id, 'visibility', visibility ? 'visible' : 'none');
60+
this.map.style.setLayoutProperty(this.id, 'visibility', visibility?'visible':'none');
6061
}
6162
addSceneLayer(scene) {
6263
this.scene = scene;
@@ -79,14 +80,16 @@ export class L7Layer {
7980
this.scene && this.scene.removeLayer(this.l7layer);
8081
}
8182
onRemove() {
82-
this.scene && this.scene.layerService.stopAnimate(this.l7layer.id);
83+
this.scene && this.scene.layerService.stopAnimate();
8384
this.scene && this.scene.removeLayer(this.l7layer);
8485
}
8586

8687
render() {
8788
if (this.scene && this.scene.getLayer(this.l7layer.id)) {
8889
if (this.l7layer.animateStatus || (this.l7layer.layerModel && this.l7layer.layerModel.spriteAnimate)) {
89-
this.scene.layerService.startAnimate(this.l7layer.id);
90+
if (!this.animateStatus) {
91+
this.scene.layerService.startAnimate();
92+
}
9093
this.animateStatus = true;
9194
this.map.triggerRepaint();
9295
} else {

0 commit comments

Comments
 (0)