Take the resolution constraint into account.

But only at the end of the pinch zoom action.
This commit is contained in:
Frederic Junod
2013-02-20 09:37:11 +01:00
parent 3e4ae0d79d
commit 8d24311bc8

View File

@@ -102,7 +102,7 @@ ol.interaction.TouchRotateAndZoom.prototype.handleTouchMove =
centroid.y -= viewportPosition.y;
var anchor = map.getCoordinateFromPixel(centroid);
// scale
// scale, bypass the resolution constraint
view.zoom_(map, view.getResolution() * scaleDelta, anchor);
// rotate
@@ -118,7 +118,10 @@ ol.interaction.TouchRotateAndZoom.prototype.handleTouchMove =
ol.interaction.TouchRotateAndZoom.prototype.handleTouchEnd =
function(mapBrowserEvent) {
if (this.targetTouches.length < 2) {
var view = mapBrowserEvent.map.getView();
var map = mapBrowserEvent.map;
var view = map.getView();
// take the resolution constraint into account
view.zoomToResolution(map, view.getResolution());
view.setHint(ol.ViewHint.PANNING, -1);
return false;
} else {