Named export for ol/interaction

This commit is contained in:
Frederic Junod
2017-12-17 19:02:17 +01:00
parent da67764437
commit f23590a479
17 changed files with 38 additions and 40 deletions

View File

@@ -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_({

View File

@@ -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_({

View File

@@ -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_({

View File

@@ -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: [

View File

@@ -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';

View File

@@ -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: [

View File

@@ -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_({

View File

@@ -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_({

View File

@@ -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
})

View File

@@ -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: [

View File

@@ -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
})

View File

@@ -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_({

View File

@@ -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_({

View File

@@ -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);

View File

@@ -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);

View File

@@ -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_;
}

View File

@@ -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);