From abe5698ed8a5e6e8a253f587276b66e5813b232a Mon Sep 17 00:00:00 2001 From: 2912401452 <2912401452@qq.com> Date: Wed, 15 Sep 2021 18:14:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=8A=A8?= =?UTF-8?q?=E7=94=BB=E6=A8=A1=E5=BC=8F=E4=B8=8B=E7=9A=84=E6=B8=B2=E6=9F=93?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/services/layer/LayerService.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/core/src/services/layer/LayerService.ts b/packages/core/src/services/layer/LayerService.ts index 61cb8b8b1e..77e0fd05b4 100644 --- a/packages/core/src/services/layer/LayerService.ts +++ b/packages/core/src/services/layer/LayerService.ts @@ -134,20 +134,29 @@ export default class LayerService implements ILayerService { switch (renderType) { case 'picking': // TODO: picking 类型的渲染事件 - // 若是上次触发为地图触发的渲染,则认为是地图事件与拾取事件在同时触发,放弃此次渲染 - if (this.lastRenderType === 'mapRender') { + // 若是上次触发为地图或动画触发的渲染,则认为是地图事件与拾取事件在同时触发,放弃此次渲染 + if (this.lastRenderType === 'mapRender' || this.lastRenderType === 'animate') { this.lastRenderType = 'picking'; return false; } else { this.lastRenderType = 'picking'; return true; } + case 'animate': + if (this.lastRenderType === 'mapRender') { + this.lastRenderType = 'animate'; + return false; + } else { + this.lastRenderType = 'animate'; + return true; + } case 'mapRender': this.lastRenderType = 'mapRender'; return true; default: return true; } + // TODO: 地图触发的渲染优先级最高,动画其次,拾取最次 } return true; } @@ -162,7 +171,7 @@ export default class LayerService implements ILayerService { } private runRender() { - this.renderLayers(); + this.renderLayers('animate'); this.layerRenderID = requestAnimationFrame(this.runRender.bind(this)); } From 545f9c2cc1371cc7742ef6f532d5b74239ba47a6 Mon Sep 17 00:00:00 2001 From: 2912401452 <2912401452@qq.com> Date: Wed, 15 Sep 2021 18:55:17 +0800 Subject: [PATCH 2/2] style: lint style --- .../core/src/services/layer/LayerService.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/core/src/services/layer/LayerService.ts b/packages/core/src/services/layer/LayerService.ts index 77e0fd05b4..b5ee8a15c9 100644 --- a/packages/core/src/services/layer/LayerService.ts +++ b/packages/core/src/services/layer/LayerService.ts @@ -135,7 +135,10 @@ export default class LayerService implements ILayerService { case 'picking': // TODO: picking 类型的渲染事件 // 若是上次触发为地图或动画触发的渲染,则认为是地图事件与拾取事件在同时触发,放弃此次渲染 - if (this.lastRenderType === 'mapRender' || this.lastRenderType === 'animate') { + if ( + this.lastRenderType === 'mapRender' || + this.lastRenderType === 'animate' + ) { this.lastRenderType = 'picking'; return false; } else { @@ -143,13 +146,13 @@ export default class LayerService implements ILayerService { return true; } case 'animate': - if (this.lastRenderType === 'mapRender') { - this.lastRenderType = 'animate'; - return false; - } else { - this.lastRenderType = 'animate'; - return true; - } + if (this.lastRenderType === 'mapRender') { + this.lastRenderType = 'animate'; + return false; + } else { + this.lastRenderType = 'animate'; + return true; + } case 'mapRender': this.lastRenderType = 'mapRender'; return true;