Include center at right edge in calculations
This commit is contained in:
committed by
Andreas Hocevar
parent
660845f5b8
commit
e3ad05f805
@@ -415,7 +415,7 @@ export function toStringXY(coordinate, opt_fractionDigits) {
|
|||||||
*/
|
*/
|
||||||
export function wrapX(coordinate, projection) {
|
export function wrapX(coordinate, projection) {
|
||||||
const projectionExtent = projection.getExtent();
|
const projectionExtent = projection.getExtent();
|
||||||
if (projection.canWrapX() && (coordinate[0] < projectionExtent[0] || coordinate[0] > projectionExtent[2])) {
|
if (projection.canWrapX() && (coordinate[0] < projectionExtent[0] || coordinate[0] >= projectionExtent[2])) {
|
||||||
const worldWidth = getWidth(projectionExtent);
|
const worldWidth = getWidth(projectionExtent);
|
||||||
const worldsAway = Math.floor((coordinate[0] - projectionExtent[0]) / worldWidth);
|
const worldsAway = Math.floor((coordinate[0] - projectionExtent[0]) / worldWidth);
|
||||||
coordinate[0] -= (worldsAway * worldWidth);
|
coordinate[0] -= (worldsAway * worldWidth);
|
||||||
|
|||||||
Reference in New Issue
Block a user