From a4bd429c2d76551fc0432b8049cad12d79566326 Mon Sep 17 00:00:00 2001 From: luoxiao Date: Tue, 16 Jul 2024 15:56:00 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=E5=A4=9A=E5=9D=90=E6=A0=87=E7=B3=BB?= =?UTF-8?q?=E8=B7=B3=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layers/src/plugins/DataMappingPlugin.ts | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/packages/layers/src/plugins/DataMappingPlugin.ts b/packages/layers/src/plugins/DataMappingPlugin.ts index a5c8524d60..8b89fb6366 100644 --- a/packages/layers/src/plugins/DataMappingPlugin.ts +++ b/packages/layers/src/plugins/DataMappingPlugin.ts @@ -203,6 +203,13 @@ export default class DataMappingPlugin implements ILayerPlugin { // 调整数据兼容 SimpleCoordinates this.adjustData2SimpleCoordinates(mappedData); + if ( + this.coordinateSystemService.getCoordinateSystem() !== + CoordinateSystem.METER_OFFSET + ) { + this.coordinateSystemService.offsetCenter = null; + this.coordinateSystemService.offsetCenterTransform = null + } if ( this.coordinateSystemService.getCoordinateSystem() === CoordinateSystem.LNGLAT @@ -215,11 +222,15 @@ export default class DataMappingPlugin implements ILayerPlugin { const map = this.mapService.map as Map; const { lng, lat } = map.getCenter(); const center = transformOffset([lng, lat], map, 512); - this.coordinateSystemService.offsetCenter = [lng, lat]; - this.coordinateSystemService.offsetCenterTransform = [ - center[0], - center[1], - ]; + if (!this.coordinateSystemService.offsetCenter) { + this.coordinateSystemService.offsetCenter = [lng, lat]; + } + if (!this.coordinateSystemService.offsetCenterTransform) { + this.coordinateSystemService.offsetCenterTransform = [ + center[0], + center[1], + ]; + } this.adjustData2MapboxCoordinates(mappedData); } return mappedData;