Merge pull request #520 from elemoine/view2d

The view does not know about the map
This commit is contained in:
Éric Lemoine
2013-04-10 05:12:36 -07:00
11 changed files with 278 additions and 198 deletions

View File

@@ -6,8 +6,10 @@ goog.require('goog.dom');
goog.require('goog.dom.TagName');
goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('ol.animation');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.easing');
/**
@@ -74,8 +76,17 @@ ol.control.Zoom.prototype.handleIn_ = function(browserEvent) {
var map = this.getMap();
map.requestRenderFrame();
// FIXME works for View2D only
map.getView().zoomByDelta(map, this.delta_, undefined,
ol.control.ZOOM_DURATION);
var view = map.getView().getView2D();
var currentResolution = view.getResolution();
if (goog.isDef(currentResolution)) {
map.addPreRenderFunction(ol.animation.zoom({
resolution: currentResolution,
duration: ol.control.ZOOM_DURATION,
easing: ol.easing.easeOut
}));
}
var resolution = view.constrainResolution(currentResolution, this.delta_);
view.setResolution(resolution);
};
@@ -87,8 +98,16 @@ ol.control.Zoom.prototype.handleOut_ = function(browserEvent) {
// prevent #zoomOut anchor from getting appended to the url
browserEvent.preventDefault();
var map = this.getMap();
map.requestRenderFrame();
// FIXME works for View2D only
map.getView().zoomByDelta(map, -this.delta_, undefined,
ol.control.ZOOM_DURATION);
var view = map.getView().getView2D();
var currentResolution = view.getResolution();
if (goog.isDef(currentResolution)) {
map.addPreRenderFunction(ol.animation.zoom({
resolution: currentResolution,
duration: ol.control.ZOOM_DURATION,
easing: ol.easing.easeOut
}));
}
var resolution = view.constrainResolution(currentResolution, -this.delta_);
view.setResolution(resolution);
};

View File

@@ -5,7 +5,6 @@ goog.provide('ol.interaction.DblClickZoom');
goog.require('goog.asserts');
goog.require('ol.MapBrowserEvent');
goog.require('ol.MapBrowserEvent.EventType');
goog.require('ol.View2D');
goog.require('ol.interaction.Interaction');
@@ -46,9 +45,8 @@ ol.interaction.DblClickZoom.prototype.handleMapBrowserEvent =
var delta = mapBrowserEvent.browserEvent.shiftKey ?
-this.delta_ : this.delta_;
// FIXME works for View2D only
var view = map.getView();
goog.asserts.assertInstanceof(view, ol.View2D);
view.zoomByDelta(map, delta, anchor,
var view = map.getView().getView2D();
ol.interaction.Interaction.zoomByDelta(map, view, delta, anchor,
ol.interaction.DBLCLICKZOOM_ANIMATION_DURATION);
mapBrowserEvent.preventDefault();
browserEvent.preventDefault();

View File

@@ -4,9 +4,9 @@ goog.provide('ol.interaction.DragRotateAndZoom');
goog.require('goog.asserts');
goog.require('goog.math.Vec2');
goog.require('ol.View2D');
goog.require('ol.interaction.ConditionType');
goog.require('ol.interaction.Drag');
goog.require('ol.interaction.Interaction');
@@ -55,19 +55,19 @@ ol.interaction.DragRotateAndZoom.prototype.handleDrag =
var theta = Math.atan2(delta.y, delta.x);
var magnitude = delta.magnitude();
// FIXME works for View2D only
var view = map.getView();
goog.asserts.assertInstanceof(view, ol.View2D);
var view = map.getView().getView2D();
map.requestRenderFrame();
// FIXME the calls to map.rotate and map.zoomToResolution should use
// map.withFrozenRendering but an assertion fails :-(
if (goog.isDef(this.lastAngle_)) {
var angleDelta = theta - this.lastAngle_;
view.rotate(map, view.getRotation() - angleDelta);
ol.interaction.Interaction.rotate(
map, view, view.getRotation() - angleDelta);
}
this.lastAngle_ = theta;
if (goog.isDef(this.lastMagnitude_)) {
var resolution = this.lastMagnitude_ * (view.getResolution() / magnitude);
view.zoom(map, resolution);
ol.interaction.Interaction.zoom(map, view, resolution);
}
this.lastMagnitude_ = magnitude;
};

View File

@@ -5,6 +5,7 @@ goog.require('ol.View2D');
goog.require('ol.ViewHint');
goog.require('ol.interaction.ConditionType');
goog.require('ol.interaction.Drag');
goog.require('ol.interaction.Interaction');
/**
@@ -54,7 +55,8 @@ ol.interaction.DragRotate.prototype.handleDrag = function(mapBrowserEvent) {
// FIXME supports View2D only
goog.asserts.assertInstanceof(view, ol.View2D);
map.requestRenderFrame();
view.rotateWithoutConstraints(map, view.getRotation() - delta);
ol.interaction.Interaction.rotateWithoutConstraints(
map, view, view.getRotation() - delta);
}
this.lastAngle_ = theta;
};
@@ -69,7 +71,7 @@ ol.interaction.DragRotate.prototype.handleDragEnd = function(mapBrowserEvent) {
// FIXME supports View2D only
var view = map.getView();
goog.asserts.assertInstanceof(view, ol.View2D);
view.rotate(map, view.getRotation(), undefined,
ol.interaction.Interaction.rotate(map, view, view.getRotation(), undefined,
ol.interaction.DRAGROTATE_ANIMATION_DURATION);
view.setHint(ol.ViewHint.INTERACTING, -1);
};

View File

@@ -3,6 +3,8 @@
goog.provide('ol.interaction.Interaction');
goog.require('ol.MapBrowserEvent');
goog.require('ol.animation');
goog.require('ol.easing');
@@ -18,3 +20,162 @@ ol.interaction.Interaction = function() {
*/
ol.interaction.Interaction.prototype.handleMapBrowserEvent =
goog.abstractMethod;
/**
* @param {ol.Map} map Map.
* @param {ol.View2D} view View.
* @param {ol.Coordinate} delta Delta.
* @param {number=} opt_duration Duration.
*/
ol.interaction.Interaction.pan = function(
map, view, delta, opt_duration) {
var currentCenter = view.getCenter();
if (goog.isDef(currentCenter)) {
if (goog.isDef(opt_duration)) {
map.requestRenderFrame();
map.addPreRenderFunction(ol.animation.pan({
source: currentCenter,
duration: opt_duration,
easing: ol.easing.linear
}));
}
view.setCenter([currentCenter[0] + delta[0], currentCenter[1] + delta[1]]);
}
};
/**
* @param {ol.Map} map Map.
* @param {ol.View2D} view View.
* @param {number|undefined} rotation Rotation.
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
ol.interaction.Interaction.rotate =
function(map, view, rotation, opt_anchor, opt_duration) {
rotation = view.constrainRotation(rotation, 0);
ol.interaction.Interaction.rotateWithoutConstraints(
map, view, rotation, opt_anchor, opt_duration);
};
/**
* @param {ol.Map} map Map.
* @param {ol.View2D} view View.
* @param {number|undefined} rotation Rotation.
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
ol.interaction.Interaction.rotateWithoutConstraints =
function(map, view, rotation, opt_anchor, opt_duration) {
if (goog.isDefAndNotNull(rotation)) {
var currentRotation = view.getRotation();
var currentCenter = view.getCenter();
if (goog.isDef(currentRotation) && goog.isDef(currentCenter) &&
goog.isDef(opt_duration)) {
map.requestRenderFrame();
map.addPreRenderFunction(ol.animation.rotate({
rotation: currentRotation,
duration: opt_duration,
easing: ol.easing.easeOut
}));
if (goog.isDef(opt_anchor)) {
map.addPreRenderFunction(ol.animation.pan({
source: currentCenter,
duration: opt_duration,
easing: ol.easing.easeOut
}));
}
}
if (goog.isDefAndNotNull(opt_anchor)) {
var center = view.calculateCenterRotate(rotation, opt_anchor);
map.withFrozenRendering(function() {
view.setCenter(center);
view.setRotation(rotation);
});
} else {
view.setRotation(rotation);
}
}
};
/**
* @param {ol.Map} map Map.
* @param {ol.View2D} view View.
* @param {number|undefined} resolution Resolution to go to.
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
* @param {number=} opt_direction Zooming direction; > 0 indicates
* zooming out, in which case the constraints system will select
* the largest nearest resolution; < 0 indicates zooming in, in
* which case the constraints system will select the smallest
* nearest resolution; == 0 indicates that the zooming direction
* is unknown/not relevant, in which case the constraints system
* will select the nearest resolution. If not defined 0 is
* assumed.
*/
ol.interaction.Interaction.zoom =
function(map, view, resolution, opt_anchor, opt_duration, opt_direction) {
resolution = view.constrainResolution(resolution, 0, opt_direction);
ol.interaction.Interaction.zoomWithoutConstraints(
map, view, resolution, opt_anchor, opt_duration);
};
/**
* @param {ol.Map} map Map.
* @param {ol.View2D} view View.
* @param {number} delta Delta from previous zoom level.
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
ol.interaction.Interaction.zoomByDelta =
function(map, view, delta, opt_anchor, opt_duration) {
var currentResolution = view.getResolution();
var resolution = view.constrainResolution(currentResolution, delta, 0);
ol.interaction.Interaction.zoomWithoutConstraints(
map, view, resolution, opt_anchor, opt_duration);
};
/**
* @param {ol.Map} map Map.
* @param {ol.View2D} view View.
* @param {number|undefined} resolution Resolution to go to.
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
ol.interaction.Interaction.zoomWithoutConstraints =
function(map, view, resolution, opt_anchor, opt_duration) {
if (goog.isDefAndNotNull(resolution)) {
var currentResolution = view.getResolution();
var currentCenter = view.getCenter();
if (goog.isDef(currentResolution) && goog.isDef(currentCenter) &&
goog.isDef(opt_duration)) {
map.requestRenderFrame();
map.addPreRenderFunction(ol.animation.zoom({
resolution: currentResolution,
duration: opt_duration,
easing: ol.easing.easeOut
}));
if (goog.isDef(opt_anchor)) {
map.addPreRenderFunction(ol.animation.pan({
source: currentCenter,
duration: opt_duration,
easing: ol.easing.easeOut
}));
}
}
if (goog.isDefAndNotNull(opt_anchor)) {
var center = view.calculateCenterZoom(resolution, opt_anchor);
map.withFrozenRendering(function() {
view.setCenter(center);
view.setResolution(resolution);
});
} else {
view.setResolution(resolution);
}
}
};

View File

@@ -70,7 +70,8 @@ ol.interaction.KeyboardPan.prototype.handleMapBrowserEvent =
}
var delta = [deltaX, deltaY];
ol.coordinate.rotate(delta, rotation);
view.pan(map, delta, ol.interaction.KEYBOARD_PAN_DURATION);
ol.interaction.Interaction.pan(
map, view, delta, ol.interaction.KEYBOARD_PAN_DURATION);
keyEvent.preventDefault();
mapBrowserEvent.preventDefault();
}

View File

@@ -4,7 +4,6 @@ goog.provide('ol.interaction.KeyboardZoom');
goog.require('goog.asserts');
goog.require('goog.events.KeyHandler.EventType');
goog.require('ol.View2D');
goog.require('ol.interaction.Interaction');
@@ -50,9 +49,8 @@ ol.interaction.KeyboardZoom.prototype.handleMapBrowserEvent =
var delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_;
map.requestRenderFrame();
// FIXME works for View2D only
var view = map.getView();
goog.asserts.assertInstanceof(view, ol.View2D);
view.zoomByDelta(map, delta, undefined,
var view = map.getView().getView2D();
ol.interaction.Interaction.zoomByDelta(map, view, delta, undefined,
ol.interaction.KEYBOARD_ZOOM_DURATION);
keyEvent.preventDefault();
mapBrowserEvent.preventDefault();

View File

@@ -7,7 +7,6 @@ goog.require('goog.events.MouseWheelEvent');
goog.require('goog.events.MouseWheelHandler.EventType');
goog.require('goog.math');
goog.require('ol.Coordinate');
goog.require('ol.View2D');
goog.require('ol.interaction.Interaction');
@@ -108,11 +107,10 @@ ol.interaction.MouseWheelZoom.prototype.doZoom_ = function(map) {
var delta = goog.math.clamp(this.delta_, -maxDelta, maxDelta);
// FIXME works for View2D only
var view = map.getView();
goog.asserts.assertInstanceof(view, ol.View2D);
var view = map.getView().getView2D();
map.requestRenderFrame();
view.zoomByDelta(map, -delta, this.lastAnchor_,
ol.interaction.Interaction.zoomByDelta(map, view, -delta, this.lastAnchor_,
ol.interaction.MOUSEWHEELZOOM_ANIMATION_DURATION);
this.delta_ = 0;

View File

@@ -6,6 +6,7 @@ goog.require('goog.asserts');
goog.require('goog.style');
goog.require('ol.View');
goog.require('ol.ViewHint');
goog.require('ol.interaction.Interaction');
goog.require('ol.interaction.Touch');
@@ -86,7 +87,6 @@ ol.interaction.TouchRotate.prototype.handleTouchMove =
this.lastAngle_ = angle;
var map = mapBrowserEvent.map;
var view = map.getView();
// rotate anchor point.
// FIXME: should be the intersection point between the lines:
@@ -99,8 +99,9 @@ ol.interaction.TouchRotate.prototype.handleTouchMove =
// rotate
if (this.rotating_) {
view.rotateWithoutConstraints(map, view.getRotation() + rotationDelta,
anchor);
var view = map.getView().getView2D();
ol.interaction.Interaction.rotateWithoutConstraints(map, view,
view.getRotation() + rotationDelta, anchor);
}
};
@@ -112,9 +113,10 @@ ol.interaction.TouchRotate.prototype.handleTouchEnd =
function(mapBrowserEvent) {
if (this.targetTouches.length < 2) {
var map = mapBrowserEvent.map;
var view = map.getView();
var view = map.getView().getView2D();
if (this.rotating_) {
view.rotate(map, view.getRotation(), undefined,
ol.interaction.Interaction.rotate(
map, view, view.getRotation(), undefined,
ol.interaction.TOUCHROTATE_ANIMATION_DURATION);
}
view.setHint(ol.ViewHint.INTERACTING, -1);

View File

@@ -6,6 +6,7 @@ goog.require('goog.asserts');
goog.require('goog.style');
goog.require('ol.View');
goog.require('ol.ViewHint');
goog.require('ol.interaction.Interaction');
goog.require('ol.interaction.Touch');
@@ -65,7 +66,7 @@ ol.interaction.TouchZoom.prototype.handleTouchMove =
}
var map = mapBrowserEvent.map;
var view = map.getView();
var view = map.getView().getView2D();
// scale anchor point.
var viewportPosition = goog.style.getClientPosition(map.getViewport());
@@ -75,7 +76,8 @@ ol.interaction.TouchZoom.prototype.handleTouchMove =
var anchor = map.getCoordinateFromPixel(centroid);
// scale, bypass the resolution constraint
view.zoomWithoutConstraints(map, view.getResolution() * scaleDelta, anchor);
ol.interaction.Interaction.zoomWithoutConstraints(
map, view, view.getResolution() * scaleDelta, anchor);
};
@@ -87,12 +89,12 @@ ol.interaction.TouchZoom.prototype.handleTouchEnd =
function(mapBrowserEvent) {
if (this.targetTouches.length < 2) {
var map = mapBrowserEvent.map;
var view = map.getView();
var view = map.getView().getView2D();
// Zoom to final resolution, with an animation, and provide a
// direction not to zoom out/in if user was pinching in/out.
// Direction is > 0 if pinching out, and < 0 if pinching in.
var direction = this.lastScaleDelta_ - 1;
view.zoom(map, view.getResolution(), undefined,
ol.interaction.Interaction.zoom(map, view, view.getResolution(), undefined,
ol.interaction.TOUCHZOOM_ANIMATION_DURATION, direction);
view.setHint(ol.ViewHint.INTERACTING, -1);
return false;

View File

@@ -15,9 +15,7 @@ goog.require('ol.RotationConstraint');
goog.require('ol.RotationConstraintType');
goog.require('ol.Size');
goog.require('ol.View');
goog.require('ol.animation');
goog.require('ol.coordinate');
goog.require('ol.easing');
goog.require('ol.projection');
@@ -93,6 +91,68 @@ ol.View2D = function(opt_options) {
goog.inherits(ol.View2D, ol.View);
/**
* @param {number} rotation Target rotation.
* @param {ol.Coordinate} anchor Rotation anchor.
* @return {ol.Coordinate|undefined} Center for rotation and anchor.
*/
ol.View2D.prototype.calculateCenterRotate = function(rotation, anchor) {
var center;
var currentCenter = this.getCenter();
if (goog.isDef(currentCenter)) {
center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]];
ol.coordinate.rotate(center, rotation - this.getRotation());
ol.coordinate.add(center, anchor);
}
return center;
};
/**
* @param {number} resolution Target resolution.
* @param {ol.Coordinate} anchor Zoom anchor.
* @return {ol.Coordinate|undefined} Center for resolution and anchor.
*/
ol.View2D.prototype.calculateCenterZoom = function(resolution, anchor) {
var center;
var currentCenter = this.getCenter();
var currentResolution = this.getResolution();
if (goog.isDef(currentCenter) && goog.isDef(currentResolution)) {
var x = anchor[0] -
resolution * (anchor[0] - currentCenter[0]) / currentResolution;
var y = anchor[1] -
resolution * (anchor[1] - currentCenter[1]) / currentResolution;
center = [x, y];
}
return center;
};
/**
* @param {number|undefined} resolution Resolution.
* @param {number=} opt_delta Delta.
* @param {number=} opt_direction Direction.
* @return {number|undefined} Constrained resolution.
*/
ol.View2D.prototype.constrainResolution = function(
resolution, opt_delta, opt_direction) {
var delta = opt_delta || 0;
var direction = opt_direction || 0;
return this.constraints_.resolution(resolution, delta, direction);
};
/**
* @param {number|undefined} rotation Rotation.
* @param {number=} opt_delta Delta.
* @return {number|undefined} Constrained rotation.
*/
ol.View2D.prototype.constrainRotation = function(rotation, opt_delta) {
var delta = opt_delta || 0;
return this.constraints_.rotation(rotation, delta);
};
/**
* @inheritDoc
*/
@@ -252,7 +312,7 @@ ol.View2D.prototype.getView3D = function() {
ol.View2D.prototype.fitExtent = function(extent, size) {
this.setCenter(extent.getCenter());
var resolution = this.getResolutionForExtent(extent, size);
resolution = this.constraints_.resolution(resolution, 0, 0);
resolution = this.constrainResolution(resolution, 0, 0);
this.setResolution(resolution);
};
@@ -314,167 +374,6 @@ goog.exportProperty(
ol.View2D.prototype.setRotation);
/**
* @param {ol.Map} map Map.
* @param {ol.Coordinate} delta Delta.
* @param {number=} opt_duration Duration.
*/
ol.View2D.prototype.pan = function(map, delta, opt_duration) {
var currentCenter = this.getCenter();
if (goog.isDef(currentCenter)) {
if (goog.isDef(opt_duration)) {
map.requestRenderFrame();
map.addPreRenderFunction(ol.animation.pan({
source: currentCenter,
duration: opt_duration,
easing: ol.easing.linear
}));
}
this.setCenter([currentCenter[0] + delta[0], currentCenter[1] + delta[1]]);
}
};
/**
* @param {ol.Map} map Map.
* @param {number|undefined} rotation Rotation.
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
ol.View2D.prototype.rotate =
function(map, rotation, opt_anchor, opt_duration) {
rotation = this.constraints_.rotation(rotation, 0);
this.rotateWithoutConstraints(map, rotation, opt_anchor, opt_duration);
};
/**
* @param {ol.Map} map Map.
* @param {number|undefined} rotation Rotation.
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
ol.View2D.prototype.rotateWithoutConstraints =
function(map, rotation, opt_anchor, opt_duration) {
if (goog.isDefAndNotNull(rotation)) {
var currentRotation = this.getRotation();
var currentCenter = this.getCenter();
if (goog.isDef(currentRotation) && goog.isDef(currentCenter) &&
goog.isDef(opt_duration)) {
map.requestRenderFrame();
map.addPreRenderFunction(ol.animation.rotate({
rotation: currentRotation,
duration: opt_duration,
easing: ol.easing.easeOut
}));
if (goog.isDef(opt_anchor)) {
map.addPreRenderFunction(ol.animation.pan({
source: currentCenter,
duration: opt_duration,
easing: ol.easing.easeOut
}));
}
}
if (goog.isDefAndNotNull(opt_anchor)) {
var anchor = opt_anchor;
var oldCenter = /** @type {!ol.Coordinate} */ (this.getCenter());
var center = [oldCenter[0] - anchor[0], oldCenter[1] - anchor[1]];
ol.coordinate.rotate(center, rotation - this.getRotation());
ol.coordinate.add(center, anchor);
map.withFrozenRendering(function() {
this.setCenter(center);
this.setRotation(rotation);
}, this);
} else {
this.setRotation(rotation);
}
}
};
/**
* @param {ol.Map} map Map.
* @param {number|undefined} resolution Resolution to go to.
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
* @param {number=} opt_direction Zooming direction; > 0 indicates
* zooming out, in which case the constraints system will select
* the largest nearest resolution; < 0 indicates zooming in, in
* which case the constraints system will select the smallest
* nearest resolution; == 0 indicates that the zooming direction
* is unknown/not relevant, in which case the constraints system
* will select the nearest resolution. If not defined 0 is
* assumed.
*/
ol.View2D.prototype.zoom =
function(map, resolution, opt_anchor, opt_duration, opt_direction) {
var direction = opt_direction || 0;
resolution = this.constraints_.resolution(resolution, 0, direction);
this.zoomWithoutConstraints(map, resolution, opt_anchor, opt_duration);
};
/**
* @param {ol.Map} map Map.
* @param {number} delta Delta from previous zoom level.
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
ol.View2D.prototype.zoomByDelta =
function(map, delta, opt_anchor, opt_duration) {
var currentResolution = this.getResolution();
var resolution = this.constraints_.resolution(currentResolution, delta, 0);
this.zoomWithoutConstraints(map, resolution, opt_anchor, opt_duration);
};
/**
* @param {ol.Map} map Map.
* @param {number|undefined} resolution Resolution to go to.
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
ol.View2D.prototype.zoomWithoutConstraints =
function(map, resolution, opt_anchor, opt_duration) {
if (goog.isDefAndNotNull(resolution)) {
var currentResolution = this.getResolution();
var currentCenter = this.getCenter();
if (goog.isDef(currentResolution) && goog.isDef(currentCenter) &&
goog.isDef(opt_duration)) {
map.requestRenderFrame();
map.addPreRenderFunction(ol.animation.zoom({
resolution: currentResolution,
duration: opt_duration,
easing: ol.easing.easeOut
}));
if (goog.isDef(opt_anchor)) {
map.addPreRenderFunction(ol.animation.pan({
source: currentCenter,
duration: opt_duration,
easing: ol.easing.easeOut
}));
}
}
if (goog.isDefAndNotNull(opt_anchor)) {
var anchor = opt_anchor;
var oldCenter = /** @type {!ol.Coordinate} */ (this.getCenter());
var oldResolution = this.getResolution();
var x =
anchor[0] - resolution * (anchor[0] - oldCenter[0]) / oldResolution;
var y =
anchor[1] - resolution * (anchor[1] - oldCenter[1]) / oldResolution;
var center = [x, y];
map.withFrozenRendering(function() {
this.setCenter(center);
this.setResolution(resolution);
}, this);
} else {
this.setResolution(resolution);
}
}
};
/**
* @private
* @param {ol.View2DOptions} options View2D options.