Skip to content

Commit

Permalink
[fix]多坐标系跳动
Browse files Browse the repository at this point in the history
  • Loading branch information
luoxiao-supermap committed Jul 16, 2024
1 parent 3c01fc3 commit a4bd429
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions packages/layers/src/plugins/DataMappingPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit a4bd429

Please sign in to comment.