Rename DblClickZoom to DoubleClickZoom
This commit is contained in:
@@ -165,7 +165,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.interaction.DblClickZoomOptions
|
||||
* @typedef {Object} ol.interaction.DoubleClickZoomOptions
|
||||
* @property {number|undefined} delta The zoom delta applied on each double
|
||||
* click.
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// FIXME works for View2D only
|
||||
|
||||
goog.provide('ol.interaction.DblClickZoom');
|
||||
goog.provide('ol.interaction.DoubleClickZoom');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
@@ -11,16 +11,16 @@ goog.require('ol.interaction.Interaction');
|
||||
/**
|
||||
* @define {number} Animation duration.
|
||||
*/
|
||||
ol.interaction.DBLCLICKZOOM_ANIMATION_DURATION = 250;
|
||||
ol.interaction.DOUBLECLICKZOOM_ANIMATION_DURATION = 250;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.interaction.Interaction}
|
||||
* @param {ol.interaction.DblClickZoomOptions=} opt_options Options.
|
||||
* @param {ol.interaction.DoubleClickZoomOptions=} opt_options Options.
|
||||
*/
|
||||
ol.interaction.DblClickZoom = function(opt_options) {
|
||||
ol.interaction.DoubleClickZoom = function(opt_options) {
|
||||
|
||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||
|
||||
@@ -33,13 +33,13 @@ ol.interaction.DblClickZoom = function(opt_options) {
|
||||
goog.base(this);
|
||||
|
||||
};
|
||||
goog.inherits(ol.interaction.DblClickZoom, ol.interaction.Interaction);
|
||||
goog.inherits(ol.interaction.DoubleClickZoom, ol.interaction.Interaction);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.interaction.DblClickZoom.prototype.handleMapBrowserEvent =
|
||||
ol.interaction.DoubleClickZoom.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.DBLCLICK &&
|
||||
@@ -50,7 +50,7 @@ ol.interaction.DblClickZoom.prototype.handleMapBrowserEvent =
|
||||
// FIXME works for View2D only
|
||||
var view = map.getView().getView2D();
|
||||
ol.interaction.Interaction.zoomByDelta(map, view, delta, anchor,
|
||||
ol.interaction.DBLCLICKZOOM_ANIMATION_DURATION);
|
||||
ol.interaction.DOUBLECLICKZOOM_ANIMATION_DURATION);
|
||||
mapBrowserEvent.preventDefault();
|
||||
browserEvent.preventDefault();
|
||||
}
|
||||
@@ -2,7 +2,7 @@ goog.provide('ol.interaction.defaults');
|
||||
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.Kinetic');
|
||||
goog.require('ol.interaction.DblClickZoom');
|
||||
goog.require('ol.interaction.DoubleClickZoom');
|
||||
goog.require('ol.interaction.DragPan');
|
||||
goog.require('ol.interaction.DragRotate');
|
||||
goog.require('ol.interaction.DragZoom');
|
||||
@@ -38,7 +38,7 @@ ol.interaction.defaults = function(opt_options, opt_interactions) {
|
||||
var doubleClickZoom = goog.isDef(options.doubleClickZoom) ?
|
||||
options.doubleClickZoom : true;
|
||||
if (doubleClickZoom) {
|
||||
interactions.push(new ol.interaction.DblClickZoom({
|
||||
interactions.push(new ol.interaction.DoubleClickZoom({
|
||||
delta: options.zoomDelta
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ describe('ol.Map', function() {
|
||||
it('create double click interaction with default delta', function() {
|
||||
var interactions = ol.interaction.defaults(options);
|
||||
expect(interactions.getLength()).to.eql(1);
|
||||
expect(interactions.getAt(0)).to.be.a(ol.interaction.DblClickZoom);
|
||||
expect(interactions.getAt(0)).to.be.a(ol.interaction.DoubleClickZoom);
|
||||
expect(interactions.getAt(0).delta_).to.eql(1);
|
||||
});
|
||||
});
|
||||
@@ -113,7 +113,7 @@ describe('ol.Map', function() {
|
||||
options.zoomDelta = 7;
|
||||
var interactions = ol.interaction.defaults(options);
|
||||
expect(interactions.getLength()).to.eql(1);
|
||||
expect(interactions.getAt(0)).to.be.a(ol.interaction.DblClickZoom);
|
||||
expect(interactions.getAt(0)).to.be.a(ol.interaction.DoubleClickZoom);
|
||||
expect(interactions.getAt(0).delta_).to.eql(7);
|
||||
});
|
||||
});
|
||||
@@ -127,6 +127,6 @@ goog.require('goog.dom');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.RendererHint');
|
||||
goog.require('ol.RendererHints');
|
||||
goog.require('ol.interaction.DblClickZoom');
|
||||
goog.require('ol.interaction.DoubleClickZoom');
|
||||
goog.require('ol.interaction.MouseWheelZoom');
|
||||
goog.require('ol.interaction.defaults');
|
||||
|
||||
Reference in New Issue
Block a user