From 33f380e0149375c9d6f8e5cf718afb783dda28c4 Mon Sep 17 00:00:00 2001 From: luoxiao Date: Wed, 17 Apr 2024 14:44:03 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=E7=82=B9=E5=92=8C=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=A0=87=E7=AD=BE<12=E7=BA=A7=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/layers/src/plugins/DataMappingPlugin.ts | 3 ++- packages/layers/src/point/models/text.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/layers/src/plugins/DataMappingPlugin.ts b/packages/layers/src/plugins/DataMappingPlugin.ts index 39f38825d7b..4257024b826 100644 --- a/packages/layers/src/plugins/DataMappingPlugin.ts +++ b/packages/layers/src/plugins/DataMappingPlugin.ts @@ -221,8 +221,9 @@ this.adjustData2MapboxCoordinates(mappedData); this.mapService.version === Version['MAPBOX'] ) { mappedData.map((d) => { + d.version = Version['MAPBOX']; // @ts-ignore - d.originCoordinates = cloneDeep(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据) + d.originCoordinates = cloneDeep(d.coordinates); // @ts-ignore d.coordinates = this.getMapboxCoordiantes(d.coordinates); }); diff --git a/packages/layers/src/point/models/text.ts b/packages/layers/src/point/models/text.ts index c1822859cd8..fccdddf009f 100644 --- a/packages/layers/src/point/models/text.ts +++ b/packages/layers/src/point/models/text.ts @@ -424,7 +424,7 @@ export default class TextModel extends BaseModel { // 此时地图高德2.0 originCentroid == centroid feature.originCentroid = - feature.version === 'GAODE2.x' + (feature.version === 'GAODE2.x' || feature.version === 'MAPBOX') ? calculateCentroid(feature.originCoordinates) : (feature.originCentroid = feature.centroid); @@ -470,7 +470,7 @@ export default class TextModel extends BaseModel { // const centroid = feature.centroid as [number, number]; // const centroid = feature.originCentroid as [number, number]; const centroid = ( - feature.version === 'GAODE2.x' + (feature.version === 'GAODE2.x' || feature.version === 'MAPBOX') ? feature.originCentroid : feature.centroid ) as [number, number];