Refactoring to set the constraints to the map

This commit is contained in:
Éric Lemoine
2012-09-26 23:28:01 +02:00
parent 2991fa1178
commit b6bb05bf76
15 changed files with 164 additions and 178 deletions
+5 -5
View File
@@ -2,7 +2,6 @@ goog.provide('ol.interaction.DragPan');
goog.require('ol.Coordinate');
goog.require('ol.MapBrowserEvent');
goog.require('ol.interaction.Constraints');
goog.require('ol.interaction.Drag');
@@ -10,10 +9,9 @@ goog.require('ol.interaction.Drag');
/**
* @constructor
* @extends {ol.interaction.Drag}
* @param {ol.interaction.Constraints} constraints Constraints.
*/
ol.interaction.DragPan = function(constraints) {
goog.base(this, constraints);
ol.interaction.DragPan = function() {
goog.base(this);
};
goog.inherits(ol.interaction.DragPan, ol.interaction.Drag);
@@ -30,7 +28,9 @@ ol.interaction.DragPan.prototype.handleDrag = function(mapBrowserEvent) {
if (map.canRotate() && goog.isDef(rotation)) {
delta.rotate(rotation);
}
this.pan(map, delta, this.startCenter);
var newCenter = new ol.Coordinate(
this.startCenter.x + delta.x, this.startCenter.y + delta.y);
map.setCenter(newCenter);
};