mirror of
https://github.com/dataease/dataease.git
synced 2026-05-17 06:50:45 +08:00
fix(图表): 修复地图、气泡地图重置默认缩放比例不正确的问题
This commit is contained in:
@@ -158,7 +158,10 @@ export class BubbleMap extends L7PlotChartView<ChoroplethOptions, Choropleth> {
|
||||
if (!areaId.startsWith('custom_')) {
|
||||
dotLayer.options = { ...dotLayer.options, tooltip }
|
||||
}
|
||||
this.configZoomButton(chart, view)
|
||||
// 完成地图渲染后配置缩放按钮,为了能够获取到默认的缩放比例
|
||||
view.on('loaded', () => {
|
||||
this.configZoomButton(chart, view)
|
||||
})
|
||||
mapRendering(container)
|
||||
view.once('loaded', () => {
|
||||
// 修改地图鼠标样式为默认
|
||||
|
||||
@@ -208,7 +208,10 @@ export class Map extends L7PlotChartView<ChoroplethOptions, Choropleth> {
|
||||
options = this.setupOptions(chart, options, context)
|
||||
const { Choropleth } = await import('@antv/l7plot/dist/esm/plots/choropleth')
|
||||
const view = new Choropleth(container, options)
|
||||
this.configZoomButton(chart, view)
|
||||
// 完成地图渲染后配置缩放按钮,为了能够获取到默认的缩放比例
|
||||
view.on('loaded', () => {
|
||||
this.configZoomButton(chart, view)
|
||||
})
|
||||
mapRendering(container)
|
||||
view.once('loaded', () => {
|
||||
mapRendered(container)
|
||||
|
||||
@@ -1180,9 +1180,15 @@ export function configL7Zoom(chart: Chart, plot: L7Plot<PlotOptions> | Scene) {
|
||||
return
|
||||
}
|
||||
if (!plotScene?.getControlByName('zoom')) {
|
||||
let initZoom = basicStyle.autoFit === false ? basicStyle.zoomLevel : 2.5
|
||||
let center = getCenter(basicStyle)
|
||||
if (['map', 'bubble-map'].includes(chart.type)) {
|
||||
initZoom = plotScene.getZoom()
|
||||
center = plotScene.getCenter()
|
||||
}
|
||||
const newZoomOptions = {
|
||||
initZoom: basicStyle.autoFit === false ? basicStyle.zoomLevel : 2.5,
|
||||
center: getCenter(basicStyle),
|
||||
initZoom: initZoom,
|
||||
center: center,
|
||||
buttonColor: basicStyle.zoomButtonColor,
|
||||
buttonBackground: basicStyle.zoomBackground
|
||||
} as any
|
||||
|
||||
Reference in New Issue
Block a user