Replace map.zoomIn and map.zoomOut by map.zoom(delta)
This commit is contained in:
@@ -26,11 +26,8 @@ ol.interaction.DblClickZoom.prototype.handleMapBrowserEvent =
|
||||
mapBrowserEvent.isMouseActionButton()) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var anchor = mapBrowserEvent.getCoordinate();
|
||||
if (mapBrowserEvent.browserEvent.shiftKey) {
|
||||
map.zoomOut(anchor);
|
||||
} else {
|
||||
map.zoomIn(anchor);
|
||||
}
|
||||
var delta = mapBrowserEvent.browserEvent.shiftKey ? -4 : 4;
|
||||
map.zoom(delta, anchor);
|
||||
mapBrowserEvent.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -27,11 +27,8 @@ ol.interaction.KeyboardZoom.prototype.handleMapBrowserEvent =
|
||||
var charCode = keyEvent.charCode;
|
||||
if (charCode == '+'.charCodeAt(0) || charCode == '-'.charCodeAt(0)) {
|
||||
var map = mapBrowserEvent.map;
|
||||
if (charCode == '+'.charCodeAt(0)) {
|
||||
map.zoomIn();
|
||||
} else {
|
||||
map.zoomOut();
|
||||
}
|
||||
var delta = (charCode == '+'.charCodeAt(0)) ? 4 : -4;
|
||||
map.zoom(delta);
|
||||
keyEvent.preventDefault();
|
||||
mapBrowserEvent.preventDefault();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user