New wrapX functions for coordinate and extent
This commit is contained in:
@@ -9,6 +9,7 @@ import {inView} from '../layer/Layer.js';
|
||||
import {shared as iconImageCache} from '../style/IconImageCache.js';
|
||||
import {compose as composeTransform, makeInverse} from '../transform.js';
|
||||
import {renderDeclutterItems} from '../render.js';
|
||||
import {wrapX} from '../coordinate.js';
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
@@ -102,19 +103,12 @@ class MapRenderer extends Disposable {
|
||||
|
||||
const projection = viewState.projection;
|
||||
|
||||
let translatedCoordinate = coordinate;
|
||||
const translatedCoordinate = wrapX(coordinate.slice(), projection);
|
||||
const offsets = [[0, 0]];
|
||||
if (projection.canWrapX()) {
|
||||
if (projection.canWrapX() && checkWrapped) {
|
||||
const projectionExtent = projection.getExtent();
|
||||
const worldWidth = getWidth(projectionExtent);
|
||||
const x = coordinate[0];
|
||||
if (x < projectionExtent[0] || x > projectionExtent[2]) {
|
||||
const worldsAway = Math.ceil((projectionExtent[0] - x) / worldWidth);
|
||||
translatedCoordinate = [x + worldWidth * worldsAway, coordinate[1]];
|
||||
}
|
||||
if (checkWrapped) {
|
||||
offsets.push([-worldWidth, 0], [worldWidth, 0]);
|
||||
}
|
||||
offsets.push([-worldWidth, 0], [worldWidth, 0]);
|
||||
}
|
||||
|
||||
const layerStates = frameState.layerStatesArray;
|
||||
|
||||
Reference in New Issue
Block a user