Imports cased like the filename
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
goog.provide('ol.interaction.DoubleClickZoom');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.MapBrowserEventType');
|
||||
goog.require('ol.interaction.Interaction');
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to zoom by double-clicking on the map.
|
||||
*
|
||||
* @constructor
|
||||
* @extends {ol.interaction.Interaction}
|
||||
* @param {olx.interaction.DoubleClickZoomOptions=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
ol.interaction.DoubleClickZoom = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.delta_ = options.delta ? options.delta : 1;
|
||||
|
||||
ol.interaction.Interaction.call(this, {
|
||||
handleEvent: ol.interaction.DoubleClickZoom.handleEvent
|
||||
});
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 250;
|
||||
|
||||
};
|
||||
ol.inherits(ol.interaction.DoubleClickZoom, ol.interaction.Interaction);
|
||||
|
||||
|
||||
/**
|
||||
* Handles the {@link ol.MapBrowserEvent map browser event} (if it was a
|
||||
* doubleclick) and eventually zooms the map.
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
* @this {ol.interaction.DoubleClickZoom}
|
||||
* @api
|
||||
*/
|
||||
ol.interaction.DoubleClickZoom.handleEvent = function(mapBrowserEvent) {
|
||||
var stopEvent = false;
|
||||
var browserEvent = mapBrowserEvent.originalEvent;
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEventType.DBLCLICK) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var anchor = mapBrowserEvent.coordinate;
|
||||
var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
|
||||
var view = map.getView();
|
||||
ol.interaction.Interaction.zoomByDelta(
|
||||
view, delta, anchor, this.duration_);
|
||||
mapBrowserEvent.preventDefault();
|
||||
stopEvent = true;
|
||||
}
|
||||
return !stopEvent;
|
||||
};
|
||||
Reference in New Issue
Block a user