fix(图表): 世界地图标签未显示 #9890
This commit is contained in:
parent
3996eebb89
commit
977519d7d8
@ -21,6 +21,7 @@
|
||||
"@codemirror/lang-sql": "^6.4.0",
|
||||
"@npkg/tinymce-plugins": "^0.0.7",
|
||||
"@tinymce/tinymce-vue": "^5.1.0",
|
||||
"@turf/centroid": "^7.0.0",
|
||||
"@videojs-player/vue": "^1.0.0",
|
||||
"@vueuse/core": "^9.13.0",
|
||||
"ace-builds": "^1.15.3",
|
||||
|
||||
@ -28,6 +28,7 @@ import { DOM } from '@antv/l7-utils'
|
||||
import { Scene } from '@antv/l7-scene'
|
||||
import { type IZoomControlOption } from '@antv/l7-component'
|
||||
import { PositionType } from '@antv/l7-core'
|
||||
import { centroid } from '@turf/centroid'
|
||||
|
||||
export function getPadding(chart: Chart): number[] {
|
||||
if (chart.drill) {
|
||||
@ -890,8 +891,13 @@ export function configL7Tooltip(chart: Chart): TooltipOptions {
|
||||
|
||||
export function handleGeoJson(geoJson: FeatureCollection, nameMapping?: Record<string, string>) {
|
||||
geoJson.features.forEach(item => {
|
||||
if (!item.properties['centroid'] && item.properties['center']) {
|
||||
item.properties['centroid'] = item.properties['center']
|
||||
if (!item.properties['centroid']) {
|
||||
if (item.properties['center']) {
|
||||
item.properties['centroid'] = item.properties['center']
|
||||
} else {
|
||||
const tmp = centroid(item.geometry)
|
||||
item.properties['centroid'] = tmp.geometry.coordinates
|
||||
}
|
||||
}
|
||||
let name = item.properties['name']
|
||||
if (nameMapping?.[name]) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user