diff --git a/src/ol/View.js b/src/ol/View.js index ebb4e78395..16091a3a04 100644 --- a/src/ol/View.js +++ b/src/ol/View.js @@ -681,7 +681,7 @@ class View extends BaseObject { * @param {number=} opt_delta Delta. Default is `0`. * @param {number=} opt_direction Direction. Default is `0`. * @return {number|undefined} Constrained resolution. - * @api + * @private */ constrainResolution(resolution, opt_delta, opt_direction) { const delta = opt_delta || 0; @@ -689,18 +689,6 @@ class View extends BaseObject { return this.constraints_.resolution(resolution, delta, direction); } - /** - * Get the constrained rotation of this view. - * @param {number|undefined} rotation Rotation. - * @param {number=} opt_delta Delta. Default is `0`. - * @return {number|undefined} Constrained rotation. - * @api - */ - constrainRotation(rotation, opt_delta) { - const delta = opt_delta || 0; - return this.constraints_.rotation(rotation, delta); - } - /** * Get the view center. * @return {import("./coordinate.js").Coordinate|undefined} The center of the view. diff --git a/src/ol/interaction/DragRotate.js b/src/ol/interaction/DragRotate.js index bc10813b08..09143c0d79 100644 --- a/src/ol/interaction/DragRotate.js +++ b/src/ol/interaction/DragRotate.js @@ -5,7 +5,7 @@ import {disable} from '../rotationconstraint.js'; import ViewHint from '../ViewHint.js'; import {altShiftKeysOnly, mouseOnly, mouseActionButton} from '../events/condition.js'; import {FALSE} from '../functions.js'; -import {rotate, rotateWithoutConstraints} from './Interaction.js'; +import {rotate} from './Interaction.js'; import PointerInteraction from './Pointer.js'; @@ -81,7 +81,7 @@ class DragRotate extends PointerInteraction { if (this.lastAngle_ !== undefined) { const delta = theta - this.lastAngle_; const rotation = view.getRotation(); - rotateWithoutConstraints(view, rotation - delta); + rotate(view, rotation - delta); } this.lastAngle_ = theta; } diff --git a/src/ol/interaction/DragRotateAndZoom.js b/src/ol/interaction/DragRotateAndZoom.js index 5225d73001..0bd024ed67 100644 --- a/src/ol/interaction/DragRotateAndZoom.js +++ b/src/ol/interaction/DragRotateAndZoom.js @@ -4,7 +4,7 @@ import {disable} from '../rotationconstraint.js'; import ViewHint from '../ViewHint.js'; import {shiftKeyOnly, mouseOnly} from '../events/condition.js'; -import {rotate, rotateWithoutConstraints, zoom} from './Interaction.js'; +import {rotate, zoom} from './Interaction.js'; import PointerInteraction from './Pointer.js'; @@ -90,7 +90,7 @@ class DragRotateAndZoom extends PointerInteraction { const view = map.getView(); if (view.getConstraints().rotation !== disable && this.lastAngle_ !== undefined) { const angleDelta = theta - this.lastAngle_; - rotateWithoutConstraints(view, view.getRotation() - angleDelta); + rotate(view, view.getRotation() - angleDelta); } this.lastAngle_ = theta; if (this.lastMagnitude_ !== undefined) { diff --git a/src/ol/interaction/Interaction.js b/src/ol/interaction/Interaction.js index 9a7b817525..42ec35deb8 100644 --- a/src/ol/interaction/Interaction.js +++ b/src/ol/interaction/Interaction.js @@ -133,18 +133,6 @@ export function pan(view, delta, opt_duration) { * @param {number=} opt_duration Duration. */ export function rotate(view, rotation, opt_anchor, opt_duration) { - rotation = view.constrainRotation(rotation, 0); - rotateWithoutConstraints(view, rotation, opt_anchor, opt_duration); -} - - -/** - * @param {import("../View.js").default} view View. - * @param {number|undefined} rotation Rotation. - * @param {import("../coordinate.js").Coordinate=} opt_anchor Anchor coordinate. - * @param {number=} opt_duration Duration. - */ -export function rotateWithoutConstraints(view, rotation, opt_anchor, opt_duration) { if (rotation !== undefined) { const currentRotation = view.getRotation(); const currentCenter = view.getCenter(); diff --git a/src/ol/interaction/PinchRotate.js b/src/ol/interaction/PinchRotate.js index 6ea8de2ebe..fc40d7f851 100644 --- a/src/ol/interaction/PinchRotate.js +++ b/src/ol/interaction/PinchRotate.js @@ -3,7 +3,7 @@ */ import ViewHint from '../ViewHint.js'; import {FALSE} from '../functions.js'; -import {rotate, rotateWithoutConstraints} from './Interaction.js'; +import {rotate} from './Interaction.js'; import PointerInteraction, {centroid as centroidFromPointers} from './Pointer.js'; import {disable} from '../rotationconstraint.js'; @@ -120,7 +120,7 @@ class PinchRotate extends PointerInteraction { if (this.rotating_) { const rotation = view.getRotation(); map.render(); - rotateWithoutConstraints(view, rotation + rotationDelta, this.anchor_); + rotate(view, rotation + rotationDelta, this.anchor_); } }