Constrain center in ol.interaction.DragPan

This commit is contained in:
Tom Payne
2013-06-18 13:08:05 +02:00
committed by Frederic Junod
parent 92f7f14744
commit 2e395e4530

View File

@@ -68,6 +68,7 @@ ol.interaction.DragPan.prototype.handleDrag = function(mapBrowserEvent) {
];
ol.coordinate.rotate(newCenter, view2DState.rotation);
ol.coordinate.add(newCenter, this.startCenter);
newCenter = view.constrainCenter(newCenter);
map.requestRenderFrame();
view.setCenter(newCenter);
};
@@ -95,6 +96,7 @@ ol.interaction.DragPan.prototype.handleDragEnd = function(mapBrowserEvent) {
centerpx[0] - distance * Math.cos(angle),
centerpx[1] - distance * Math.sin(angle)
]);
dest = view.constrainCenter(dest);
view.setCenter(dest);
}
map.requestRenderFrame();