Skip to content

Commit 822e33b

Browse files
committed
fix ut
1 parent 556f975 commit 822e33b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/mapboxgl/core/Util.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* This program are made available under the terms of the Apache License, Version 2.0
33
* which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
44
import "../core/Base";
5+
import mapboxgl from 'mapbox-gl';
56
import { Bounds } from "@supermap/iclient-common/commontypes/Bounds";
67
import { Point as GeometryPoint } from "@supermap/iclient-common/commontypes/geometry/Point";
78
import { Polygon } from "@supermap/iclient-common/commontypes/geometry/Polygon";
@@ -54,7 +55,10 @@ export const Util = {
5455
//左下右上
5556
return new Bounds(bounds[0], bounds[1], bounds[2], bounds[3]);
5657
}
57-
return new Bounds(bounds.getWest(), bounds.getSouth(), bounds.getEast(), bounds.getNorth());
58+
if (bounds instanceof mapboxgl.LngLatBounds) {
59+
return new Bounds(bounds.getWest(), bounds.getSouth(), bounds.getEast(), bounds.getNorth());
60+
}
61+
return bounds;
5862
},
5963

6064
toSuperMapPoint(lnglat) {

src/maplibregl/core/Util.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* This program are made available under the terms of the Apache License, Version 2.0
33
* which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
44
// import "../core/Base";
5+
import maplibregl from 'maplibre-gl';
56
import { Bounds } from "@supermap/iclient-common/commontypes/Bounds";
67
import { Point as GeometryPoint } from "@supermap/iclient-common/commontypes/geometry/Point";
78
import { Polygon } from "@supermap/iclient-common/commontypes/geometry/Polygon";
@@ -54,7 +55,10 @@ export const Util = {
5455
//左下右上
5556
return new Bounds(bounds[0], bounds[1], bounds[2], bounds[3]);
5657
}
57-
return new Bounds(bounds.getWest(), bounds.getSouth(), bounds.getEast(), bounds.getNorth());
58+
if (bounds instanceof maplibregl.LngLatBounds) {
59+
return new Bounds(bounds.getWest(), bounds.getSouth(), bounds.getEast(), bounds.getNorth());
60+
}
61+
return bounds;
5862
},
5963

6064
toSuperMapPoint(lnglat) {

0 commit comments

Comments
 (0)