diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts index 0b7d17e4dc..3d0b1cbb94 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts @@ -140,9 +140,32 @@ export class SymbolicMap extends L7ChartView { } }) }) + scene.once('loaded', () => { + this.autoZoom(symbolicLayer, scene) + }) return new L7Wrapper(scene, configList) } + /** + * 根据数据自动缩放大小及位置 + * @param symbolicLayer + * @param scene + */ + autoZoom = (symbolicLayer, scene) => { + const roamMap = flag => { + return flag ? scene.zoomIn() : scene.zoomOut() + } + const resetZoom = () => { + symbolicLayer.fitBounds() + } + symbolicLayer && resetZoom() + // 自动放大两级 + let index = 2 + while (index--) { + roamMap(true) + } + } + /** * 构建符号图层 * @param chart