diff --git a/src/ol/View.js b/src/ol/View.js index 16091a3a04..d697dc66bc 100644 --- a/src/ol/View.js +++ b/src/ol/View.js @@ -665,16 +665,6 @@ class View extends BaseObject { return size; } - /** - * Get the constrained center of this view. - * @param {import("./coordinate.js").Coordinate|undefined} center Center. - * @return {import("./coordinate.js").Coordinate|undefined} Constrained center. - * @api - */ - constrainCenter(center) { - return this.constraints_.center(center); - } - /** * Get the constrained resolution of this view. * @param {number|undefined} resolution Resolution. diff --git a/src/ol/interaction/DragPan.js b/src/ol/interaction/DragPan.js index 80d9905562..020eb509ef 100644 --- a/src/ol/interaction/DragPan.js +++ b/src/ol/interaction/DragPan.js @@ -93,7 +93,6 @@ class DragPan extends PointerInteraction { scaleCoordinate(center, view.getResolution()); rotateCoordinate(center, view.getRotation()); addCoordinate(center, view.getCenter()); - center = view.constrainCenter(center); view.setCenter(center); } } else if (this.kinetic_) { @@ -122,7 +121,7 @@ class DragPan extends PointerInteraction { centerpx[1] - distance * Math.sin(angle) ]); view.animate({ - center: view.constrainCenter(dest), + center: dest, duration: 500, easing: easeOut }); diff --git a/src/ol/interaction/DragZoom.js b/src/ol/interaction/DragZoom.js index 406e9c8419..393db36660 100644 --- a/src/ol/interaction/DragZoom.js +++ b/src/ol/interaction/DragZoom.js @@ -83,8 +83,7 @@ function onBoxEnd() { const resolution = view.getResolutionForExtent(extent, size); const zoom = view.getValidZoomLevel(view.getZoomForResolution(resolution)); - let center = getCenter(extent); - center = view.constrainCenter(center); + const center = getCenter(extent); view.animate({ zoom: zoom, diff --git a/src/ol/interaction/Interaction.js b/src/ol/interaction/Interaction.js index 42ec35deb8..405e986891 100644 --- a/src/ol/interaction/Interaction.js +++ b/src/ol/interaction/Interaction.js @@ -111,8 +111,7 @@ class Interaction extends BaseObject { export function pan(view, delta, opt_duration) { const currentCenter = view.getCenter(); if (currentCenter) { - const center = view.constrainCenter( - [currentCenter[0] + delta[0], currentCenter[1] + delta[1]]); + const center = [currentCenter[0] + delta[0], currentCenter[1] + delta[1]]; if (opt_duration) { view.animate({ duration: opt_duration, @@ -209,8 +208,7 @@ export function zoomByDelta(view, delta, opt_anchor, opt_duration) { // the constraint to it, and then calculate back the anchor if (opt_anchor) { const currentCenter = view.getCenter(); - let center = view.calculateCenterZoom(newResolution, opt_anchor); - center = view.constrainCenter(center); + const center = view.calculateCenterZoom(newResolution, opt_anchor); opt_anchor = [ (newResolution * currentCenter[0] - currentResolution * center[0]) / diff --git a/src/ol/interaction/MouseWheelZoom.js b/src/ol/interaction/MouseWheelZoom.js index 24d29fd099..120d4e42c0 100644 --- a/src/ol/interaction/MouseWheelZoom.js +++ b/src/ol/interaction/MouseWheelZoom.js @@ -234,7 +234,7 @@ class MouseWheelZoom extends Interaction { } if (this.lastAnchor_) { const center = view.calculateCenterZoom(resolution, this.lastAnchor_); - view.setCenter(view.constrainCenter(center)); + view.setCenter(center); } view.setResolution(resolution);