Avoid panning off the edge of the world
This commit is contained in:
@@ -1409,11 +1409,19 @@ function animationCallback(callback, returnValue) {
|
||||
*/
|
||||
export function createCenterConstraint(options) {
|
||||
if (options.extent !== undefined) {
|
||||
return createExtent(options.extent, options.constrainOnlyCenter,
|
||||
options.smoothExtentConstraint !== undefined ? options.smoothExtentConstraint : true);
|
||||
} else {
|
||||
return centerNone;
|
||||
const smooth = options.smoothExtentConstraint !== undefined ? options.smoothExtentConstraint : true;
|
||||
return createExtent(options.extent, options.constrainOnlyCenter, smooth);
|
||||
}
|
||||
|
||||
const projection = createProjection(options.projection, 'EPSG:3857');
|
||||
if (options.multiWorld !== true && projection.isGlobal()) {
|
||||
const extent = projection.getExtent().slice();
|
||||
extent[0] = -Infinity;
|
||||
extent[2] = Infinity;
|
||||
return createExtent(extent, false, false);
|
||||
}
|
||||
|
||||
return centerNone;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user