From 69d345171e336a8ddde790fb0178b19584f7c57f Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 27 Dec 2016 13:32:24 -0700 Subject: [PATCH] Private enum for mousewheel mode --- src/ol/interaction/mousewheelzoom.js | 11 ++++++----- test/spec/ol/interaction/mousewheelzoom.test.js | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/ol/interaction/mousewheelzoom.js b/src/ol/interaction/mousewheelzoom.js index ce3e721881..4153369c55 100644 --- a/src/ol/interaction/mousewheelzoom.js +++ b/src/ol/interaction/mousewheelzoom.js @@ -70,7 +70,7 @@ ol.interaction.MouseWheelZoom = function(opt_options) { /** * @private - * @type {ol.interaction.MouseWheelZoom.Mode|undefined} + * @type {ol.interaction.MouseWheelZoom.Mode_|undefined} */ this.mode_ = undefined; @@ -158,11 +158,11 @@ ol.interaction.MouseWheelZoom.handleEvent = function(mapBrowserEvent) { if (!this.mode_ || now - this.startTime_ > this.trackpadEventGap_) { this.mode_ = Math.abs(delta) < 4 ? - ol.interaction.MouseWheelZoom.Mode.TRACKPAD : - ol.interaction.MouseWheelZoom.Mode.WHEEL; + ol.interaction.MouseWheelZoom.Mode_.TRACKPAD : + ol.interaction.MouseWheelZoom.Mode_.WHEEL; } - if (this.mode_ === ol.interaction.MouseWheelZoom.Mode.TRACKPAD) { + if (this.mode_ === ol.interaction.MouseWheelZoom.Mode_.TRACKPAD) { var view = map.getView(); if (this.trackpadTimeoutId_) { clearTimeout(this.trackpadTimeoutId_); @@ -263,8 +263,9 @@ ol.interaction.MouseWheelZoom.prototype.setMouseAnchor = function(useAnchor) { /** * @enum {string} + * @private */ -ol.interaction.MouseWheelZoom.Mode = { +ol.interaction.MouseWheelZoom.Mode_ = { TRACKPAD: 'trackpad', WHEEL: 'wheel' }; diff --git a/test/spec/ol/interaction/mousewheelzoom.test.js b/test/spec/ol/interaction/mousewheelzoom.test.js index f76f0469a3..ea3078d1a0 100644 --- a/test/spec/ol/interaction/mousewheelzoom.test.js +++ b/test/spec/ol/interaction/mousewheelzoom.test.js @@ -69,7 +69,7 @@ describe('ol.interaction.MouseWheelZoom', function() { var origHasFirefox = ol.has.FIREFOX; ol.has.FIREFOX = true; map.once('postrender', function() { - expect(interaction.mode_).to.be(ol.interaction.MouseWheelZoom.Mode.TRACKPAD); + expect(interaction.mode_).to.be(ol.interaction.MouseWheelZoom.Mode_.TRACKPAD); ol.has.FIREFOX = origHasFirefox; done(); }); @@ -88,7 +88,7 @@ describe('ol.interaction.MouseWheelZoom', function() { var origHasFirefox = ol.has.FIREFOX; ol.has.FIREFOX = false; map.once('postrender', function() { - expect(interaction.mode_).to.be(ol.interaction.MouseWheelZoom.Mode.TRACKPAD); + expect(interaction.mode_).to.be(ol.interaction.MouseWheelZoom.Mode_.TRACKPAD); ol.has.FIREFOX = origHasFirefox; done(); });