Merge pull request #769 from antvis/shihui_dev

Shihui dev
This commit is contained in:
YiQianYao 2021-09-15 18:59:43 +08:00 committed by GitHub
commit 15896ffb1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 3 deletions

View File

@ -134,20 +134,32 @@ 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 +174,7 @@ export default class LayerService implements ILayerService {
}
private runRender() {
this.renderLayers();
this.renderLayers('animate');
this.layerRenderID = requestAnimationFrame(this.runRender.bind(this));
}