forked from github/dataease
Merge pull request #10692 from dataease/pr@dev-v2@chart-symbolic-map-auto-zoom
fix(图表-符号地图): 修复符号地图未能根据数据自动缩放的问题
This commit is contained in:
commit
9a95293c5f
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user