Separate internal and API methods for the view
This commit is contained in:
@@ -92,7 +92,7 @@ class DragPan extends PointerInteraction {
|
||||
const view = map.getView();
|
||||
scaleCoordinate(delta, view.getResolution());
|
||||
rotateCoordinate(delta, view.getRotation());
|
||||
view.adjustCenter(delta);
|
||||
view.adjustCenterInternal(delta);
|
||||
}
|
||||
} else if (this.kinetic_) {
|
||||
// reset so we don't overestimate the kinetic energy after
|
||||
@@ -113,13 +113,13 @@ class DragPan extends PointerInteraction {
|
||||
if (!this.noKinetic_ && this.kinetic_ && this.kinetic_.end()) {
|
||||
const distance = this.kinetic_.getDistance();
|
||||
const angle = this.kinetic_.getAngle();
|
||||
const center = /** @type {!import("../coordinate.js").Coordinate} */ (view.getCenter());
|
||||
const center = view.getCenterInternal();
|
||||
const centerpx = map.getPixelFromCoordinate(center);
|
||||
const dest = map.getCoordinateFromPixel([
|
||||
centerpx[0] - distance * Math.cos(angle),
|
||||
centerpx[1] - distance * Math.sin(angle)
|
||||
]);
|
||||
view.animate({
|
||||
view.animateInternal({
|
||||
center: view.getConstrainedCenter(dest),
|
||||
duration: 500,
|
||||
easing: easeOut
|
||||
|
||||
@@ -78,7 +78,7 @@ class DragRotate extends PointerInteraction {
|
||||
Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2);
|
||||
if (this.lastAngle_ !== undefined) {
|
||||
const delta = theta - this.lastAngle_;
|
||||
view.adjustRotation(-delta);
|
||||
view.adjustRotationInternal(-delta);
|
||||
}
|
||||
this.lastAngle_ = theta;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ class DragRotateAndZoom extends PointerInteraction {
|
||||
const view = map.getView();
|
||||
if (this.lastAngle_ !== undefined) {
|
||||
const angleDelta = this.lastAngle_ - theta;
|
||||
view.adjustRotation(angleDelta);
|
||||
view.adjustRotationInternal(angleDelta);
|
||||
}
|
||||
this.lastAngle_ = theta;
|
||||
if (this.lastMagnitude_ !== undefined) {
|
||||
|
||||
@@ -73,20 +73,20 @@ function onBoxEnd() {
|
||||
let extent = this.getGeometry().getExtent();
|
||||
|
||||
if (this.out_) {
|
||||
const mapExtent = view.calculateExtent(size);
|
||||
const mapExtent = view.calculateExtentInternal(size);
|
||||
const boxPixelExtent = createOrUpdateFromCoordinates([
|
||||
map.getPixelFromCoordinate(getBottomLeft(extent)),
|
||||
map.getPixelFromCoordinate(getTopRight(extent))]);
|
||||
const factor = view.getResolutionForExtent(boxPixelExtent, size);
|
||||
const factor = view.getResolutionForExtentInternal(boxPixelExtent, size);
|
||||
|
||||
scaleFromCenter(mapExtent, 1 / factor);
|
||||
extent = mapExtent;
|
||||
}
|
||||
|
||||
const resolution = view.getConstrainedResolution(view.getResolutionForExtent(extent, size));
|
||||
const resolution = view.getConstrainedResolution(view.getResolutionForExtentInternal(extent, size));
|
||||
const center = view.getConstrainedCenter(getCenter(extent), resolution);
|
||||
|
||||
view.animate({
|
||||
view.animateInternal({
|
||||
resolution: resolution,
|
||||
center: center,
|
||||
duration: this.duration_,
|
||||
|
||||
@@ -108,10 +108,10 @@ class Interaction extends BaseObject {
|
||||
* @param {number=} opt_duration Duration.
|
||||
*/
|
||||
export function pan(view, delta, opt_duration) {
|
||||
const currentCenter = view.getCenter();
|
||||
const currentCenter = view.getCenterInternal();
|
||||
if (currentCenter) {
|
||||
const center = [currentCenter[0] + delta[0], currentCenter[1] + delta[1]];
|
||||
view.animate_({
|
||||
view.animateInternal({
|
||||
duration: opt_duration !== undefined ? opt_duration : 250,
|
||||
easing: linear,
|
||||
center: view.getConstrainedCenter(center)
|
||||
@@ -138,7 +138,7 @@ export function zoomByDelta(view, delta, opt_anchor, opt_duration) {
|
||||
if (view.getAnimating()) {
|
||||
view.cancelAnimations();
|
||||
}
|
||||
view.animate({
|
||||
view.animateInternal({
|
||||
resolution: newResolution,
|
||||
anchor: opt_anchor,
|
||||
duration: opt_duration !== undefined ? opt_duration : 250,
|
||||
|
||||
@@ -117,7 +117,7 @@ class PinchRotate extends PointerInteraction {
|
||||
// rotate
|
||||
if (this.rotating_) {
|
||||
map.render();
|
||||
view.adjustRotation(rotationDelta, this.anchor_);
|
||||
view.adjustRotationInternal(rotationDelta, this.anchor_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user