mirror of https://gitee.com/antv-l7/antv-l7
Merge branch 'master' of https://github.com/antvis/L7
This commit is contained in:
commit
ed565d8026
|
@ -193,7 +193,7 @@ export interface IEarthService<RawMap = {}> {
|
|||
): void;
|
||||
}
|
||||
|
||||
export const MapServiceEvent = ['mapload', 'mapchange'];
|
||||
export const MapServiceEvent = ['mapload', 'mapchange', 'mapAfterFrameChange'];
|
||||
|
||||
/**
|
||||
* 地图初始化配置项
|
||||
|
|
|
@ -299,6 +299,14 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
|
|||
TYPES.IPickingService,
|
||||
);
|
||||
this.mapService = this.container.get<IMapService>(TYPES.IMapService);
|
||||
const { enableMultiPassRenderer, passes } = this.getLayerConfig();
|
||||
if (enableMultiPassRenderer && passes?.length && passes.length > 0) {
|
||||
// Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom
|
||||
this.mapService.on('mapAfterFrameChange', () => {
|
||||
this.renderLayers();
|
||||
});
|
||||
}
|
||||
|
||||
this.cameraService = this.container.get<ICameraService>(
|
||||
TYPES.ICameraService,
|
||||
);
|
||||
|
|
|
@ -371,11 +371,11 @@ export default class AMapService
|
|||
// @ts-ignore
|
||||
const map = new AMap.Map(this.$mapContainer, mapConstructorOptions);
|
||||
// 监听地图相机事件
|
||||
// map.on('camerachange', this.handleCameraChanged);
|
||||
map.on('camerachange', this.handleCameraChanged);
|
||||
// Tip: 为了兼容开启 MultiPassRender 的情况
|
||||
// 修复 MultiPassRender 在高德地图 1.x 的情况下,缩放地图改变 zoom 时存在可视化层和底图不同步的现象
|
||||
map.on('camerachange', (e) => {
|
||||
setTimeout(() => this.handleCameraChanged(e));
|
||||
map.on('camerachange', () => {
|
||||
setTimeout(() => this.handleAfterMapChange());
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
|
@ -476,6 +476,10 @@ export default class AMapService
|
|||
this.cameraChangedCallback = callback;
|
||||
}
|
||||
|
||||
private handleAfterMapChange() {
|
||||
this.emit('mapAfterFrameChange');
|
||||
}
|
||||
|
||||
private handleCameraChanged = (e: IAMapEvent): void => {
|
||||
const {
|
||||
fov,
|
||||
|
|
Loading…
Reference in New Issue