Use getView2DState instead of getResolution/getRotation in interactions

This commit is contained in:
Tom Payne
2013-06-25 12:18:31 +02:00
parent a427719a22
commit e5d6ccd6ba
2 changed files with 9 additions and 8 deletions

View File

@@ -61,10 +61,12 @@ ol.interaction.DragPan.prototype.handleDrag = function(mapBrowserEvent) {
// FIXME works for View2D only
var view = map.getView();
goog.asserts.assertInstanceof(view, ol.View2D);
var resolution = view.getResolution();
var rotation = view.getRotation();
var newCenter = [-resolution * this.deltaX, resolution * this.deltaY];
ol.coordinate.rotate(newCenter, rotation);
var view2DState = view.getView2DState();
var newCenter = [
-view2DState.resolution * this.deltaX,
view2DState.resolution * this.deltaY
];
ol.coordinate.rotate(newCenter, view2DState.rotation);
ol.coordinate.add(newCenter, this.startCenter);
map.requestRenderFrame();
view.setCenter(newCenter);