From 900d38dd5de18f1a82db0c92465ca59e36ba1d29 Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Tue, 2 Jul 2024 11:45:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8-=E7=AC=A6=E5=8F=B7?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE):=20=E4=BF=AE=E5=A4=8D=E7=AC=A6=E5=8F=B7?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E6=9C=AA=E8=83=BD=E6=A0=B9=E6=8D=AE=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=87=AA=E5=8A=A8=E7=BC=A9=E6=94=BE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/panel/charts/map/symbolic-map.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) 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