check projection can wrap before getting width
This commit is contained in:
@@ -410,10 +410,12 @@ export function toStringXY(coordinate, opt_fractionDigits) {
|
|||||||
* @return {Coordinate} The coordinate within the real world extent.
|
* @return {Coordinate} The coordinate within the real world extent.
|
||||||
*/
|
*/
|
||||||
export function wrapX(coordinate, projection) {
|
export function wrapX(coordinate, projection) {
|
||||||
const worldWidth = getWidth(projection.getExtent());
|
if (projection.canWrapX()) {
|
||||||
const worldsAway = getWorldsAway(coordinate, projection, worldWidth);
|
const worldWidth = getWidth(projection.getExtent());
|
||||||
if (worldsAway) {
|
const worldsAway = getWorldsAway(coordinate, projection, worldWidth);
|
||||||
coordinate[0] -= worldsAway * worldWidth;
|
if (worldsAway) {
|
||||||
|
coordinate[0] -= worldsAway * worldWidth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return coordinate;
|
return coordinate;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user