Merge pull request #10692 from dataease/pr@dev-v2@chart-symbolic-map-auto-zoom

fix(图表-符号地图): 修复符号地图未能根据数据自动缩放的问题
This commit is contained in:
jianneng-fit2cloud 2024-07-02 11:46:16 +08:00 committed by GitHub
commit 9a95293c5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -140,9 +140,32 @@ export class SymbolicMap extends L7ChartView<Scene, L7Config> {
}
})
})
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