Constrain center in ol.interaction.TouchPan

This commit is contained in:
Frederic Junod
2013-09-30 10:37:02 +02:00
parent 8ffe910ebf
commit 680f5cbb5a

View File

@@ -69,6 +69,7 @@ ol.interaction.TouchPan.prototype.handleTouchMove = function(mapBrowserEvent) {
ol.coordinate.scale(center, view2DState.resolution);
ol.coordinate.rotate(center, view2DState.rotation);
ol.coordinate.add(center, view2DState.center);
center = view.constrainCenter(center);
map.requestRenderFrame();
view.setCenter(center);
}
@@ -95,6 +96,7 @@ ol.interaction.TouchPan.prototype.handleTouchEnd =
centerpx[0] - distance * Math.cos(angle),
centerpx[1] - distance * Math.sin(angle)
]);
dest = view.constrainCenter(dest);
view.setCenter(dest);
}
map.requestRenderFrame();