From f23590a4799fa6b82bc7ba69914582519ed32c43 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Sun, 17 Dec 2017 19:02:17 +0100 Subject: [PATCH] Named export for ol/interaction --- examples/custom-interactions.js | 4 ++-- examples/drag-and-drop-image-vector.js | 4 ++-- examples/drag-and-drop.js | 4 ++-- examples/drag-rotate-and-zoom.js | 4 ++-- examples/earthquake-clusters.js | 4 ++-- examples/full-screen-drag-rotate-and-zoom.js | 4 ++-- examples/modify-features.js | 4 ++-- examples/modify-test.js | 4 ++-- examples/mousewheel-zoom.js | 4 ++-- examples/overviewmap-custom.js | 4 ++-- examples/pinch-zoom.js | 4 ++-- examples/translate-features.js | 4 ++-- examples/vector-esri-edit.js | 4 ++-- src/ol/CanvasMap.js | 4 ++-- src/ol/Map.js | 4 ++-- src/ol/interaction.js | 6 ++---- test/spec/ol/map.test.js | 12 ++++++------ 17 files changed, 38 insertions(+), 40 deletions(-) diff --git a/examples/custom-interactions.js b/examples/custom-interactions.js index 9848ce2028..c3ba857f38 100644 --- a/examples/custom-interactions.js +++ b/examples/custom-interactions.js @@ -5,7 +5,7 @@ import _ol_View_ from '../src/ol/View.js'; import LineString from '../src/ol/geom/LineString.js'; import Point from '../src/ol/geom/Point.js'; import Polygon from '../src/ol/geom/Polygon.js'; -import _ol_interaction_ from '../src/ol/interaction.js'; +import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import _ol_interaction_Pointer_ from '../src/ol/interaction/Pointer.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; @@ -145,7 +145,7 @@ var polygonFeature = new _ol_Feature_( var map = new _ol_Map_({ - interactions: _ol_interaction_.defaults().extend([new app.Drag()]), + interactions: defaultInteractions().extend([new app.Drag()]), layers: [ new _ol_layer_Tile_({ source: new _ol_source_TileJSON_({ diff --git a/examples/drag-and-drop-image-vector.js b/examples/drag-and-drop-image-vector.js index 683bfa987b..c4a1588e17 100644 --- a/examples/drag-and-drop-image-vector.js +++ b/examples/drag-and-drop-image-vector.js @@ -5,7 +5,7 @@ import GeoJSON from '../src/ol/format/GeoJSON.js'; import IGC from '../src/ol/format/IGC.js'; import KML from '../src/ol/format/KML.js'; import TopoJSON from '../src/ol/format/TopoJSON.js'; -import _ol_interaction_ from '../src/ol/interaction.js'; +import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import DragAndDrop from '../src/ol/interaction/DragAndDrop.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; @@ -94,7 +94,7 @@ var dragAndDropInteraction = new DragAndDrop({ }); var map = new _ol_Map_({ - interactions: _ol_interaction_.defaults().extend([dragAndDropInteraction]), + interactions: defaultInteractions().extend([dragAndDropInteraction]), layers: [ new _ol_layer_Tile_({ source: new _ol_source_BingMaps_({ diff --git a/examples/drag-and-drop.js b/examples/drag-and-drop.js index 7b92870ef4..d66526e0c6 100644 --- a/examples/drag-and-drop.js +++ b/examples/drag-and-drop.js @@ -5,7 +5,7 @@ import GeoJSON from '../src/ol/format/GeoJSON.js'; import IGC from '../src/ol/format/IGC.js'; import KML from '../src/ol/format/KML.js'; import TopoJSON from '../src/ol/format/TopoJSON.js'; -import _ol_interaction_ from '../src/ol/interaction.js'; +import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import DragAndDrop from '../src/ol/interaction/DragAndDrop.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; @@ -94,7 +94,7 @@ var dragAndDropInteraction = new DragAndDrop({ }); var map = new _ol_Map_({ - interactions: _ol_interaction_.defaults().extend([dragAndDropInteraction]), + interactions: defaultInteractions().extend([dragAndDropInteraction]), layers: [ new _ol_layer_Tile_({ source: new _ol_source_BingMaps_({ diff --git a/examples/drag-rotate-and-zoom.js b/examples/drag-rotate-and-zoom.js index f58717bc7b..fb5d78b749 100644 --- a/examples/drag-rotate-and-zoom.js +++ b/examples/drag-rotate-and-zoom.js @@ -1,13 +1,13 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_interaction_ from '../src/ol/interaction.js'; +import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import DragRotateAndZoom from '../src/ol/interaction/DragRotateAndZoom.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js'; var map = new _ol_Map_({ - interactions: _ol_interaction_.defaults().extend([ + interactions: defaultInteractions().extend([ new DragRotateAndZoom() ]), layers: [ diff --git a/examples/earthquake-clusters.js b/examples/earthquake-clusters.js index 7296bbfe62..d91525ab9d 100644 --- a/examples/earthquake-clusters.js +++ b/examples/earthquake-clusters.js @@ -2,7 +2,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import * as _ol_extent_ from '../src/ol/extent.js'; import KML from '../src/ol/format/KML.js'; -import _ol_interaction_ from '../src/ol/interaction.js'; +import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; @@ -142,7 +142,7 @@ var raster = new _ol_layer_Tile_({ var map = new _ol_Map_({ layers: [raster, vector], - interactions: _ol_interaction_.defaults().extend([new _ol_interaction_Select_({ + interactions: defaultInteractions().extend([new _ol_interaction_Select_({ condition: function(evt) { return evt.type == 'pointermove' || evt.type == 'singleclick'; diff --git a/examples/full-screen-drag-rotate-and-zoom.js b/examples/full-screen-drag-rotate-and-zoom.js index e0fef69336..6590316db3 100644 --- a/examples/full-screen-drag-rotate-and-zoom.js +++ b/examples/full-screen-drag-rotate-and-zoom.js @@ -2,7 +2,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import FullScreen from '../src/ol/control/FullScreen.js'; -import _ol_interaction_ from '../src/ol/interaction.js'; +import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import DragRotateAndZoom from '../src/ol/interaction/DragRotateAndZoom.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; @@ -12,7 +12,7 @@ var map = new _ol_Map_({ controls: defaultControls().extend([ new FullScreen() ]), - interactions: _ol_interaction_.defaults().extend([ + interactions: defaultInteractions().extend([ new DragRotateAndZoom() ]), layers: [ diff --git a/examples/modify-features.js b/examples/modify-features.js index d03a795b1d..1e9cb7160a 100644 --- a/examples/modify-features.js +++ b/examples/modify-features.js @@ -1,7 +1,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; -import _ol_interaction_ from '../src/ol/interaction.js'; +import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; @@ -31,7 +31,7 @@ var modify = new _ol_interaction_Modify_({ }); var map = new _ol_Map_({ - interactions: _ol_interaction_.defaults().extend([select, modify]), + interactions: defaultInteractions().extend([select, modify]), layers: [raster, vector], target: 'map', view: new _ol_View_({ diff --git a/examples/modify-test.js b/examples/modify-test.js index a9002fa77b..787ef8c2b4 100644 --- a/examples/modify-test.js +++ b/examples/modify-test.js @@ -1,7 +1,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; -import _ol_interaction_ from '../src/ol/interaction.js'; +import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; @@ -232,7 +232,7 @@ var modify = new _ol_interaction_Modify_({ }); var map = new _ol_Map_({ - interactions: _ol_interaction_.defaults().extend([select, modify]), + interactions: defaultInteractions().extend([select, modify]), layers: [layer], target: 'map', view: new _ol_View_({ diff --git a/examples/mousewheel-zoom.js b/examples/mousewheel-zoom.js index 7788700e5a..57cdd565c1 100644 --- a/examples/mousewheel-zoom.js +++ b/examples/mousewheel-zoom.js @@ -1,13 +1,13 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_interaction_ from '../src/ol/interaction.js'; +import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import _ol_interaction_MouseWheelZoom_ from '../src/ol/interaction/MouseWheelZoom.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js'; var map = new _ol_Map_({ - interactions: _ol_interaction_.defaults({mouseWheelZoom: false}).extend([ + interactions: defaultInteractions({mouseWheelZoom: false}).extend([ new _ol_interaction_MouseWheelZoom_({ constrainResolution: true // force zooming to a integer zoom }) diff --git a/examples/overviewmap-custom.js b/examples/overviewmap-custom.js index b7c5d8ed79..57628698d2 100644 --- a/examples/overviewmap-custom.js +++ b/examples/overviewmap-custom.js @@ -2,7 +2,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import OverviewMap from '../src/ol/control/OverviewMap.js'; -import _ol_interaction_ from '../src/ol/interaction.js'; +import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import DragRotateAndZoom from '../src/ol/interaction/DragRotateAndZoom.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js'; @@ -28,7 +28,7 @@ var map = new _ol_Map_({ controls: defaultControls().extend([ overviewMapControl ]), - interactions: _ol_interaction_.defaults().extend([ + interactions: defaultInteractions().extend([ new DragRotateAndZoom() ]), layers: [ diff --git a/examples/pinch-zoom.js b/examples/pinch-zoom.js index 83f512b732..efff493faf 100644 --- a/examples/pinch-zoom.js +++ b/examples/pinch-zoom.js @@ -1,13 +1,13 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_interaction_ from '../src/ol/interaction.js'; +import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import _ol_interaction_PinchZoom_ from '../src/ol/interaction/PinchZoom.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js'; var map = new _ol_Map_({ - interactions: _ol_interaction_.defaults({pinchZoom: false}).extend([ + interactions: defaultInteractions({pinchZoom: false}).extend([ new _ol_interaction_PinchZoom_({ constrainResolution: true // force zooming to a integer zoom }) diff --git a/examples/translate-features.js b/examples/translate-features.js index 23d8d50ec9..7bef304ccf 100644 --- a/examples/translate-features.js +++ b/examples/translate-features.js @@ -1,7 +1,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; -import _ol_interaction_ from '../src/ol/interaction.js'; +import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_interaction_Translate_ from '../src/ol/interaction/Translate.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; @@ -28,7 +28,7 @@ var translate = new _ol_interaction_Translate_({ }); var map = new _ol_Map_({ - interactions: _ol_interaction_.defaults().extend([select, translate]), + interactions: defaultInteractions().extend([select, translate]), layers: [raster, vector], target: 'map', view: new _ol_View_({ diff --git a/examples/vector-esri-edit.js b/examples/vector-esri-edit.js index 8525e7272f..325d43d123 100644 --- a/examples/vector-esri-edit.js +++ b/examples/vector-esri-edit.js @@ -1,7 +1,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import EsriJSON from '../src/ol/format/EsriJSON.js'; -import _ol_interaction_ from '../src/ol/interaction.js'; +import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import Draw from '../src/ol/interaction/Draw.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; @@ -77,7 +77,7 @@ var modify = new _ol_interaction_Modify_({ modify.setActive(false); var map = new _ol_Map_({ - interactions: _ol_interaction_.defaults().extend([draw, select, modify]), + interactions: defaultInteractions().extend([draw, select, modify]), layers: [raster, vector], target: document.getElementById('map'), view: new _ol_View_({ diff --git a/src/ol/CanvasMap.js b/src/ol/CanvasMap.js index 5795d9ff8c..9b4b786ce5 100644 --- a/src/ol/CanvasMap.js +++ b/src/ol/CanvasMap.js @@ -5,7 +5,7 @@ import {inherits} from './index.js'; import _ol_PluggableMap_ from './PluggableMap.js'; import _ol_PluginType_ from './PluginType.js'; import {defaults as defaultControls} from './control.js'; -import _ol_interaction_ from './interaction.js'; +import {defaults as defaultInteractions} from './interaction.js'; import _ol_obj_ from './obj.js'; import _ol_plugins_ from './plugins.js'; import _ol_renderer_canvas_ImageLayer_ from './renderer/canvas/ImageLayer.js'; @@ -79,7 +79,7 @@ var _ol_CanvasMap_ = function(options) { options.controls = defaultControls(); } if (!options.interactions) { - options.interactions = _ol_interaction_.defaults(); + options.interactions = defaultInteractions(); } _ol_PluggableMap_.call(this, options); diff --git a/src/ol/Map.js b/src/ol/Map.js index 176201f6d3..99e1b31c82 100644 --- a/src/ol/Map.js +++ b/src/ol/Map.js @@ -5,7 +5,7 @@ import {inherits} from './index.js'; import _ol_PluggableMap_ from './PluggableMap.js'; import _ol_PluginType_ from './PluginType.js'; import {defaults as defaultControls} from './control.js'; -import _ol_interaction_ from './interaction.js'; +import {defaults as defaultInteractions} from './interaction.js'; import _ol_obj_ from './obj.js'; import _ol_plugins_ from './plugins.js'; import _ol_renderer_canvas_ImageLayer_ from './renderer/canvas/ImageLayer.js'; @@ -90,7 +90,7 @@ var _ol_Map_ = function(options) { options.controls = defaultControls(); } if (!options.interactions) { - options.interactions = _ol_interaction_.defaults(); + options.interactions = defaultInteractions(); } _ol_PluggableMap_.call(this, options); diff --git a/src/ol/interaction.js b/src/ol/interaction.js index 5cfe6956b3..5fd30520fd 100644 --- a/src/ol/interaction.js +++ b/src/ol/interaction.js @@ -12,7 +12,6 @@ import _ol_interaction_KeyboardZoom_ from './interaction/KeyboardZoom.js'; import _ol_interaction_MouseWheelZoom_ from './interaction/MouseWheelZoom.js'; import _ol_interaction_PinchRotate_ from './interaction/PinchRotate.js'; import _ol_interaction_PinchZoom_ from './interaction/PinchZoom.js'; -var _ol_interaction_ = {}; /** @@ -38,7 +37,7 @@ var _ol_interaction_ = {}; * interactions to be used with the ol.Map constructor's interactions option. * @api */ -_ol_interaction_.defaults = function(opt_options) { +export function defaults(opt_options) { var options = opt_options ? opt_options : {}; @@ -110,5 +109,4 @@ _ol_interaction_.defaults = function(opt_options) { return interactions; -}; -export default _ol_interaction_; +} diff --git a/test/spec/ol/map.test.js b/test/spec/ol/map.test.js index 00f2b3f89e..fade1f14ac 100644 --- a/test/spec/ol/map.test.js +++ b/test/spec/ol/map.test.js @@ -5,7 +5,7 @@ import _ol_Overlay_ from '../../../src/ol/Overlay.js'; import _ol_View_ from '../../../src/ol/View.js'; import Point from '../../../src/ol/geom/Point.js'; import _ol_has_ from '../../../src/ol/has.js'; -import _ol_interaction_ from '../../../src/ol/interaction.js'; +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 _ol_interaction_MouseWheelZoom_ from '../../../src/ol/interaction/MouseWheelZoom.js'; @@ -480,7 +480,7 @@ describe('ol.Map', function() { describe('create mousewheel interaction', function() { it('creates mousewheel interaction', function() { options.mouseWheelZoom = true; - var interactions = _ol_interaction_.defaults(options); + var interactions = defaultInteractions(options); expect(interactions.getLength()).to.eql(1); expect(interactions.item(0)).to.be.a(_ol_interaction_MouseWheelZoom_); expect(interactions.item(0).constrainResolution_).to.eql(false); @@ -493,7 +493,7 @@ describe('ol.Map', function() { describe('create pinchZoom interaction', function() { it('creates pinchZoom interaction', function() { options.pinchZoom = true; - var interactions = _ol_interaction_.defaults(options); + var interactions = defaultInteractions(options); expect(interactions.getLength()).to.eql(1); expect(interactions.item(0)).to.be.a(_ol_interaction_PinchZoom_); expect(interactions.item(0).constrainResolution_).to.eql(false); @@ -505,7 +505,7 @@ describe('ol.Map', function() { options.pinchZoom = true; options.mouseWheelZoom = true; options.constrainResolution = true; - var interactions = _ol_interaction_.defaults(options); + var interactions = defaultInteractions(options); expect(interactions.getLength()).to.eql(2); expect(interactions.item(0)).to.be.a(_ol_interaction_PinchZoom_); expect(interactions.item(0).constrainResolution_).to.eql(true); @@ -522,7 +522,7 @@ describe('ol.Map', function() { describe('default zoomDelta', function() { it('create double click interaction with default delta', function() { - var interactions = _ol_interaction_.defaults(options); + var interactions = defaultInteractions(options); expect(interactions.getLength()).to.eql(1); expect(interactions.item(0)).to.be.a(DoubleClickZoom); expect(interactions.item(0).delta_).to.eql(1); @@ -532,7 +532,7 @@ describe('ol.Map', function() { describe('set zoomDelta', function() { it('create double click interaction with set delta', function() { options.zoomDelta = 7; - var interactions = _ol_interaction_.defaults(options); + var interactions = defaultInteractions(options); expect(interactions.getLength()).to.eql(1); expect(interactions.item(0)).to.be.a(DoubleClickZoom); expect(interactions.item(0).delta_).to.eql(7);