Add zoomDelta option to MapOptions

This commit is contained in:
Éric Lemoine
2012-09-27 15:48:04 +02:00
parent 4f116c2e5b
commit 0535a31bc6
4 changed files with 46 additions and 4 deletions
+10 -2
View File
@@ -9,8 +9,15 @@ goog.require('ol.interaction.Interaction');
/**
* @constructor
* @extends {ol.interaction.Interaction}
* @param {number} delta The zoom delta applied on each double click.
*/
ol.interaction.DblClickZoom = function() {
ol.interaction.DblClickZoom = function(delta) {
/**
* @private
* @type {number}
*/
this.delta_ = delta;
goog.base(this);
};
goog.inherits(ol.interaction.DblClickZoom, ol.interaction.Interaction);
@@ -26,7 +33,8 @@ ol.interaction.DblClickZoom.prototype.handleMapBrowserEvent =
mapBrowserEvent.isMouseActionButton()) {
var map = mapBrowserEvent.map;
var anchor = mapBrowserEvent.getCoordinate();
var delta = mapBrowserEvent.browserEvent.shiftKey ? -4 : 4;
var delta = mapBrowserEvent.browserEvent.shiftKey ?
-this.delta_ : this.delta_;
map.zoom(delta, anchor);
mapBrowserEvent.preventDefault();
}