Remove private static members from MouseWheelZoom interaction
This commit is contained in:
@@ -18,6 +18,15 @@ import {clamp} from '../math.js';
|
||||
const MAX_DELTA = 1;
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
export const Mode = {
|
||||
TRACKPAD: 'trackpad',
|
||||
WHEEL: 'wheel'
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to zoom the map by scrolling the mouse wheel.
|
||||
@@ -91,7 +100,7 @@ const MouseWheelZoom = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.interaction.MouseWheelZoom.Mode_|undefined}
|
||||
* @type {ol.interaction.Mode|undefined}
|
||||
*/
|
||||
this.mode_ = undefined;
|
||||
|
||||
@@ -183,11 +192,11 @@ MouseWheelZoom.handleEvent = function(mapBrowserEvent) {
|
||||
|
||||
if (!this.mode_ || now - this.startTime_ > this.trackpadEventGap_) {
|
||||
this.mode_ = Math.abs(delta) < 4 ?
|
||||
MouseWheelZoom.Mode_.TRACKPAD :
|
||||
MouseWheelZoom.Mode_.WHEEL;
|
||||
Mode.TRACKPAD :
|
||||
Mode.WHEEL;
|
||||
}
|
||||
|
||||
if (this.mode_ === MouseWheelZoom.Mode_.TRACKPAD) {
|
||||
if (this.mode_ === Mode.TRACKPAD) {
|
||||
const view = map.getView();
|
||||
if (this.trackpadTimeoutId_) {
|
||||
clearTimeout(this.trackpadTimeoutId_);
|
||||
@@ -296,12 +305,4 @@ MouseWheelZoom.prototype.setMouseAnchor = function(useAnchor) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @private
|
||||
*/
|
||||
MouseWheelZoom.Mode_ = {
|
||||
TRACKPAD: 'trackpad',
|
||||
WHEEL: 'wheel'
|
||||
};
|
||||
export default MouseWheelZoom;
|
||||
|
||||
@@ -4,7 +4,7 @@ import View from '../../../../src/ol/View.js';
|
||||
import Event from '../../../../src/ol/events/Event.js';
|
||||
import {DEVICE_PIXEL_RATIO, FIREFOX, SAFARI} from '../../../../src/ol/has.js';
|
||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||
import MouseWheelZoom from '../../../../src/ol/interaction/MouseWheelZoom.js';
|
||||
import MouseWheelZoom, {Mode} from '../../../../src/ol/interaction/MouseWheelZoom.js';
|
||||
|
||||
|
||||
describe('ol.interaction.MouseWheelZoom', function() {
|
||||
@@ -65,7 +65,7 @@ describe('ol.interaction.MouseWheelZoom', function() {
|
||||
if (FIREFOX) {
|
||||
it('works on Firefox in DOM_DELTA_PIXEL mode (trackpad)', function(done) {
|
||||
map.once('postrender', function() {
|
||||
expect(interaction.mode_).to.be(MouseWheelZoom.Mode_.TRACKPAD);
|
||||
expect(interaction.mode_).to.be(Mode.TRACKPAD);
|
||||
done();
|
||||
});
|
||||
const event = new MapBrowserEvent('wheel', map, {
|
||||
@@ -83,7 +83,7 @@ describe('ol.interaction.MouseWheelZoom', function() {
|
||||
if (!FIREFOX) {
|
||||
it('works in DOM_DELTA_PIXEL mode (trackpad)', function(done) {
|
||||
map.once('postrender', function() {
|
||||
expect(interaction.mode_).to.be(MouseWheelZoom.Mode_.TRACKPAD);
|
||||
expect(interaction.mode_).to.be(Mode.TRACKPAD);
|
||||
done();
|
||||
});
|
||||
const event = new MapBrowserEvent('wheel', map, {
|
||||
|
||||
Reference in New Issue
Block a user