Let the controls decide about stopPropagation and preventDefault.
This commit is contained in:
@@ -63,6 +63,8 @@ ol.control.Navigation.prototype.zoomMap = function(evt) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
map.setZoom(map.getZoom()-delta, map.getEvents().getPointerPosition(evt));
|
map.setZoom(map.getZoom()-delta, map.getEvents().getPointerPosition(evt));
|
||||||
|
// We don't want the page to scroll.
|
||||||
|
evt.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,13 @@ ol.control.Zoom.prototype.handle = function(evt) {
|
|||||||
this.map_.zoomOut();
|
this.map_.zoomOut();
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
|
if (handled) {
|
||||||
|
// Stop default behavior (i.e. don't follow link to anchor)
|
||||||
|
evt.preventDefault();
|
||||||
|
// On Android 2.3, the above does not prevent the link from being
|
||||||
|
// followed, but stopPropagation does.
|
||||||
|
evt.stopPropagation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return !handled;
|
return !handled;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -288,10 +288,7 @@ ol.event.Events.prototype.handleBrowserEvent = function(evt) {
|
|||||||
if (this.includeXY_) {
|
if (this.includeXY_) {
|
||||||
evt.xy = this.getPointerPosition(evt);
|
evt.xy = this.getPointerPosition(evt);
|
||||||
}
|
}
|
||||||
if (this.triggerEvent(evt.type, evt) === false) {
|
this.triggerEvent(evt.type, evt);
|
||||||
evt.stopPropagation();
|
|
||||||
evt.preventDefault();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user