Rename DblClickZoom to DoubleClickZoom

This commit is contained in:
Tom Payne
2013-04-22 14:33:48 +02:00
parent eb9f6c027b
commit ef17d4f3b8
4 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -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 * @property {number|undefined} delta The zoom delta applied on each double
* click. * click.
*/ */
@@ -1,6 +1,6 @@
// FIXME works for View2D only // FIXME works for View2D only
goog.provide('ol.interaction.DblClickZoom'); goog.provide('ol.interaction.DoubleClickZoom');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('ol.MapBrowserEvent'); goog.require('ol.MapBrowserEvent');
@@ -11,16 +11,16 @@ goog.require('ol.interaction.Interaction');
/** /**
* @define {number} Animation duration. * @define {number} Animation duration.
*/ */
ol.interaction.DBLCLICKZOOM_ANIMATION_DURATION = 250; ol.interaction.DOUBLECLICKZOOM_ANIMATION_DURATION = 250;
/** /**
* @constructor * @constructor
* @extends {ol.interaction.Interaction} * @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 : {}; var options = goog.isDef(opt_options) ? opt_options : {};
@@ -33,13 +33,13 @@ ol.interaction.DblClickZoom = function(opt_options) {
goog.base(this); goog.base(this);
}; };
goog.inherits(ol.interaction.DblClickZoom, ol.interaction.Interaction); goog.inherits(ol.interaction.DoubleClickZoom, ol.interaction.Interaction);
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.interaction.DblClickZoom.prototype.handleMapBrowserEvent = ol.interaction.DoubleClickZoom.prototype.handleMapBrowserEvent =
function(mapBrowserEvent) { function(mapBrowserEvent) {
var browserEvent = mapBrowserEvent.browserEvent; var browserEvent = mapBrowserEvent.browserEvent;
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.DBLCLICK && if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.DBLCLICK &&
@@ -50,7 +50,7 @@ ol.interaction.DblClickZoom.prototype.handleMapBrowserEvent =
// FIXME works for View2D only // FIXME works for View2D only
var view = map.getView().getView2D(); var view = map.getView().getView2D();
ol.interaction.Interaction.zoomByDelta(map, view, delta, anchor, ol.interaction.Interaction.zoomByDelta(map, view, delta, anchor,
ol.interaction.DBLCLICKZOOM_ANIMATION_DURATION); ol.interaction.DOUBLECLICKZOOM_ANIMATION_DURATION);
mapBrowserEvent.preventDefault(); mapBrowserEvent.preventDefault();
browserEvent.preventDefault(); browserEvent.preventDefault();
} }
+2 -2
View File
@@ -2,7 +2,7 @@ goog.provide('ol.interaction.defaults');
goog.require('ol.Collection'); goog.require('ol.Collection');
goog.require('ol.Kinetic'); goog.require('ol.Kinetic');
goog.require('ol.interaction.DblClickZoom'); goog.require('ol.interaction.DoubleClickZoom');
goog.require('ol.interaction.DragPan'); goog.require('ol.interaction.DragPan');
goog.require('ol.interaction.DragRotate'); goog.require('ol.interaction.DragRotate');
goog.require('ol.interaction.DragZoom'); goog.require('ol.interaction.DragZoom');
@@ -38,7 +38,7 @@ ol.interaction.defaults = function(opt_options, opt_interactions) {
var doubleClickZoom = goog.isDef(options.doubleClickZoom) ? var doubleClickZoom = goog.isDef(options.doubleClickZoom) ?
options.doubleClickZoom : true; options.doubleClickZoom : true;
if (doubleClickZoom) { if (doubleClickZoom) {
interactions.push(new ol.interaction.DblClickZoom({ interactions.push(new ol.interaction.DoubleClickZoom({
delta: options.zoomDelta delta: options.zoomDelta
})); }));
} }
+3 -3
View File
@@ -103,7 +103,7 @@ describe('ol.Map', function() {
it('create double click interaction with default delta', function() { it('create double click interaction with default delta', function() {
var interactions = ol.interaction.defaults(options); var interactions = ol.interaction.defaults(options);
expect(interactions.getLength()).to.eql(1); 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); expect(interactions.getAt(0).delta_).to.eql(1);
}); });
}); });
@@ -113,7 +113,7 @@ describe('ol.Map', function() {
options.zoomDelta = 7; options.zoomDelta = 7;
var interactions = ol.interaction.defaults(options); var interactions = ol.interaction.defaults(options);
expect(interactions.getLength()).to.eql(1); 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); expect(interactions.getAt(0).delta_).to.eql(7);
}); });
}); });
@@ -127,6 +127,6 @@ goog.require('goog.dom');
goog.require('ol.Map'); goog.require('ol.Map');
goog.require('ol.RendererHint'); goog.require('ol.RendererHint');
goog.require('ol.RendererHints'); goog.require('ol.RendererHints');
goog.require('ol.interaction.DblClickZoom'); goog.require('ol.interaction.DoubleClickZoom');
goog.require('ol.interaction.MouseWheelZoom'); goog.require('ol.interaction.MouseWheelZoom');
goog.require('ol.interaction.defaults'); goog.require('ol.interaction.defaults');