diff --git a/examples/pinch-zoom.js b/examples/pinch-zoom.js index 4261e79445..22d26853e3 100644 --- a/examples/pinch-zoom.js +++ b/examples/pinch-zoom.js @@ -1,14 +1,14 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; -import _ol_interaction_PinchZoom_ from '../src/ol/interaction/PinchZoom.js'; +import PinchZoom from '../src/ol/interaction/PinchZoom.js'; import TileLayer from '../src/ol/layer/Tile.js'; import OSM from '../src/ol/source/OSM.js'; var map = new Map({ interactions: defaultInteractions({pinchZoom: false}).extend([ - new _ol_interaction_PinchZoom_({ + new PinchZoom({ constrainResolution: true // force zooming to a integer zoom }) ]), diff --git a/src/ol/interaction.js b/src/ol/interaction.js index 2ab4d818df..0a03ac6204 100644 --- a/src/ol/interaction.js +++ b/src/ol/interaction.js @@ -11,7 +11,7 @@ import _ol_interaction_KeyboardPan_ from './interaction/KeyboardPan.js'; import _ol_interaction_KeyboardZoom_ from './interaction/KeyboardZoom.js'; import MouseWheelZoom from './interaction/MouseWheelZoom.js'; import _ol_interaction_PinchRotate_ from './interaction/PinchRotate.js'; -import _ol_interaction_PinchZoom_ from './interaction/PinchZoom.js'; +import PinchZoom from './interaction/PinchZoom.js'; /** @@ -75,7 +75,7 @@ export function defaults(opt_options) { var pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true; if (pinchZoom) { - interactions.push(new _ol_interaction_PinchZoom_({ + interactions.push(new PinchZoom({ constrainResolution: options.constrainResolution, duration: options.zoomDuration })); diff --git a/src/ol/interaction/PinchZoom.js b/src/ol/interaction/PinchZoom.js index c44e88abf4..edb6c080c1 100644 --- a/src/ol/interaction/PinchZoom.js +++ b/src/ol/interaction/PinchZoom.js @@ -17,12 +17,12 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; * @param {olx.interaction.PinchZoomOptions=} opt_options Options. * @api */ -var _ol_interaction_PinchZoom_ = function(opt_options) { +var PinchZoom = function(opt_options) { _ol_interaction_Pointer_.call(this, { - handleDownEvent: _ol_interaction_PinchZoom_.handleDownEvent_, - handleDragEvent: _ol_interaction_PinchZoom_.handleDragEvent_, - handleUpEvent: _ol_interaction_PinchZoom_.handleUpEvent_ + handleDownEvent: PinchZoom.handleDownEvent_, + handleDragEvent: PinchZoom.handleDragEvent_, + handleUpEvent: PinchZoom.handleUpEvent_ }); var options = opt_options ? opt_options : {}; @@ -59,7 +59,7 @@ var _ol_interaction_PinchZoom_ = function(opt_options) { }; -inherits(_ol_interaction_PinchZoom_, _ol_interaction_Pointer_); +inherits(PinchZoom, _ol_interaction_Pointer_); /** @@ -67,7 +67,7 @@ inherits(_ol_interaction_PinchZoom_, _ol_interaction_Pointer_); * @this {ol.interaction.PinchZoom} * @private */ -_ol_interaction_PinchZoom_.handleDragEvent_ = function(mapBrowserEvent) { +PinchZoom.handleDragEvent_ = function(mapBrowserEvent) { var scaleDelta = 1.0; var touch0 = this.targetPointers[0]; @@ -121,7 +121,7 @@ _ol_interaction_PinchZoom_.handleDragEvent_ = function(mapBrowserEvent) { * @this {ol.interaction.PinchZoom} * @private */ -_ol_interaction_PinchZoom_.handleUpEvent_ = function(mapBrowserEvent) { +PinchZoom.handleUpEvent_ = function(mapBrowserEvent) { if (this.targetPointers.length < 2) { var map = mapBrowserEvent.map; var view = map.getView(); @@ -150,7 +150,7 @@ _ol_interaction_PinchZoom_.handleUpEvent_ = function(mapBrowserEvent) { * @this {ol.interaction.PinchZoom} * @private */ -_ol_interaction_PinchZoom_.handleDownEvent_ = function(mapBrowserEvent) { +PinchZoom.handleDownEvent_ = function(mapBrowserEvent) { if (this.targetPointers.length >= 2) { var map = mapBrowserEvent.map; this.anchor_ = null; @@ -169,5 +169,5 @@ _ol_interaction_PinchZoom_.handleDownEvent_ = function(mapBrowserEvent) { /** * @inheritDoc */ -_ol_interaction_PinchZoom_.prototype.shouldStopEvent = FALSE; -export default _ol_interaction_PinchZoom_; +PinchZoom.prototype.shouldStopEvent = FALSE; +export default PinchZoom; diff --git a/test/spec/ol/map.test.js b/test/spec/ol/map.test.js index 07b8342cf1..76935e882e 100644 --- a/test/spec/ol/map.test.js +++ b/test/spec/ol/map.test.js @@ -9,7 +9,7 @@ import {defaults as defaultInteractions} from '../../../src/ol/interaction.js'; import DoubleClickZoom from '../../../src/ol/interaction/DoubleClickZoom.js'; import Interaction from '../../../src/ol/interaction/Interaction.js'; import MouseWheelZoom from '../../../src/ol/interaction/MouseWheelZoom.js'; -import _ol_interaction_PinchZoom_ from '../../../src/ol/interaction/PinchZoom.js'; +import PinchZoom from '../../../src/ol/interaction/PinchZoom.js'; import TileLayer from '../../../src/ol/layer/Tile.js'; import VectorLayer from '../../../src/ol/layer/Vector.js'; import _ol_renderer_canvas_IntermediateCanvas_ from '../../../src/ol/renderer/canvas/IntermediateCanvas.js'; @@ -509,7 +509,7 @@ describe('ol.Map', function() { options.pinchZoom = true; var interactions = defaultInteractions(options); expect(interactions.getLength()).to.eql(1); - expect(interactions.item(0)).to.be.a(_ol_interaction_PinchZoom_); + expect(interactions.item(0)).to.be.a(PinchZoom); expect(interactions.item(0).constrainResolution_).to.eql(false); }); }); @@ -521,7 +521,7 @@ describe('ol.Map', function() { options.constrainResolution = true; var interactions = defaultInteractions(options); expect(interactions.getLength()).to.eql(2); - expect(interactions.item(0)).to.be.a(_ol_interaction_PinchZoom_); + expect(interactions.item(0)).to.be.a(PinchZoom); expect(interactions.item(0).constrainResolution_).to.eql(true); expect(interactions.item(1)).to.be.a(MouseWheelZoom); expect(interactions.item(1).constrainResolution_).to.eql(true);