Take the resolution constraint into account.
But only at the end of the pinch zoom action.
This commit is contained in:
@@ -102,7 +102,7 @@ ol.interaction.TouchRotateAndZoom.prototype.handleTouchMove =
|
|||||||
centroid.y -= viewportPosition.y;
|
centroid.y -= viewportPosition.y;
|
||||||
var anchor = map.getCoordinateFromPixel(centroid);
|
var anchor = map.getCoordinateFromPixel(centroid);
|
||||||
|
|
||||||
// scale
|
// scale, bypass the resolution constraint
|
||||||
view.zoom_(map, view.getResolution() * scaleDelta, anchor);
|
view.zoom_(map, view.getResolution() * scaleDelta, anchor);
|
||||||
|
|
||||||
// rotate
|
// rotate
|
||||||
@@ -118,7 +118,10 @@ ol.interaction.TouchRotateAndZoom.prototype.handleTouchMove =
|
|||||||
ol.interaction.TouchRotateAndZoom.prototype.handleTouchEnd =
|
ol.interaction.TouchRotateAndZoom.prototype.handleTouchEnd =
|
||||||
function(mapBrowserEvent) {
|
function(mapBrowserEvent) {
|
||||||
if (this.targetTouches.length < 2) {
|
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);
|
view.setHint(ol.ViewHint.PANNING, -1);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user