Renamed option to constrainOneAxis
This commit is contained in:
@@ -129,8 +129,9 @@ import {createMinMaxResolution} from './resolutionconstraint.js';
|
||||
* @property {boolean} [smoothResolutionConstraint=true] If true, the resolution
|
||||
* min/max values will be applied smoothly, i. e. allow the view to exceed slightly
|
||||
* the given resolution or zoom bounds.
|
||||
* @property {boolean} [largerResolutionConstraint=false] If true, the constrained
|
||||
* resolution values will use the larger value to do so.
|
||||
* @property {boolean} [constrainOneAxis=false] If true, the extent constraint can
|
||||
* be exceeded along one but not both axes, allowing the whole extent to be visible
|
||||
* on the map.
|
||||
* @property {import("./proj.js").ProjectionLike} [projection='EPSG:3857'] The
|
||||
* projection. The default is Spherical Mercator.
|
||||
* @property {number} [resolution] The initial resolution for the view. The
|
||||
@@ -1613,8 +1614,8 @@ export function createResolutionConstraint(options) {
|
||||
const smooth =
|
||||
options.smoothResolutionConstraint !== undefined ? options.smoothResolutionConstraint : true;
|
||||
|
||||
const larger =
|
||||
options.largerResolutionConstraint !== undefined ? options.largerResolutionConstraint : false;
|
||||
const oneAxis =
|
||||
options.constrainOneAxis !== undefined ? options.constrainOneAxis : false;
|
||||
|
||||
const projection = createProjection(options.projection, 'EPSG:3857');
|
||||
const projExtent = projection.getExtent();
|
||||
@@ -1633,10 +1634,10 @@ export function createResolutionConstraint(options) {
|
||||
|
||||
if (options.constrainResolution) {
|
||||
resolutionConstraint = createSnapToResolutions(resolutions, smooth,
|
||||
!constrainOnlyCenter && extent, larger);
|
||||
!constrainOnlyCenter && extent, oneAxis);
|
||||
} else {
|
||||
resolutionConstraint = createMinMaxResolution(maxResolution, minResolution, smooth,
|
||||
!constrainOnlyCenter && extent, larger);
|
||||
!constrainOnlyCenter && extent, oneAxis);
|
||||
}
|
||||
} else {
|
||||
// calculate the default min and max resolution
|
||||
@@ -1682,10 +1683,10 @@ export function createResolutionConstraint(options) {
|
||||
if (options.constrainResolution) {
|
||||
resolutionConstraint = createSnapToPower(
|
||||
zoomFactor, maxResolution, minResolution, smooth,
|
||||
!constrainOnlyCenter && extent, larger);
|
||||
!constrainOnlyCenter && extent, oneAxis);
|
||||
} else {
|
||||
resolutionConstraint = createMinMaxResolution(maxResolution, minResolution, smooth,
|
||||
!constrainOnlyCenter && extent, larger);
|
||||
!constrainOnlyCenter && extent, oneAxis);
|
||||
}
|
||||
}
|
||||
return {constraint: resolutionConstraint, maxResolution: maxResolution,
|
||||
|
||||
Reference in New Issue
Block a user