Fix drag pan for rotated maps

This commit is contained in:
Tom Payne
2012-08-13 18:02:05 +02:00
parent 85fb3980b6
commit 07c3cd3d8d
2 changed files with 4 additions and 3 deletions

View File

@@ -1,5 +1,3 @@
// FIXME cope with rotation
goog.provide('ol.interaction.DragPan');
goog.require('ol.Coordinate');
@@ -26,8 +24,12 @@ goog.inherits(ol.interaction.DragPan, ol.interaction.Drag);
ol.interaction.DragPan.prototype.handleDrag = function(mapBrowserEvent) {
var map = mapBrowserEvent.map;
var resolution = map.getResolution();
var rotation = map.getRotation();
var delta =
new ol.Coordinate(-resolution * this.deltaX, resolution * this.deltaY);
if (map.canRotate() && goog.isDef(rotation)) {
delta.rotate(rotation);
}
this.pan(map, delta, this.startCenter);
};