Merge pull request #7607 from tschaub/rename-interaction-variables

Rename interaction variables
This commit is contained in:
Tim Schaub
2017-12-15 10:02:39 -07:00
committed by GitHub
43 changed files with 338 additions and 332 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_events_condition_ from '../src/ol/events/condition.js'; import _ol_events_condition_ from '../src/ol/events/condition.js';
import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js';
import _ol_interaction_DragBox_ from '../src/ol/interaction/DragBox.js'; import DragBox from '../src/ol/interaction/DragBox.js';
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
@@ -39,7 +39,7 @@ map.addInteraction(select);
var selectedFeatures = select.getFeatures(); var selectedFeatures = select.getFeatures();
// a DragBox interaction used to select features by drawing boxes // a DragBox interaction used to select features by drawing boxes
var dragBox = new _ol_interaction_DragBox_({ var dragBox = new DragBox({
condition: _ol_events_condition_.platformModifierKeyOnly condition: _ol_events_condition_.platformModifierKeyOnly
}); });
+2 -2
View File
@@ -6,7 +6,7 @@ import _ol_format_IGC_ from '../src/ol/format/IGC.js';
import _ol_format_KML_ from '../src/ol/format/KML.js'; import _ol_format_KML_ from '../src/ol/format/KML.js';
import _ol_format_TopoJSON_ from '../src/ol/format/TopoJSON.js'; import _ol_format_TopoJSON_ from '../src/ol/format/TopoJSON.js';
import _ol_interaction_ from '../src/ol/interaction.js'; import _ol_interaction_ from '../src/ol/interaction.js';
import _ol_interaction_DragAndDrop_ from '../src/ol/interaction/DragAndDrop.js'; import DragAndDrop from '../src/ol/interaction/DragAndDrop.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js';
@@ -83,7 +83,7 @@ var styleFunction = function(feature, resolution) {
} }
}; };
var dragAndDropInteraction = new _ol_interaction_DragAndDrop_({ var dragAndDropInteraction = new DragAndDrop({
formatConstructors: [ formatConstructors: [
_ol_format_GPX_, _ol_format_GPX_,
_ol_format_GeoJSON_, _ol_format_GeoJSON_,
+2 -2
View File
@@ -6,7 +6,7 @@ import _ol_format_IGC_ from '../src/ol/format/IGC.js';
import _ol_format_KML_ from '../src/ol/format/KML.js'; import _ol_format_KML_ from '../src/ol/format/KML.js';
import _ol_format_TopoJSON_ from '../src/ol/format/TopoJSON.js'; import _ol_format_TopoJSON_ from '../src/ol/format/TopoJSON.js';
import _ol_interaction_ from '../src/ol/interaction.js'; import _ol_interaction_ from '../src/ol/interaction.js';
import _ol_interaction_DragAndDrop_ from '../src/ol/interaction/DragAndDrop.js'; import DragAndDrop from '../src/ol/interaction/DragAndDrop.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js';
@@ -83,7 +83,7 @@ var styleFunction = function(feature, resolution) {
} }
}; };
var dragAndDropInteraction = new _ol_interaction_DragAndDrop_({ var dragAndDropInteraction = new DragAndDrop({
formatConstructors: [ formatConstructors: [
_ol_format_GPX_, _ol_format_GPX_,
_ol_format_GeoJSON_, _ol_format_GeoJSON_,
+2 -2
View File
@@ -1,14 +1,14 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_interaction_ from '../src/ol/interaction.js'; import _ol_interaction_ from '../src/ol/interaction.js';
import _ol_interaction_DragRotateAndZoom_ from '../src/ol/interaction/DragRotateAndZoom.js'; import DragRotateAndZoom from '../src/ol/interaction/DragRotateAndZoom.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js';
var map = new _ol_Map_({ var map = new _ol_Map_({
interactions: _ol_interaction_.defaults().extend([ interactions: _ol_interaction_.defaults().extend([
new _ol_interaction_DragRotateAndZoom_() new DragRotateAndZoom()
]), ]),
layers: [ layers: [
new _ol_layer_Tile_({ new _ol_layer_Tile_({
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js'; import Draw from '../src/ol/interaction/Draw.js';
import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js';
import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js'; import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
@@ -52,7 +52,7 @@ var draw, snap; // global so we can remove them later
var typeSelect = document.getElementById('type'); var typeSelect = document.getElementById('type');
function addInteractions() { function addInteractions() {
draw = new _ol_interaction_Draw_({ draw = new Draw({
source: source, source: source,
type: typeSelect.value type: typeSelect.value
}); });
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js'; import Draw from '../src/ol/interaction/Draw.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js';
@@ -31,7 +31,7 @@ var draw; // global so we can remove it later
function addInteraction() { function addInteraction() {
var value = typeSelect.value; var value = typeSelect.value;
if (value !== 'None') { if (value !== 'None') {
draw = new _ol_interaction_Draw_({ draw = new Draw({
source: source, source: source,
type: typeSelect.value type: typeSelect.value
}); });
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js'; import Draw from '../src/ol/interaction/Draw.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js';
@@ -31,7 +31,7 @@ var draw; // global so we can remove it later
function addInteraction() { function addInteraction() {
var value = typeSelect.value; var value = typeSelect.value;
if (value !== 'None') { if (value !== 'None') {
draw = new _ol_interaction_Draw_({ draw = new Draw({
source: source, source: source,
type: typeSelect.value, type: typeSelect.value,
freehand: true freehand: true
+4 -4
View File
@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import Polygon from '../src/ol/geom/Polygon.js'; import Polygon from '../src/ol/geom/Polygon.js';
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js'; import Draw from '../src/ol/interaction/Draw.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js';
@@ -35,10 +35,10 @@ function addInteraction() {
var geometryFunction; var geometryFunction;
if (value === 'Square') { if (value === 'Square') {
value = 'Circle'; value = 'Circle';
geometryFunction = _ol_interaction_Draw_.createRegularPolygon(4); geometryFunction = Draw.createRegularPolygon(4);
} else if (value === 'Box') { } else if (value === 'Box') {
value = 'Circle'; value = 'Circle';
geometryFunction = _ol_interaction_Draw_.createBox(); geometryFunction = Draw.createBox();
} else if (value === 'Star') { } else if (value === 'Star') {
value = 'Circle'; value = 'Circle';
geometryFunction = function(coordinates, geometry) { geometryFunction = function(coordinates, geometry) {
@@ -65,7 +65,7 @@ function addInteraction() {
return geometry; return geometry;
}; };
} }
draw = new _ol_interaction_Draw_({ draw = new Draw({
source: source, source: source,
type: value, type: value,
geometryFunction: geometryFunction geometryFunction: geometryFunction
+2 -2
View File
@@ -3,7 +3,7 @@ import _ol_View_ from '../src/ol/View.js';
import _ol_control_ from '../src/ol/control.js'; import _ol_control_ from '../src/ol/control.js';
import FullScreen from '../src/ol/control/FullScreen.js'; import FullScreen from '../src/ol/control/FullScreen.js';
import _ol_interaction_ from '../src/ol/interaction.js'; import _ol_interaction_ from '../src/ol/interaction.js';
import _ol_interaction_DragRotateAndZoom_ from '../src/ol/interaction/DragRotateAndZoom.js'; import DragRotateAndZoom from '../src/ol/interaction/DragRotateAndZoom.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js';
@@ -13,7 +13,7 @@ var map = new _ol_Map_({
new FullScreen() new FullScreen()
]), ]),
interactions: _ol_interaction_.defaults().extend([ interactions: _ol_interaction_.defaults().extend([
new _ol_interaction_DragRotateAndZoom_() new DragRotateAndZoom()
]), ]),
layers: [ layers: [
new _ol_layer_Tile_({ new _ol_layer_Tile_({
+2 -2
View File
@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import Point from '../src/ol/geom/Point.js'; import Point from '../src/ol/geom/Point.js';
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js'; import Draw from '../src/ol/interaction/Draw.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js';
@@ -60,7 +60,7 @@ var map = new _ol_Map_({
}) })
}); });
map.addInteraction(new _ol_interaction_Draw_({ map.addInteraction(new Draw({
source: source, source: source,
type: 'LineString' type: 'LineString'
})); }));
+2 -2
View File
@@ -5,7 +5,7 @@ import _ol_Sphere_ from '../src/ol/Sphere.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import LineString from '../src/ol/geom/LineString.js'; import LineString from '../src/ol/geom/LineString.js';
import Polygon from '../src/ol/geom/Polygon.js'; import Polygon from '../src/ol/geom/Polygon.js';
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js'; import Draw from '../src/ol/interaction/Draw.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js';
@@ -177,7 +177,7 @@ var formatArea = function(polygon) {
function addInteraction() { function addInteraction() {
var type = (typeSelect.value == 'area' ? 'Polygon' : 'LineString'); var type = (typeSelect.value == 'area' ? 'Polygon' : 'LineString');
draw = new _ol_interaction_Draw_({ draw = new Draw({
source: source, source: source,
type: type, type: type,
style: new _ol_style_Style_({ style: new _ol_style_Style_({
+2 -2
View File
@@ -3,7 +3,7 @@ import _ol_View_ from '../src/ol/View.js';
import _ol_control_ from '../src/ol/control.js'; import _ol_control_ from '../src/ol/control.js';
import OverviewMap from '../src/ol/control/OverviewMap.js'; import OverviewMap from '../src/ol/control/OverviewMap.js';
import _ol_interaction_ from '../src/ol/interaction.js'; import _ol_interaction_ from '../src/ol/interaction.js';
import _ol_interaction_DragRotateAndZoom_ from '../src/ol/interaction/DragRotateAndZoom.js'; import DragRotateAndZoom from '../src/ol/interaction/DragRotateAndZoom.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js';
@@ -29,7 +29,7 @@ var map = new _ol_Map_({
overviewMapControl overviewMapControl
]), ]),
interactions: _ol_interaction_.defaults().extend([ interactions: _ol_interaction_.defaults().extend([
new _ol_interaction_DragRotateAndZoom_() new DragRotateAndZoom()
]), ]),
layers: [ layers: [
new _ol_layer_Tile_({ new _ol_layer_Tile_({
+7 -7
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js'; import Draw from '../src/ol/interaction/Draw.js';
import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js';
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js'; import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js';
@@ -73,7 +73,7 @@ Modify.init();
var optionsForm = document.getElementById('options-form'); var optionsForm = document.getElementById('options-form');
var Draw = { var ExampleDraw = {
init: function() { init: function() {
map.addInteraction(this.Point); map.addInteraction(this.Point);
this.Point.setActive(false); this.Point.setActive(false);
@@ -84,19 +84,19 @@ var Draw = {
map.addInteraction(this.Circle); map.addInteraction(this.Circle);
this.Circle.setActive(false); this.Circle.setActive(false);
}, },
Point: new _ol_interaction_Draw_({ Point: new Draw({
source: vector.getSource(), source: vector.getSource(),
type: 'Point' type: 'Point'
}), }),
LineString: new _ol_interaction_Draw_({ LineString: new Draw({
source: vector.getSource(), source: vector.getSource(),
type: 'LineString' type: 'LineString'
}), }),
Polygon: new _ol_interaction_Draw_({ Polygon: new Draw({
source: vector.getSource(), source: vector.getSource(),
type: 'Polygon' type: 'Polygon'
}), }),
Circle: new _ol_interaction_Draw_({ Circle: new Draw({
source: vector.getSource(), source: vector.getSource(),
type: 'Circle' type: 'Circle'
}), }),
@@ -115,7 +115,7 @@ var Draw = {
} }
} }
}; };
Draw.init(); ExampleDraw.init();
/** /**
+2 -2
View File
@@ -7,7 +7,7 @@ import _ol_View_ from '../src/ol/View.js';
import Point from '../src/ol/geom/Point.js'; import Point from '../src/ol/geom/Point.js';
import LineString from '../src/ol/geom/LineString.js'; import LineString from '../src/ol/geom/LineString.js';
import Polygon from '../src/ol/geom/Polygon.js'; import Polygon from '../src/ol/geom/Polygon.js';
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js'; import Draw from '../src/ol/interaction/Draw.js';
import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js'; import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
@@ -204,7 +204,7 @@ function onDrawend(e) {
} }
} }
var draw = new _ol_interaction_Draw_({ var draw = new Draw({
type: 'LineString' type: 'LineString'
}); });
draw.on('drawend', onDrawend); draw.on('drawend', onDrawend);
+2 -2
View File
@@ -2,7 +2,7 @@ import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_format_EsriJSON_ from '../src/ol/format/EsriJSON.js'; import _ol_format_EsriJSON_ from '../src/ol/format/EsriJSON.js';
import _ol_interaction_ from '../src/ol/interaction.js'; import _ol_interaction_ from '../src/ol/interaction.js';
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js'; import Draw from '../src/ol/interaction/Draw.js';
import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js';
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
@@ -62,7 +62,7 @@ var raster = new _ol_layer_Tile_({
}) })
}); });
var draw = new _ol_interaction_Draw_({ var draw = new Draw({
source: vectorSource, source: vectorSource,
type: 'Polygon' type: 'Polygon'
}); });
+8 -8
View File
@@ -3,10 +3,10 @@
*/ */
import _ol_Collection_ from './Collection.js'; import _ol_Collection_ from './Collection.js';
import _ol_Kinetic_ from './Kinetic.js'; import _ol_Kinetic_ from './Kinetic.js';
import _ol_interaction_DoubleClickZoom_ from './interaction/DoubleClickZoom.js'; import DoubleClickZoom from './interaction/DoubleClickZoom.js';
import _ol_interaction_DragPan_ from './interaction/DragPan.js'; import DragPan from './interaction/DragPan.js';
import _ol_interaction_DragRotate_ from './interaction/DragRotate.js'; import DragRotate from './interaction/DragRotate.js';
import _ol_interaction_DragZoom_ from './interaction/DragZoom.js'; import DragZoom from './interaction/DragZoom.js';
import _ol_interaction_KeyboardPan_ from './interaction/KeyboardPan.js'; import _ol_interaction_KeyboardPan_ from './interaction/KeyboardPan.js';
import _ol_interaction_KeyboardZoom_ from './interaction/KeyboardZoom.js'; import _ol_interaction_KeyboardZoom_ from './interaction/KeyboardZoom.js';
import _ol_interaction_MouseWheelZoom_ from './interaction/MouseWheelZoom.js'; import _ol_interaction_MouseWheelZoom_ from './interaction/MouseWheelZoom.js';
@@ -49,13 +49,13 @@ _ol_interaction_.defaults = function(opt_options) {
var altShiftDragRotate = options.altShiftDragRotate !== undefined ? var altShiftDragRotate = options.altShiftDragRotate !== undefined ?
options.altShiftDragRotate : true; options.altShiftDragRotate : true;
if (altShiftDragRotate) { if (altShiftDragRotate) {
interactions.push(new _ol_interaction_DragRotate_()); interactions.push(new DragRotate());
} }
var doubleClickZoom = options.doubleClickZoom !== undefined ? var doubleClickZoom = options.doubleClickZoom !== undefined ?
options.doubleClickZoom : true; options.doubleClickZoom : true;
if (doubleClickZoom) { if (doubleClickZoom) {
interactions.push(new _ol_interaction_DoubleClickZoom_({ interactions.push(new DoubleClickZoom({
delta: options.zoomDelta, delta: options.zoomDelta,
duration: options.zoomDuration duration: options.zoomDuration
})); }));
@@ -63,7 +63,7 @@ _ol_interaction_.defaults = function(opt_options) {
var dragPan = options.dragPan !== undefined ? options.dragPan : true; var dragPan = options.dragPan !== undefined ? options.dragPan : true;
if (dragPan) { if (dragPan) {
interactions.push(new _ol_interaction_DragPan_({ interactions.push(new DragPan({
kinetic: kinetic kinetic: kinetic
})); }));
} }
@@ -103,7 +103,7 @@ _ol_interaction_.defaults = function(opt_options) {
var shiftDragZoom = options.shiftDragZoom !== undefined ? var shiftDragZoom = options.shiftDragZoom !== undefined ?
options.shiftDragZoom : true; options.shiftDragZoom : true;
if (shiftDragZoom) { if (shiftDragZoom) {
interactions.push(new _ol_interaction_DragZoom_({ interactions.push(new DragZoom({
duration: options.zoomDuration duration: options.zoomDuration
})); }));
} }
+8 -8
View File
@@ -3,7 +3,7 @@
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import MapBrowserEventType from '../MapBrowserEventType.js'; import MapBrowserEventType from '../MapBrowserEventType.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js'; import Interaction from '../interaction/Interaction.js';
/** /**
* @classdesc * @classdesc
@@ -14,7 +14,7 @@ import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
* @param {olx.interaction.DoubleClickZoomOptions=} opt_options Options. * @param {olx.interaction.DoubleClickZoomOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_interaction_DoubleClickZoom_ = function(opt_options) { var DoubleClickZoom = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
@@ -24,8 +24,8 @@ var _ol_interaction_DoubleClickZoom_ = function(opt_options) {
*/ */
this.delta_ = options.delta ? options.delta : 1; this.delta_ = options.delta ? options.delta : 1;
_ol_interaction_Interaction_.call(this, { Interaction.call(this, {
handleEvent: _ol_interaction_DoubleClickZoom_.handleEvent handleEvent: DoubleClickZoom.handleEvent
}); });
/** /**
@@ -36,7 +36,7 @@ var _ol_interaction_DoubleClickZoom_ = function(opt_options) {
}; };
inherits(_ol_interaction_DoubleClickZoom_, _ol_interaction_Interaction_); inherits(DoubleClickZoom, Interaction);
/** /**
@@ -47,7 +47,7 @@ inherits(_ol_interaction_DoubleClickZoom_, _ol_interaction_Interaction_);
* @this {ol.interaction.DoubleClickZoom} * @this {ol.interaction.DoubleClickZoom}
* @api * @api
*/ */
_ol_interaction_DoubleClickZoom_.handleEvent = function(mapBrowserEvent) { DoubleClickZoom.handleEvent = function(mapBrowserEvent) {
var stopEvent = false; var stopEvent = false;
var browserEvent = mapBrowserEvent.originalEvent; var browserEvent = mapBrowserEvent.originalEvent;
if (mapBrowserEvent.type == MapBrowserEventType.DBLCLICK) { if (mapBrowserEvent.type == MapBrowserEventType.DBLCLICK) {
@@ -55,11 +55,11 @@ _ol_interaction_DoubleClickZoom_.handleEvent = function(mapBrowserEvent) {
var anchor = mapBrowserEvent.coordinate; var anchor = mapBrowserEvent.coordinate;
var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_; var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
var view = map.getView(); var view = map.getView();
_ol_interaction_Interaction_.zoomByDelta( Interaction.zoomByDelta(
view, delta, anchor, this.duration_); view, delta, anchor, this.duration_);
mapBrowserEvent.preventDefault(); mapBrowserEvent.preventDefault();
stopEvent = true; stopEvent = true;
} }
return !stopEvent; return !stopEvent;
}; };
export default _ol_interaction_DoubleClickZoom_; export default DoubleClickZoom;
+27 -26
View File
@@ -8,7 +8,7 @@ import {TRUE} from '../functions.js';
import _ol_events_ from '../events.js'; import _ol_events_ from '../events.js';
import Event from '../events/Event.js'; import Event from '../events/Event.js';
import EventType from '../events/EventType.js'; import EventType from '../events/EventType.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js'; import Interaction from '../interaction/Interaction.js';
import {get as getProjection} from '../proj.js'; import {get as getProjection} from '../proj.js';
/** /**
@@ -21,12 +21,12 @@ import {get as getProjection} from '../proj.js';
* @param {olx.interaction.DragAndDropOptions=} opt_options Options. * @param {olx.interaction.DragAndDropOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_interaction_DragAndDrop_ = function(opt_options) { var DragAndDrop = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
_ol_interaction_Interaction_.call(this, { Interaction.call(this, {
handleEvent: _ol_interaction_DragAndDrop_.handleEvent handleEvent: DragAndDrop.handleEvent
}); });
/** /**
@@ -63,7 +63,7 @@ var _ol_interaction_DragAndDrop_ = function(opt_options) {
}; };
inherits(_ol_interaction_DragAndDrop_, _ol_interaction_Interaction_); inherits(DragAndDrop, Interaction);
/** /**
@@ -71,7 +71,7 @@ inherits(_ol_interaction_DragAndDrop_, _ol_interaction_Interaction_);
* @this {ol.interaction.DragAndDrop} * @this {ol.interaction.DragAndDrop}
* @private * @private
*/ */
_ol_interaction_DragAndDrop_.handleDrop_ = function(event) { DragAndDrop.handleDrop_ = function(event) {
var files = event.dataTransfer.files; var files = event.dataTransfer.files;
var i, ii, file; var i, ii, file;
for (i = 0, ii = files.length; i < ii; ++i) { for (i = 0, ii = files.length; i < ii; ++i) {
@@ -88,7 +88,7 @@ _ol_interaction_DragAndDrop_.handleDrop_ = function(event) {
* @param {Event} event Event. * @param {Event} event Event.
* @private * @private
*/ */
_ol_interaction_DragAndDrop_.handleStop_ = function(event) { DragAndDrop.handleStop_ = function(event) {
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
event.dataTransfer.dropEffect = 'copy'; event.dataTransfer.dropEffect = 'copy';
@@ -100,7 +100,7 @@ _ol_interaction_DragAndDrop_.handleStop_ = function(event) {
* @param {Event} event Load event. * @param {Event} event Load event.
* @private * @private
*/ */
_ol_interaction_DragAndDrop_.prototype.handleResult_ = function(file, event) { DragAndDrop.prototype.handleResult_ = function(file, event) {
var result = event.target.result; var result = event.target.result;
var map = this.getMap(); var map = this.getMap();
var projection = this.projection_; var projection = this.projection_;
@@ -134,8 +134,8 @@ _ol_interaction_DragAndDrop_.prototype.handleResult_ = function(file, event) {
this.source_.addFeatures(features); this.source_.addFeatures(features);
} }
this.dispatchEvent( this.dispatchEvent(
new _ol_interaction_DragAndDrop_.Event( new DragAndDrop.Event(
_ol_interaction_DragAndDrop_.EventType_.ADD_FEATURES, file, DragAndDrop.EventType_.ADD_FEATURES, file,
features, projection)); features, projection));
}; };
@@ -148,25 +148,25 @@ _ol_interaction_DragAndDrop_.prototype.handleResult_ = function(file, event) {
* @this {ol.interaction.DragAndDrop} * @this {ol.interaction.DragAndDrop}
* @api * @api
*/ */
_ol_interaction_DragAndDrop_.handleEvent = TRUE; DragAndDrop.handleEvent = TRUE;
/** /**
* @private * @private
*/ */
_ol_interaction_DragAndDrop_.prototype.registerListeners_ = function() { DragAndDrop.prototype.registerListeners_ = function() {
var map = this.getMap(); var map = this.getMap();
if (map) { if (map) {
var dropArea = this.target ? this.target : map.getViewport(); var dropArea = this.target ? this.target : map.getViewport();
this.dropListenKeys_ = [ this.dropListenKeys_ = [
_ol_events_.listen(dropArea, EventType.DROP, _ol_events_.listen(dropArea, EventType.DROP,
_ol_interaction_DragAndDrop_.handleDrop_, this), DragAndDrop.handleDrop_, this),
_ol_events_.listen(dropArea, EventType.DRAGENTER, _ol_events_.listen(dropArea, EventType.DRAGENTER,
_ol_interaction_DragAndDrop_.handleStop_, this), DragAndDrop.handleStop_, this),
_ol_events_.listen(dropArea, EventType.DRAGOVER, _ol_events_.listen(dropArea, EventType.DRAGOVER,
_ol_interaction_DragAndDrop_.handleStop_, this), DragAndDrop.handleStop_, this),
_ol_events_.listen(dropArea, EventType.DROP, _ol_events_.listen(dropArea, EventType.DROP,
_ol_interaction_DragAndDrop_.handleStop_, this) DragAndDrop.handleStop_, this)
]; ];
} }
}; };
@@ -175,8 +175,8 @@ _ol_interaction_DragAndDrop_.prototype.registerListeners_ = function() {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_interaction_DragAndDrop_.prototype.setActive = function(active) { DragAndDrop.prototype.setActive = function(active) {
_ol_interaction_Interaction_.prototype.setActive.call(this, active); Interaction.prototype.setActive.call(this, active);
if (active) { if (active) {
this.registerListeners_(); this.registerListeners_();
} else { } else {
@@ -188,9 +188,9 @@ _ol_interaction_DragAndDrop_.prototype.setActive = function(active) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_interaction_DragAndDrop_.prototype.setMap = function(map) { DragAndDrop.prototype.setMap = function(map) {
this.unregisterListeners_(); this.unregisterListeners_();
_ol_interaction_Interaction_.prototype.setMap.call(this, map); Interaction.prototype.setMap.call(this, map);
if (this.getActive()) { if (this.getActive()) {
this.registerListeners_(); this.registerListeners_();
} }
@@ -204,7 +204,7 @@ _ol_interaction_DragAndDrop_.prototype.setMap = function(map) {
* @private * @private
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
*/ */
_ol_interaction_DragAndDrop_.prototype.tryReadFeatures_ = function(format, text, options) { DragAndDrop.prototype.tryReadFeatures_ = function(format, text, options) {
try { try {
return format.readFeatures(text, options); return format.readFeatures(text, options);
} catch (e) { } catch (e) {
@@ -216,7 +216,7 @@ _ol_interaction_DragAndDrop_.prototype.tryReadFeatures_ = function(format, text,
/** /**
* @private * @private
*/ */
_ol_interaction_DragAndDrop_.prototype.unregisterListeners_ = function() { DragAndDrop.prototype.unregisterListeners_ = function() {
if (this.dropListenKeys_) { if (this.dropListenKeys_) {
this.dropListenKeys_.forEach(_ol_events_.unlistenByKey); this.dropListenKeys_.forEach(_ol_events_.unlistenByKey);
this.dropListenKeys_ = null; this.dropListenKeys_ = null;
@@ -228,7 +228,7 @@ _ol_interaction_DragAndDrop_.prototype.unregisterListeners_ = function() {
* @enum {string} * @enum {string}
* @private * @private
*/ */
_ol_interaction_DragAndDrop_.EventType_ = { DragAndDrop.EventType_ = {
/** /**
* Triggered when features are added * Triggered when features are added
* @event ol.interaction.DragAndDrop.Event#addfeatures * @event ol.interaction.DragAndDrop.Event#addfeatures
@@ -251,7 +251,7 @@ _ol_interaction_DragAndDrop_.EventType_ = {
* @param {Array.<ol.Feature>=} opt_features Features. * @param {Array.<ol.Feature>=} opt_features Features.
* @param {ol.proj.Projection=} opt_projection Projection. * @param {ol.proj.Projection=} opt_projection Projection.
*/ */
_ol_interaction_DragAndDrop_.Event = function(type, file, opt_features, opt_projection) { DragAndDrop.Event = function(type, file, opt_features, opt_projection) {
Event.call(this, type); Event.call(this, type);
@@ -277,5 +277,6 @@ _ol_interaction_DragAndDrop_.Event = function(type, file, opt_features, opt_proj
this.projection = opt_projection; this.projection = opt_projection;
}; };
inherits(_ol_interaction_DragAndDrop_.Event, Event); inherits(DragAndDrop.Event, Event);
export default _ol_interaction_DragAndDrop_;
export default DragAndDrop;
+20 -19
View File
@@ -25,12 +25,12 @@ import _ol_render_Box_ from '../render/Box.js';
* @param {olx.interaction.DragBoxOptions=} opt_options Options. * @param {olx.interaction.DragBoxOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_interaction_DragBox_ = function(opt_options) { var DragBox = function(opt_options) {
_ol_interaction_Pointer_.call(this, { _ol_interaction_Pointer_.call(this, {
handleDownEvent: _ol_interaction_DragBox_.handleDownEvent_, handleDownEvent: DragBox.handleDownEvent_,
handleDragEvent: _ol_interaction_DragBox_.handleDragEvent_, handleDragEvent: DragBox.handleDragEvent_,
handleUpEvent: _ol_interaction_DragBox_.handleUpEvent_ handleUpEvent: DragBox.handleUpEvent_
}); });
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
@@ -65,10 +65,10 @@ var _ol_interaction_DragBox_ = function(opt_options) {
* @type {ol.DragBoxEndConditionType} * @type {ol.DragBoxEndConditionType}
*/ */
this.boxEndCondition_ = options.boxEndCondition ? this.boxEndCondition_ = options.boxEndCondition ?
options.boxEndCondition : _ol_interaction_DragBox_.defaultBoxEndCondition; options.boxEndCondition : DragBox.defaultBoxEndCondition;
}; };
inherits(_ol_interaction_DragBox_, _ol_interaction_Pointer_); inherits(DragBox, _ol_interaction_Pointer_);
/** /**
@@ -81,7 +81,7 @@ inherits(_ol_interaction_DragBox_, _ol_interaction_Pointer_);
* @return {boolean} Whether or not the boxend condition should be fired. * @return {boolean} Whether or not the boxend condition should be fired.
* @this {ol.interaction.DragBox} * @this {ol.interaction.DragBox}
*/ */
_ol_interaction_DragBox_.defaultBoxEndCondition = function(mapBrowserEvent, startPixel, endPixel) { DragBox.defaultBoxEndCondition = function(mapBrowserEvent, startPixel, endPixel) {
var width = endPixel[0] - startPixel[0]; var width = endPixel[0] - startPixel[0];
var height = endPixel[1] - startPixel[1]; var height = endPixel[1] - startPixel[1];
return width * width + height * height >= this.minArea_; return width * width + height * height >= this.minArea_;
@@ -93,14 +93,14 @@ _ol_interaction_DragBox_.defaultBoxEndCondition = function(mapBrowserEvent, star
* @this {ol.interaction.DragBox} * @this {ol.interaction.DragBox}
* @private * @private
*/ */
_ol_interaction_DragBox_.handleDragEvent_ = function(mapBrowserEvent) { DragBox.handleDragEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) { if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return; return;
} }
this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel); this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);
this.dispatchEvent(new _ol_interaction_DragBox_.Event(_ol_interaction_DragBox_.EventType_.BOXDRAG, this.dispatchEvent(new DragBox.Event(DragBox.EventType_.BOXDRAG,
mapBrowserEvent.coordinate, mapBrowserEvent)); mapBrowserEvent.coordinate, mapBrowserEvent));
}; };
@@ -110,7 +110,7 @@ _ol_interaction_DragBox_.handleDragEvent_ = function(mapBrowserEvent) {
* @return {ol.geom.Polygon} Geometry. * @return {ol.geom.Polygon} Geometry.
* @api * @api
*/ */
_ol_interaction_DragBox_.prototype.getGeometry = function() { DragBox.prototype.getGeometry = function() {
return this.box_.getGeometry(); return this.box_.getGeometry();
}; };
@@ -121,7 +121,7 @@ _ol_interaction_DragBox_.prototype.getGeometry = function() {
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @protected * @protected
*/ */
_ol_interaction_DragBox_.prototype.onBoxEnd = nullFunction; DragBox.prototype.onBoxEnd = nullFunction;
/** /**
@@ -130,7 +130,7 @@ _ol_interaction_DragBox_.prototype.onBoxEnd = nullFunction;
* @this {ol.interaction.DragBox} * @this {ol.interaction.DragBox}
* @private * @private
*/ */
_ol_interaction_DragBox_.handleUpEvent_ = function(mapBrowserEvent) { DragBox.handleUpEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) { if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return true; return true;
} }
@@ -140,7 +140,7 @@ _ol_interaction_DragBox_.handleUpEvent_ = function(mapBrowserEvent) {
if (this.boxEndCondition_(mapBrowserEvent, if (this.boxEndCondition_(mapBrowserEvent,
this.startPixel_, mapBrowserEvent.pixel)) { this.startPixel_, mapBrowserEvent.pixel)) {
this.onBoxEnd(mapBrowserEvent); this.onBoxEnd(mapBrowserEvent);
this.dispatchEvent(new _ol_interaction_DragBox_.Event(_ol_interaction_DragBox_.EventType_.BOXEND, this.dispatchEvent(new DragBox.Event(DragBox.EventType_.BOXEND,
mapBrowserEvent.coordinate, mapBrowserEvent)); mapBrowserEvent.coordinate, mapBrowserEvent));
} }
return false; return false;
@@ -153,7 +153,7 @@ _ol_interaction_DragBox_.handleUpEvent_ = function(mapBrowserEvent) {
* @this {ol.interaction.DragBox} * @this {ol.interaction.DragBox}
* @private * @private
*/ */
_ol_interaction_DragBox_.handleDownEvent_ = function(mapBrowserEvent) { DragBox.handleDownEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) { if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return false; return false;
} }
@@ -163,7 +163,7 @@ _ol_interaction_DragBox_.handleDownEvent_ = function(mapBrowserEvent) {
this.startPixel_ = mapBrowserEvent.pixel; this.startPixel_ = mapBrowserEvent.pixel;
this.box_.setMap(mapBrowserEvent.map); this.box_.setMap(mapBrowserEvent.map);
this.box_.setPixels(this.startPixel_, this.startPixel_); this.box_.setPixels(this.startPixel_, this.startPixel_);
this.dispatchEvent(new _ol_interaction_DragBox_.Event(_ol_interaction_DragBox_.EventType_.BOXSTART, this.dispatchEvent(new DragBox.Event(DragBox.EventType_.BOXSTART,
mapBrowserEvent.coordinate, mapBrowserEvent)); mapBrowserEvent.coordinate, mapBrowserEvent));
return true; return true;
} else { } else {
@@ -176,7 +176,7 @@ _ol_interaction_DragBox_.handleDownEvent_ = function(mapBrowserEvent) {
* @enum {string} * @enum {string}
* @private * @private
*/ */
_ol_interaction_DragBox_.EventType_ = { DragBox.EventType_ = {
/** /**
* Triggered upon drag box start. * Triggered upon drag box start.
* @event ol.interaction.DragBox.Event#boxstart * @event ol.interaction.DragBox.Event#boxstart
@@ -212,7 +212,7 @@ _ol_interaction_DragBox_.EventType_ = {
* @constructor * @constructor
* @implements {oli.DragBoxEvent} * @implements {oli.DragBoxEvent}
*/ */
_ol_interaction_DragBox_.Event = function(type, coordinate, mapBrowserEvent) { DragBox.Event = function(type, coordinate, mapBrowserEvent) {
Event.call(this, type); Event.call(this, type);
/** /**
@@ -231,5 +231,6 @@ _ol_interaction_DragBox_.Event = function(type, coordinate, mapBrowserEvent) {
this.mapBrowserEvent = mapBrowserEvent; this.mapBrowserEvent = mapBrowserEvent;
}; };
inherits(_ol_interaction_DragBox_.Event, Event); inherits(DragBox.Event, Event);
export default _ol_interaction_DragBox_;
export default DragBox;
+10 -10
View File
@@ -18,12 +18,12 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
* @param {olx.interaction.DragPanOptions=} opt_options Options. * @param {olx.interaction.DragPanOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_interaction_DragPan_ = function(opt_options) { var DragPan = function(opt_options) {
_ol_interaction_Pointer_.call(this, { _ol_interaction_Pointer_.call(this, {
handleDownEvent: _ol_interaction_DragPan_.handleDownEvent_, handleDownEvent: DragPan.handleDownEvent_,
handleDragEvent: _ol_interaction_DragPan_.handleDragEvent_, handleDragEvent: DragPan.handleDragEvent_,
handleUpEvent: _ol_interaction_DragPan_.handleUpEvent_ handleUpEvent: DragPan.handleUpEvent_
}); });
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
@@ -59,7 +59,7 @@ var _ol_interaction_DragPan_ = function(opt_options) {
}; };
inherits(_ol_interaction_DragPan_, _ol_interaction_Pointer_); inherits(DragPan, _ol_interaction_Pointer_);
/** /**
@@ -67,7 +67,7 @@ inherits(_ol_interaction_DragPan_, _ol_interaction_Pointer_);
* @this {ol.interaction.DragPan} * @this {ol.interaction.DragPan}
* @private * @private
*/ */
_ol_interaction_DragPan_.handleDragEvent_ = function(mapBrowserEvent) { DragPan.handleDragEvent_ = function(mapBrowserEvent) {
var targetPointers = this.targetPointers; var targetPointers = this.targetPointers;
var centroid = var centroid =
_ol_interaction_Pointer_.centroid(targetPointers); _ol_interaction_Pointer_.centroid(targetPointers);
@@ -104,7 +104,7 @@ _ol_interaction_DragPan_.handleDragEvent_ = function(mapBrowserEvent) {
* @this {ol.interaction.DragPan} * @this {ol.interaction.DragPan}
* @private * @private
*/ */
_ol_interaction_DragPan_.handleUpEvent_ = function(mapBrowserEvent) { DragPan.handleUpEvent_ = function(mapBrowserEvent) {
var map = mapBrowserEvent.map; var map = mapBrowserEvent.map;
var view = map.getView(); var view = map.getView();
if (this.targetPointers.length === 0) { if (this.targetPointers.length === 0) {
@@ -143,7 +143,7 @@ _ol_interaction_DragPan_.handleUpEvent_ = function(mapBrowserEvent) {
* @this {ol.interaction.DragPan} * @this {ol.interaction.DragPan}
* @private * @private
*/ */
_ol_interaction_DragPan_.handleDownEvent_ = function(mapBrowserEvent) { DragPan.handleDownEvent_ = function(mapBrowserEvent) {
if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) { if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) {
var map = mapBrowserEvent.map; var map = mapBrowserEvent.map;
var view = map.getView(); var view = map.getView();
@@ -171,5 +171,5 @@ _ol_interaction_DragPan_.handleDownEvent_ = function(mapBrowserEvent) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_interaction_DragPan_.prototype.shouldStopEvent = FALSE; DragPan.prototype.shouldStopEvent = FALSE;
export default _ol_interaction_DragPan_; export default DragPan;
+13 -13
View File
@@ -6,7 +6,7 @@ import _ol_RotationConstraint_ from '../RotationConstraint.js';
import _ol_ViewHint_ from '../ViewHint.js'; import _ol_ViewHint_ from '../ViewHint.js';
import _ol_events_condition_ from '../events/condition.js'; import _ol_events_condition_ from '../events/condition.js';
import {FALSE} from '../functions.js'; import {FALSE} from '../functions.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js'; import Interaction from '../interaction/Interaction.js';
import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
/** /**
@@ -22,14 +22,14 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
* @param {olx.interaction.DragRotateOptions=} opt_options Options. * @param {olx.interaction.DragRotateOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_interaction_DragRotate_ = function(opt_options) { var DragRotate = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
_ol_interaction_Pointer_.call(this, { _ol_interaction_Pointer_.call(this, {
handleDownEvent: _ol_interaction_DragRotate_.handleDownEvent_, handleDownEvent: DragRotate.handleDownEvent_,
handleDragEvent: _ol_interaction_DragRotate_.handleDragEvent_, handleDragEvent: DragRotate.handleDragEvent_,
handleUpEvent: _ol_interaction_DragRotate_.handleUpEvent_ handleUpEvent: DragRotate.handleUpEvent_
}); });
/** /**
@@ -52,7 +52,7 @@ var _ol_interaction_DragRotate_ = function(opt_options) {
this.duration_ = options.duration !== undefined ? options.duration : 250; this.duration_ = options.duration !== undefined ? options.duration : 250;
}; };
inherits(_ol_interaction_DragRotate_, _ol_interaction_Pointer_); inherits(DragRotate, _ol_interaction_Pointer_);
/** /**
@@ -60,7 +60,7 @@ inherits(_ol_interaction_DragRotate_, _ol_interaction_Pointer_);
* @this {ol.interaction.DragRotate} * @this {ol.interaction.DragRotate}
* @private * @private
*/ */
_ol_interaction_DragRotate_.handleDragEvent_ = function(mapBrowserEvent) { DragRotate.handleDragEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) { if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return; return;
} }
@@ -77,7 +77,7 @@ _ol_interaction_DragRotate_.handleDragEvent_ = function(mapBrowserEvent) {
if (this.lastAngle_ !== undefined) { if (this.lastAngle_ !== undefined) {
var delta = theta - this.lastAngle_; var delta = theta - this.lastAngle_;
var rotation = view.getRotation(); var rotation = view.getRotation();
_ol_interaction_Interaction_.rotateWithoutConstraints( Interaction.rotateWithoutConstraints(
view, rotation - delta); view, rotation - delta);
} }
this.lastAngle_ = theta; this.lastAngle_ = theta;
@@ -90,7 +90,7 @@ _ol_interaction_DragRotate_.handleDragEvent_ = function(mapBrowserEvent) {
* @this {ol.interaction.DragRotate} * @this {ol.interaction.DragRotate}
* @private * @private
*/ */
_ol_interaction_DragRotate_.handleUpEvent_ = function(mapBrowserEvent) { DragRotate.handleUpEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) { if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return true; return true;
} }
@@ -99,7 +99,7 @@ _ol_interaction_DragRotate_.handleUpEvent_ = function(mapBrowserEvent) {
var view = map.getView(); var view = map.getView();
view.setHint(_ol_ViewHint_.INTERACTING, -1); view.setHint(_ol_ViewHint_.INTERACTING, -1);
var rotation = view.getRotation(); var rotation = view.getRotation();
_ol_interaction_Interaction_.rotate(view, rotation, Interaction.rotate(view, rotation,
undefined, this.duration_); undefined, this.duration_);
return false; return false;
}; };
@@ -111,7 +111,7 @@ _ol_interaction_DragRotate_.handleUpEvent_ = function(mapBrowserEvent) {
* @this {ol.interaction.DragRotate} * @this {ol.interaction.DragRotate}
* @private * @private
*/ */
_ol_interaction_DragRotate_.handleDownEvent_ = function(mapBrowserEvent) { DragRotate.handleDownEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) { if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return false; return false;
} }
@@ -131,5 +131,5 @@ _ol_interaction_DragRotate_.handleDownEvent_ = function(mapBrowserEvent) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_interaction_DragRotate_.prototype.shouldStopEvent = FALSE; DragRotate.prototype.shouldStopEvent = FALSE;
export default _ol_interaction_DragRotate_; export default DragRotate;
+14 -14
View File
@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
import _ol_RotationConstraint_ from '../RotationConstraint.js'; import _ol_RotationConstraint_ from '../RotationConstraint.js';
import _ol_ViewHint_ from '../ViewHint.js'; import _ol_ViewHint_ from '../ViewHint.js';
import _ol_events_condition_ from '../events/condition.js'; import _ol_events_condition_ from '../events/condition.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js'; import Interaction from '../interaction/Interaction.js';
import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
/** /**
@@ -23,14 +23,14 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
* @param {olx.interaction.DragRotateAndZoomOptions=} opt_options Options. * @param {olx.interaction.DragRotateAndZoomOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_interaction_DragRotateAndZoom_ = function(opt_options) { var DragRotateAndZoom = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
_ol_interaction_Pointer_.call(this, { _ol_interaction_Pointer_.call(this, {
handleDownEvent: _ol_interaction_DragRotateAndZoom_.handleDownEvent_, handleDownEvent: DragRotateAndZoom.handleDownEvent_,
handleDragEvent: _ol_interaction_DragRotateAndZoom_.handleDragEvent_, handleDragEvent: DragRotateAndZoom.handleDragEvent_,
handleUpEvent: _ol_interaction_DragRotateAndZoom_.handleUpEvent_ handleUpEvent: DragRotateAndZoom.handleUpEvent_
}); });
/** /**
@@ -66,7 +66,7 @@ var _ol_interaction_DragRotateAndZoom_ = function(opt_options) {
}; };
inherits(_ol_interaction_DragRotateAndZoom_, _ol_interaction_Pointer_); inherits(DragRotateAndZoom, _ol_interaction_Pointer_);
/** /**
@@ -74,7 +74,7 @@ inherits(_ol_interaction_DragRotateAndZoom_, _ol_interaction_Pointer_);
* @this {ol.interaction.DragRotateAndZoom} * @this {ol.interaction.DragRotateAndZoom}
* @private * @private
*/ */
_ol_interaction_DragRotateAndZoom_.handleDragEvent_ = function(mapBrowserEvent) { DragRotateAndZoom.handleDragEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) { if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return; return;
} }
@@ -89,13 +89,13 @@ _ol_interaction_DragRotateAndZoom_.handleDragEvent_ = function(mapBrowserEvent)
var view = map.getView(); var view = map.getView();
if (view.getConstraints().rotation !== _ol_RotationConstraint_.disable && this.lastAngle_ !== undefined) { if (view.getConstraints().rotation !== _ol_RotationConstraint_.disable && this.lastAngle_ !== undefined) {
var angleDelta = theta - this.lastAngle_; var angleDelta = theta - this.lastAngle_;
_ol_interaction_Interaction_.rotateWithoutConstraints( Interaction.rotateWithoutConstraints(
view, view.getRotation() - angleDelta); view, view.getRotation() - angleDelta);
} }
this.lastAngle_ = theta; this.lastAngle_ = theta;
if (this.lastMagnitude_ !== undefined) { if (this.lastMagnitude_ !== undefined) {
var resolution = this.lastMagnitude_ * (view.getResolution() / magnitude); var resolution = this.lastMagnitude_ * (view.getResolution() / magnitude);
_ol_interaction_Interaction_.zoomWithoutConstraints(view, resolution); Interaction.zoomWithoutConstraints(view, resolution);
} }
if (this.lastMagnitude_ !== undefined) { if (this.lastMagnitude_ !== undefined) {
this.lastScaleDelta_ = this.lastMagnitude_ / magnitude; this.lastScaleDelta_ = this.lastMagnitude_ / magnitude;
@@ -110,7 +110,7 @@ _ol_interaction_DragRotateAndZoom_.handleDragEvent_ = function(mapBrowserEvent)
* @this {ol.interaction.DragRotateAndZoom} * @this {ol.interaction.DragRotateAndZoom}
* @private * @private
*/ */
_ol_interaction_DragRotateAndZoom_.handleUpEvent_ = function(mapBrowserEvent) { DragRotateAndZoom.handleUpEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) { if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return true; return true;
} }
@@ -119,8 +119,8 @@ _ol_interaction_DragRotateAndZoom_.handleUpEvent_ = function(mapBrowserEvent) {
var view = map.getView(); var view = map.getView();
view.setHint(_ol_ViewHint_.INTERACTING, -1); view.setHint(_ol_ViewHint_.INTERACTING, -1);
var direction = this.lastScaleDelta_ - 1; var direction = this.lastScaleDelta_ - 1;
_ol_interaction_Interaction_.rotate(view, view.getRotation()); Interaction.rotate(view, view.getRotation());
_ol_interaction_Interaction_.zoom(view, view.getResolution(), Interaction.zoom(view, view.getResolution(),
undefined, this.duration_, direction); undefined, this.duration_, direction);
this.lastScaleDelta_ = 0; this.lastScaleDelta_ = 0;
return false; return false;
@@ -133,7 +133,7 @@ _ol_interaction_DragRotateAndZoom_.handleUpEvent_ = function(mapBrowserEvent) {
* @this {ol.interaction.DragRotateAndZoom} * @this {ol.interaction.DragRotateAndZoom}
* @private * @private
*/ */
_ol_interaction_DragRotateAndZoom_.handleDownEvent_ = function(mapBrowserEvent) { DragRotateAndZoom.handleDownEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) { if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return false; return false;
} }
@@ -147,4 +147,4 @@ _ol_interaction_DragRotateAndZoom_.handleDownEvent_ = function(mapBrowserEvent)
return false; return false;
} }
}; };
export default _ol_interaction_DragRotateAndZoom_; export default DragRotateAndZoom;
+6 -6
View File
@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
import {easeOut} from '../easing.js'; import {easeOut} from '../easing.js';
import _ol_events_condition_ from '../events/condition.js'; import _ol_events_condition_ from '../events/condition.js';
import {createOrUpdateFromCoordinates, getBottomLeft, getCenter, getTopRight, scaleFromCenter} from '../extent.js'; import {createOrUpdateFromCoordinates, getBottomLeft, getCenter, getTopRight, scaleFromCenter} from '../extent.js';
import _ol_interaction_DragBox_ from '../interaction/DragBox.js'; import DragBox from '../interaction/DragBox.js';
/** /**
* @classdesc * @classdesc
@@ -21,7 +21,7 @@ import _ol_interaction_DragBox_ from '../interaction/DragBox.js';
* @param {olx.interaction.DragZoomOptions=} opt_options Options. * @param {olx.interaction.DragZoomOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_interaction_DragZoom_ = function(opt_options) { var DragZoom = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
var condition = options.condition ? var condition = options.condition ?
@@ -39,20 +39,20 @@ var _ol_interaction_DragZoom_ = function(opt_options) {
*/ */
this.out_ = options.out !== undefined ? options.out : false; this.out_ = options.out !== undefined ? options.out : false;
_ol_interaction_DragBox_.call(this, { DragBox.call(this, {
condition: condition, condition: condition,
className: options.className || 'ol-dragzoom' className: options.className || 'ol-dragzoom'
}); });
}; };
inherits(_ol_interaction_DragZoom_, _ol_interaction_DragBox_); inherits(DragZoom, DragBox);
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_interaction_DragZoom_.prototype.onBoxEnd = function() { DragZoom.prototype.onBoxEnd = function() {
var map = this.getMap(); var map = this.getMap();
var view = /** @type {!ol.View} */ (map.getView()); var view = /** @type {!ol.View} */ (map.getView());
@@ -86,4 +86,4 @@ _ol_interaction_DragZoom_.prototype.onBoxEnd = function() {
}); });
}; };
export default _ol_interaction_DragZoom_; export default DragZoom;
+62 -61
View File
@@ -36,12 +36,12 @@ import _ol_style_Style_ from '../style/Style.js';
* @param {olx.interaction.DrawOptions} options Options. * @param {olx.interaction.DrawOptions} options Options.
* @api * @api
*/ */
var _ol_interaction_Draw_ = function(options) { var Draw = function(options) {
_ol_interaction_Pointer_.call(this, { _ol_interaction_Pointer_.call(this, {
handleDownEvent: _ol_interaction_Draw_.handleDownEvent_, handleDownEvent: Draw.handleDownEvent_,
handleEvent: _ol_interaction_Draw_.handleEvent, handleEvent: Draw.handleEvent,
handleUpEvent: _ol_interaction_Draw_.handleUpEvent_ handleUpEvent: Draw.handleUpEvent_
}); });
/** /**
@@ -95,7 +95,7 @@ var _ol_interaction_Draw_ = function(options) {
* @type {ol.interaction.Draw.Mode_} * @type {ol.interaction.Draw.Mode_}
* @private * @private
*/ */
this.mode_ = _ol_interaction_Draw_.getMode_(this.type_); this.mode_ = Draw.getMode_(this.type_);
/** /**
* Stop click, singleclick, and doubleclick events from firing during drawing. * Stop click, singleclick, and doubleclick events from firing during drawing.
@@ -114,7 +114,7 @@ var _ol_interaction_Draw_ = function(options) {
*/ */
this.minPoints_ = options.minPoints ? this.minPoints_ = options.minPoints ?
options.minPoints : options.minPoints :
(this.mode_ === _ol_interaction_Draw_.Mode_.POLYGON ? 3 : 2); (this.mode_ === Draw.Mode_.POLYGON ? 3 : 2);
/** /**
* The number of points that can be drawn before a polygon ring or line string * The number of points that can be drawn before a polygon ring or line string
@@ -151,11 +151,11 @@ var _ol_interaction_Draw_ = function(options) {
} else { } else {
var Constructor; var Constructor;
var mode = this.mode_; var mode = this.mode_;
if (mode === _ol_interaction_Draw_.Mode_.POINT) { if (mode === Draw.Mode_.POINT) {
Constructor = Point; Constructor = Point;
} else if (mode === _ol_interaction_Draw_.Mode_.LINE_STRING) { } else if (mode === Draw.Mode_.LINE_STRING) {
Constructor = LineString; Constructor = LineString;
} else if (mode === _ol_interaction_Draw_.Mode_.POLYGON) { } else if (mode === Draw.Mode_.POLYGON) {
Constructor = Polygon; Constructor = Polygon;
} }
/** /**
@@ -167,7 +167,7 @@ var _ol_interaction_Draw_ = function(options) {
geometryFunction = function(coordinates, opt_geometry) { geometryFunction = function(coordinates, opt_geometry) {
var geometry = opt_geometry; var geometry = opt_geometry;
if (geometry) { if (geometry) {
if (mode === _ol_interaction_Draw_.Mode_.POLYGON) { if (mode === Draw.Mode_.POLYGON) {
if (coordinates[0].length) { if (coordinates[0].length) {
// Add a closing coordinate to match the first // Add a closing coordinate to match the first
geometry.setCoordinates([coordinates[0].concat([coordinates[0][0]])]); geometry.setCoordinates([coordinates[0].concat([coordinates[0][0]])]);
@@ -255,7 +255,7 @@ var _ol_interaction_Draw_ = function(options) {
wrapX: options.wrapX ? options.wrapX : false wrapX: options.wrapX ? options.wrapX : false
}), }),
style: options.style ? options.style : style: options.style ? options.style :
_ol_interaction_Draw_.getDefaultStyleFunction() Draw.getDefaultStyleFunction()
}); });
/** /**
@@ -290,13 +290,13 @@ var _ol_interaction_Draw_ = function(options) {
}; };
inherits(_ol_interaction_Draw_, _ol_interaction_Pointer_); inherits(Draw, _ol_interaction_Pointer_);
/** /**
* @return {ol.StyleFunction} Styles. * @return {ol.StyleFunction} Styles.
*/ */
_ol_interaction_Draw_.getDefaultStyleFunction = function() { Draw.getDefaultStyleFunction = function() {
var styles = _ol_style_Style_.createDefaultEditing(); var styles = _ol_style_Style_.createDefaultEditing();
return function(feature, resolution) { return function(feature, resolution) {
return styles[feature.getGeometry().getType()]; return styles[feature.getGeometry().getType()];
@@ -307,7 +307,7 @@ _ol_interaction_Draw_.getDefaultStyleFunction = function() {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_interaction_Draw_.prototype.setMap = function(map) { Draw.prototype.setMap = function(map) {
_ol_interaction_Pointer_.prototype.setMap.call(this, map); _ol_interaction_Pointer_.prototype.setMap.call(this, map);
this.updateState_(); this.updateState_();
}; };
@@ -321,8 +321,8 @@ _ol_interaction_Draw_.prototype.setMap = function(map) {
* @this {ol.interaction.Draw} * @this {ol.interaction.Draw}
* @api * @api
*/ */
_ol_interaction_Draw_.handleEvent = function(event) { Draw.handleEvent = function(event) {
this.freehand_ = this.mode_ !== _ol_interaction_Draw_.Mode_.POINT && this.freehandCondition_(event); this.freehand_ = this.mode_ !== Draw.Mode_.POINT && this.freehandCondition_(event);
var pass = true; var pass = true;
if (this.freehand_ && if (this.freehand_ &&
event.type === MapBrowserEventType.POINTERDRAG && event.type === MapBrowserEventType.POINTERDRAG &&
@@ -347,7 +347,7 @@ _ol_interaction_Draw_.handleEvent = function(event) {
* @this {ol.interaction.Draw} * @this {ol.interaction.Draw}
* @private * @private
*/ */
_ol_interaction_Draw_.handleDownEvent_ = function(event) { Draw.handleDownEvent_ = function(event) {
this.shouldHandle_ = !this.freehand_; this.shouldHandle_ = !this.freehand_;
if (this.freehand_) { if (this.freehand_) {
@@ -371,17 +371,17 @@ _ol_interaction_Draw_.handleDownEvent_ = function(event) {
* @this {ol.interaction.Draw} * @this {ol.interaction.Draw}
* @private * @private
*/ */
_ol_interaction_Draw_.handleUpEvent_ = function(event) { Draw.handleUpEvent_ = function(event) {
var pass = true; var pass = true;
this.handlePointerMove_(event); this.handlePointerMove_(event);
var circleMode = this.mode_ === _ol_interaction_Draw_.Mode_.CIRCLE; var circleMode = this.mode_ === Draw.Mode_.CIRCLE;
if (this.shouldHandle_) { if (this.shouldHandle_) {
if (!this.finishCoordinate_) { if (!this.finishCoordinate_) {
this.startDrawing_(event); this.startDrawing_(event);
if (this.mode_ === _ol_interaction_Draw_.Mode_.POINT) { if (this.mode_ === Draw.Mode_.POINT) {
this.finishDrawing(); this.finishDrawing();
} }
} else if (this.freehand_ || circleMode) { } else if (this.freehand_ || circleMode) {
@@ -411,7 +411,7 @@ _ol_interaction_Draw_.handleUpEvent_ = function(event) {
* @return {boolean} Pass the event to other interactions. * @return {boolean} Pass the event to other interactions.
* @private * @private
*/ */
_ol_interaction_Draw_.prototype.handlePointerMove_ = function(event) { Draw.prototype.handlePointerMove_ = function(event) {
if (this.downPx_ && if (this.downPx_ &&
((!this.freehand_ && this.shouldHandle_) || ((!this.freehand_ && this.shouldHandle_) ||
(this.freehand_ && !this.shouldHandle_))) { (this.freehand_ && !this.shouldHandle_))) {
@@ -440,14 +440,14 @@ _ol_interaction_Draw_.prototype.handlePointerMove_ = function(event) {
* @return {boolean} The event is within the snapping tolerance of the start. * @return {boolean} The event is within the snapping tolerance of the start.
* @private * @private
*/ */
_ol_interaction_Draw_.prototype.atFinish_ = function(event) { Draw.prototype.atFinish_ = function(event) {
var at = false; var at = false;
if (this.sketchFeature_) { if (this.sketchFeature_) {
var potentiallyDone = false; var potentiallyDone = false;
var potentiallyFinishCoordinates = [this.finishCoordinate_]; var potentiallyFinishCoordinates = [this.finishCoordinate_];
if (this.mode_ === _ol_interaction_Draw_.Mode_.LINE_STRING) { if (this.mode_ === Draw.Mode_.LINE_STRING) {
potentiallyDone = this.sketchCoords_.length > this.minPoints_; potentiallyDone = this.sketchCoords_.length > this.minPoints_;
} else if (this.mode_ === _ol_interaction_Draw_.Mode_.POLYGON) { } else if (this.mode_ === Draw.Mode_.POLYGON) {
potentiallyDone = this.sketchCoords_[0].length > potentiallyDone = this.sketchCoords_[0].length >
this.minPoints_; this.minPoints_;
potentiallyFinishCoordinates = [this.sketchCoords_[0][0], potentiallyFinishCoordinates = [this.sketchCoords_[0][0],
@@ -478,7 +478,7 @@ _ol_interaction_Draw_.prototype.atFinish_ = function(event) {
* @param {ol.MapBrowserEvent} event Event. * @param {ol.MapBrowserEvent} event Event.
* @private * @private
*/ */
_ol_interaction_Draw_.prototype.createOrUpdateSketchPoint_ = function(event) { Draw.prototype.createOrUpdateSketchPoint_ = function(event) {
var coordinates = event.coordinate.slice(); var coordinates = event.coordinate.slice();
if (!this.sketchPoint_) { if (!this.sketchPoint_) {
this.sketchPoint_ = new _ol_Feature_(new Point(coordinates)); this.sketchPoint_ = new _ol_Feature_(new Point(coordinates));
@@ -495,17 +495,17 @@ _ol_interaction_Draw_.prototype.createOrUpdateSketchPoint_ = function(event) {
* @param {ol.MapBrowserEvent} event Event. * @param {ol.MapBrowserEvent} event Event.
* @private * @private
*/ */
_ol_interaction_Draw_.prototype.startDrawing_ = function(event) { Draw.prototype.startDrawing_ = function(event) {
var start = event.coordinate; var start = event.coordinate;
this.finishCoordinate_ = start; this.finishCoordinate_ = start;
if (this.mode_ === _ol_interaction_Draw_.Mode_.POINT) { if (this.mode_ === Draw.Mode_.POINT) {
this.sketchCoords_ = start.slice(); this.sketchCoords_ = start.slice();
} else if (this.mode_ === _ol_interaction_Draw_.Mode_.POLYGON) { } else if (this.mode_ === Draw.Mode_.POLYGON) {
this.sketchCoords_ = [[start.slice(), start.slice()]]; this.sketchCoords_ = [[start.slice(), start.slice()]];
this.sketchLineCoords_ = this.sketchCoords_[0]; this.sketchLineCoords_ = this.sketchCoords_[0];
} else { } else {
this.sketchCoords_ = [start.slice(), start.slice()]; this.sketchCoords_ = [start.slice(), start.slice()];
if (this.mode_ === _ol_interaction_Draw_.Mode_.CIRCLE) { if (this.mode_ === Draw.Mode_.CIRCLE) {
this.sketchLineCoords_ = this.sketchCoords_; this.sketchLineCoords_ = this.sketchCoords_;
} }
} }
@@ -520,7 +520,7 @@ _ol_interaction_Draw_.prototype.startDrawing_ = function(event) {
} }
this.sketchFeature_.setGeometry(geometry); this.sketchFeature_.setGeometry(geometry);
this.updateSketchFeatures_(); this.updateSketchFeatures_();
this.dispatchEvent(new _ol_interaction_Draw_.Event( this.dispatchEvent(new Draw.Event(
_ol_interaction_DrawEventType_.DRAWSTART, this.sketchFeature_)); _ol_interaction_DrawEventType_.DRAWSTART, this.sketchFeature_));
}; };
@@ -530,13 +530,13 @@ _ol_interaction_Draw_.prototype.startDrawing_ = function(event) {
* @param {ol.MapBrowserEvent} event Event. * @param {ol.MapBrowserEvent} event Event.
* @private * @private
*/ */
_ol_interaction_Draw_.prototype.modifyDrawing_ = function(event) { Draw.prototype.modifyDrawing_ = function(event) {
var coordinate = event.coordinate; var coordinate = event.coordinate;
var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry()); var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry());
var coordinates, last; var coordinates, last;
if (this.mode_ === _ol_interaction_Draw_.Mode_.POINT) { if (this.mode_ === Draw.Mode_.POINT) {
last = this.sketchCoords_; last = this.sketchCoords_;
} else if (this.mode_ === _ol_interaction_Draw_.Mode_.POLYGON) { } else if (this.mode_ === Draw.Mode_.POLYGON) {
coordinates = this.sketchCoords_[0]; coordinates = this.sketchCoords_[0];
last = coordinates[coordinates.length - 1]; last = coordinates[coordinates.length - 1];
if (this.atFinish_(event)) { if (this.atFinish_(event)) {
@@ -556,7 +556,7 @@ _ol_interaction_Draw_.prototype.modifyDrawing_ = function(event) {
} }
var sketchLineGeom; var sketchLineGeom;
if (geometry instanceof Polygon && if (geometry instanceof Polygon &&
this.mode_ !== _ol_interaction_Draw_.Mode_.POLYGON) { this.mode_ !== Draw.Mode_.POLYGON) {
if (!this.sketchLine_) { if (!this.sketchLine_) {
this.sketchLine_ = new _ol_Feature_(new LineString(null)); this.sketchLine_ = new _ol_Feature_(new LineString(null));
} }
@@ -577,12 +577,12 @@ _ol_interaction_Draw_.prototype.modifyDrawing_ = function(event) {
* @param {ol.MapBrowserEvent} event Event. * @param {ol.MapBrowserEvent} event Event.
* @private * @private
*/ */
_ol_interaction_Draw_.prototype.addToDrawing_ = function(event) { Draw.prototype.addToDrawing_ = function(event) {
var coordinate = event.coordinate; var coordinate = event.coordinate;
var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry()); var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry());
var done; var done;
var coordinates; var coordinates;
if (this.mode_ === _ol_interaction_Draw_.Mode_.LINE_STRING) { if (this.mode_ === Draw.Mode_.LINE_STRING) {
this.finishCoordinate_ = coordinate.slice(); this.finishCoordinate_ = coordinate.slice();
coordinates = this.sketchCoords_; coordinates = this.sketchCoords_;
if (coordinates.length >= this.maxPoints_) { if (coordinates.length >= this.maxPoints_) {
@@ -594,7 +594,7 @@ _ol_interaction_Draw_.prototype.addToDrawing_ = function(event) {
} }
coordinates.push(coordinate.slice()); coordinates.push(coordinate.slice());
this.geometryFunction_(coordinates, geometry); this.geometryFunction_(coordinates, geometry);
} else if (this.mode_ === _ol_interaction_Draw_.Mode_.POLYGON) { } else if (this.mode_ === Draw.Mode_.POLYGON) {
coordinates = this.sketchCoords_[0]; coordinates = this.sketchCoords_[0];
if (coordinates.length >= this.maxPoints_) { if (coordinates.length >= this.maxPoints_) {
if (this.freehand_) { if (this.freehand_) {
@@ -620,20 +620,20 @@ _ol_interaction_Draw_.prototype.addToDrawing_ = function(event) {
* Remove last point of the feature currently being drawn. * Remove last point of the feature currently being drawn.
* @api * @api
*/ */
_ol_interaction_Draw_.prototype.removeLastPoint = function() { Draw.prototype.removeLastPoint = function() {
if (!this.sketchFeature_) { if (!this.sketchFeature_) {
return; return;
} }
var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry()); var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry());
var coordinates, sketchLineGeom; var coordinates, sketchLineGeom;
if (this.mode_ === _ol_interaction_Draw_.Mode_.LINE_STRING) { if (this.mode_ === Draw.Mode_.LINE_STRING) {
coordinates = this.sketchCoords_; coordinates = this.sketchCoords_;
coordinates.splice(-2, 1); coordinates.splice(-2, 1);
this.geometryFunction_(coordinates, geometry); this.geometryFunction_(coordinates, geometry);
if (coordinates.length >= 2) { if (coordinates.length >= 2) {
this.finishCoordinate_ = coordinates[coordinates.length - 2].slice(); this.finishCoordinate_ = coordinates[coordinates.length - 2].slice();
} }
} else if (this.mode_ === _ol_interaction_Draw_.Mode_.POLYGON) { } else if (this.mode_ === Draw.Mode_.POLYGON) {
coordinates = this.sketchCoords_[0]; coordinates = this.sketchCoords_[0];
coordinates.splice(-2, 1); coordinates.splice(-2, 1);
sketchLineGeom = /** @type {ol.geom.LineString} */ (this.sketchLine_.getGeometry()); sketchLineGeom = /** @type {ol.geom.LineString} */ (this.sketchLine_.getGeometry());
@@ -655,15 +655,15 @@ _ol_interaction_Draw_.prototype.removeLastPoint = function() {
* inserting the feature. * inserting the feature.
* @api * @api
*/ */
_ol_interaction_Draw_.prototype.finishDrawing = function() { Draw.prototype.finishDrawing = function() {
var sketchFeature = this.abortDrawing_(); var sketchFeature = this.abortDrawing_();
var coordinates = this.sketchCoords_; var coordinates = this.sketchCoords_;
var geometry = /** @type {ol.geom.SimpleGeometry} */ (sketchFeature.getGeometry()); var geometry = /** @type {ol.geom.SimpleGeometry} */ (sketchFeature.getGeometry());
if (this.mode_ === _ol_interaction_Draw_.Mode_.LINE_STRING) { if (this.mode_ === Draw.Mode_.LINE_STRING) {
// remove the redundant last point // remove the redundant last point
coordinates.pop(); coordinates.pop();
this.geometryFunction_(coordinates, geometry); this.geometryFunction_(coordinates, geometry);
} else if (this.mode_ === _ol_interaction_Draw_.Mode_.POLYGON) { } else if (this.mode_ === Draw.Mode_.POLYGON) {
// remove the redundant last point in ring // remove the redundant last point in ring
coordinates[0].pop(); coordinates[0].pop();
this.geometryFunction_(coordinates, geometry); this.geometryFunction_(coordinates, geometry);
@@ -680,7 +680,7 @@ _ol_interaction_Draw_.prototype.finishDrawing = function() {
} }
// First dispatch event to allow full set up of feature // First dispatch event to allow full set up of feature
this.dispatchEvent(new _ol_interaction_Draw_.Event( this.dispatchEvent(new Draw.Event(
_ol_interaction_DrawEventType_.DRAWEND, sketchFeature)); _ol_interaction_DrawEventType_.DRAWEND, sketchFeature));
// Then insert feature // Then insert feature
@@ -698,7 +698,7 @@ _ol_interaction_Draw_.prototype.finishDrawing = function() {
* @return {ol.Feature} The sketch feature (or null if none). * @return {ol.Feature} The sketch feature (or null if none).
* @private * @private
*/ */
_ol_interaction_Draw_.prototype.abortDrawing_ = function() { Draw.prototype.abortDrawing_ = function() {
this.finishCoordinate_ = null; this.finishCoordinate_ = null;
var sketchFeature = this.sketchFeature_; var sketchFeature = this.sketchFeature_;
if (sketchFeature) { if (sketchFeature) {
@@ -718,7 +718,7 @@ _ol_interaction_Draw_.prototype.abortDrawing_ = function() {
* @param {!ol.Feature} feature Feature to be extended. * @param {!ol.Feature} feature Feature to be extended.
* @api * @api
*/ */
_ol_interaction_Draw_.prototype.extend = function(feature) { Draw.prototype.extend = function(feature) {
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
var lineString = /** @type {ol.geom.LineString} */ (geometry); var lineString = /** @type {ol.geom.LineString} */ (geometry);
this.sketchFeature_ = feature; this.sketchFeature_ = feature;
@@ -727,7 +727,7 @@ _ol_interaction_Draw_.prototype.extend = function(feature) {
this.finishCoordinate_ = last.slice(); this.finishCoordinate_ = last.slice();
this.sketchCoords_.push(last.slice()); this.sketchCoords_.push(last.slice());
this.updateSketchFeatures_(); this.updateSketchFeatures_();
this.dispatchEvent(new _ol_interaction_Draw_.Event( this.dispatchEvent(new Draw.Event(
_ol_interaction_DrawEventType_.DRAWSTART, this.sketchFeature_)); _ol_interaction_DrawEventType_.DRAWSTART, this.sketchFeature_));
}; };
@@ -735,14 +735,14 @@ _ol_interaction_Draw_.prototype.extend = function(feature) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_interaction_Draw_.prototype.shouldStopEvent = FALSE; Draw.prototype.shouldStopEvent = FALSE;
/** /**
* Redraw the sketch features. * Redraw the sketch features.
* @private * @private
*/ */
_ol_interaction_Draw_.prototype.updateSketchFeatures_ = function() { Draw.prototype.updateSketchFeatures_ = function() {
var sketchFeatures = []; var sketchFeatures = [];
if (this.sketchFeature_) { if (this.sketchFeature_) {
sketchFeatures.push(this.sketchFeature_); sketchFeatures.push(this.sketchFeature_);
@@ -762,7 +762,7 @@ _ol_interaction_Draw_.prototype.updateSketchFeatures_ = function() {
/** /**
* @private * @private
*/ */
_ol_interaction_Draw_.prototype.updateState_ = function() { Draw.prototype.updateState_ = function() {
var map = this.getMap(); var map = this.getMap();
var active = this.getActive(); var active = this.getActive();
if (!map || !active) { if (!map || !active) {
@@ -785,7 +785,7 @@ _ol_interaction_Draw_.prototype.updateState_ = function() {
* polygon. * polygon.
* @api * @api
*/ */
_ol_interaction_Draw_.createRegularPolygon = function(opt_sides, opt_angle) { Draw.createRegularPolygon = function(opt_sides, opt_angle) {
return ( return (
/** /**
* @param {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} coordinates * @param {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} coordinates
@@ -815,7 +815,7 @@ _ol_interaction_Draw_.createRegularPolygon = function(opt_sides, opt_angle) {
* @return {ol.DrawGeometryFunctionType} Function that draws a box-shaped polygon. * @return {ol.DrawGeometryFunctionType} Function that draws a box-shaped polygon.
* @api * @api
*/ */
_ol_interaction_Draw_.createBox = function() { Draw.createBox = function() {
return ( return (
/** /**
* @param {Array.<ol.Coordinate>} coordinates * @param {Array.<ol.Coordinate>} coordinates
@@ -845,19 +845,19 @@ _ol_interaction_Draw_.createBox = function() {
* @return {ol.interaction.Draw.Mode_} Drawing mode. * @return {ol.interaction.Draw.Mode_} Drawing mode.
* @private * @private
*/ */
_ol_interaction_Draw_.getMode_ = function(type) { Draw.getMode_ = function(type) {
var mode; var mode;
if (type === GeometryType.POINT || if (type === GeometryType.POINT ||
type === GeometryType.MULTI_POINT) { type === GeometryType.MULTI_POINT) {
mode = _ol_interaction_Draw_.Mode_.POINT; mode = Draw.Mode_.POINT;
} else if (type === GeometryType.LINE_STRING || } else if (type === GeometryType.LINE_STRING ||
type === GeometryType.MULTI_LINE_STRING) { type === GeometryType.MULTI_LINE_STRING) {
mode = _ol_interaction_Draw_.Mode_.LINE_STRING; mode = Draw.Mode_.LINE_STRING;
} else if (type === GeometryType.POLYGON || } else if (type === GeometryType.POLYGON ||
type === GeometryType.MULTI_POLYGON) { type === GeometryType.MULTI_POLYGON) {
mode = _ol_interaction_Draw_.Mode_.POLYGON; mode = Draw.Mode_.POLYGON;
} else if (type === GeometryType.CIRCLE) { } else if (type === GeometryType.CIRCLE) {
mode = _ol_interaction_Draw_.Mode_.CIRCLE; mode = Draw.Mode_.CIRCLE;
} }
return /** @type {!ol.interaction.Draw.Mode_} */ (mode); return /** @type {!ol.interaction.Draw.Mode_} */ (mode);
}; };
@@ -869,7 +869,7 @@ _ol_interaction_Draw_.getMode_ = function(type) {
* @enum {string} * @enum {string}
* @private * @private
*/ */
_ol_interaction_Draw_.Mode_ = { Draw.Mode_ = {
POINT: 'Point', POINT: 'Point',
LINE_STRING: 'LineString', LINE_STRING: 'LineString',
POLYGON: 'Polygon', POLYGON: 'Polygon',
@@ -887,7 +887,7 @@ _ol_interaction_Draw_.Mode_ = {
* @param {ol.interaction.DrawEventType} type Type. * @param {ol.interaction.DrawEventType} type Type.
* @param {ol.Feature} feature The feature drawn. * @param {ol.Feature} feature The feature drawn.
*/ */
_ol_interaction_Draw_.Event = function(type, feature) { Draw.Event = function(type, feature) {
Event.call(this, type); Event.call(this, type);
@@ -899,5 +899,6 @@ _ol_interaction_Draw_.Event = function(type, feature) {
this.feature = feature; this.feature = feature;
}; };
inherits(_ol_interaction_Draw_.Event, Event); inherits(Draw.Event, Event);
export default _ol_interaction_Draw_;
export default Draw;
+16 -16
View File
@@ -26,7 +26,7 @@ import _ol_math_ from '../math.js';
* @extends {ol.Object} * @extends {ol.Object}
* @api * @api
*/ */
var _ol_interaction_Interaction_ = function(options) { var Interaction = function(options) {
_ol_Object_.call(this); _ol_Object_.call(this);
@@ -45,7 +45,7 @@ var _ol_interaction_Interaction_ = function(options) {
}; };
inherits(_ol_interaction_Interaction_, _ol_Object_); inherits(Interaction, _ol_Object_);
/** /**
@@ -54,7 +54,7 @@ inherits(_ol_interaction_Interaction_, _ol_Object_);
* @observable * @observable
* @api * @api
*/ */
_ol_interaction_Interaction_.prototype.getActive = function() { Interaction.prototype.getActive = function() {
return ( return (
/** @type {boolean} */ this.get(_ol_interaction_Property_.ACTIVE) /** @type {boolean} */ this.get(_ol_interaction_Property_.ACTIVE)
); );
@@ -66,7 +66,7 @@ _ol_interaction_Interaction_.prototype.getActive = function() {
* @return {ol.PluggableMap} Map. * @return {ol.PluggableMap} Map.
* @api * @api
*/ */
_ol_interaction_Interaction_.prototype.getMap = function() { Interaction.prototype.getMap = function() {
return this.map_; return this.map_;
}; };
@@ -77,7 +77,7 @@ _ol_interaction_Interaction_.prototype.getMap = function() {
* @observable * @observable
* @api * @api
*/ */
_ol_interaction_Interaction_.prototype.setActive = function(active) { Interaction.prototype.setActive = function(active) {
this.set(_ol_interaction_Property_.ACTIVE, active); this.set(_ol_interaction_Property_.ACTIVE, active);
}; };
@@ -88,7 +88,7 @@ _ol_interaction_Interaction_.prototype.setActive = function(active) {
* the map here. * the map here.
* @param {ol.PluggableMap} map Map. * @param {ol.PluggableMap} map Map.
*/ */
_ol_interaction_Interaction_.prototype.setMap = function(map) { Interaction.prototype.setMap = function(map) {
this.map_ = map; this.map_ = map;
}; };
@@ -98,7 +98,7 @@ _ol_interaction_Interaction_.prototype.setMap = function(map) {
* @param {ol.Coordinate} delta Delta. * @param {ol.Coordinate} delta Delta.
* @param {number=} opt_duration Duration. * @param {number=} opt_duration Duration.
*/ */
_ol_interaction_Interaction_.pan = function(view, delta, opt_duration) { Interaction.pan = function(view, delta, opt_duration) {
var currentCenter = view.getCenter(); var currentCenter = view.getCenter();
if (currentCenter) { if (currentCenter) {
var center = view.constrainCenter( var center = view.constrainCenter(
@@ -122,9 +122,9 @@ _ol_interaction_Interaction_.pan = function(view, delta, opt_duration) {
* @param {ol.Coordinate=} opt_anchor Anchor coordinate. * @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration. * @param {number=} opt_duration Duration.
*/ */
_ol_interaction_Interaction_.rotate = function(view, rotation, opt_anchor, opt_duration) { Interaction.rotate = function(view, rotation, opt_anchor, opt_duration) {
rotation = view.constrainRotation(rotation, 0); rotation = view.constrainRotation(rotation, 0);
_ol_interaction_Interaction_.rotateWithoutConstraints( Interaction.rotateWithoutConstraints(
view, rotation, opt_anchor, opt_duration); view, rotation, opt_anchor, opt_duration);
}; };
@@ -135,7 +135,7 @@ _ol_interaction_Interaction_.rotate = function(view, rotation, opt_anchor, opt_d
* @param {ol.Coordinate=} opt_anchor Anchor coordinate. * @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration. * @param {number=} opt_duration Duration.
*/ */
_ol_interaction_Interaction_.rotateWithoutConstraints = function(view, rotation, opt_anchor, opt_duration) { Interaction.rotateWithoutConstraints = function(view, rotation, opt_anchor, opt_duration) {
if (rotation !== undefined) { if (rotation !== undefined) {
var currentRotation = view.getRotation(); var currentRotation = view.getRotation();
var currentCenter = view.getCenter(); var currentCenter = view.getCenter();
@@ -167,9 +167,9 @@ _ol_interaction_Interaction_.rotateWithoutConstraints = function(view, rotation,
* will select the nearest resolution. If not defined 0 is * will select the nearest resolution. If not defined 0 is
* assumed. * assumed.
*/ */
_ol_interaction_Interaction_.zoom = function(view, resolution, opt_anchor, opt_duration, opt_direction) { Interaction.zoom = function(view, resolution, opt_anchor, opt_duration, opt_direction) {
resolution = view.constrainResolution(resolution, 0, opt_direction); resolution = view.constrainResolution(resolution, 0, opt_direction);
_ol_interaction_Interaction_.zoomWithoutConstraints( Interaction.zoomWithoutConstraints(
view, resolution, opt_anchor, opt_duration); view, resolution, opt_anchor, opt_duration);
}; };
@@ -180,7 +180,7 @@ _ol_interaction_Interaction_.zoom = function(view, resolution, opt_anchor, opt_d
* @param {ol.Coordinate=} opt_anchor Anchor coordinate. * @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration. * @param {number=} opt_duration Duration.
*/ */
_ol_interaction_Interaction_.zoomByDelta = function(view, delta, opt_anchor, opt_duration) { Interaction.zoomByDelta = function(view, delta, opt_anchor, opt_duration) {
var currentResolution = view.getResolution(); var currentResolution = view.getResolution();
var resolution = view.constrainResolution(currentResolution, delta, 0); var resolution = view.constrainResolution(currentResolution, delta, 0);
@@ -208,7 +208,7 @@ _ol_interaction_Interaction_.zoomByDelta = function(view, delta, opt_anchor, opt
]; ];
} }
_ol_interaction_Interaction_.zoomWithoutConstraints( Interaction.zoomWithoutConstraints(
view, resolution, opt_anchor, opt_duration); view, resolution, opt_anchor, opt_duration);
}; };
@@ -219,7 +219,7 @@ _ol_interaction_Interaction_.zoomByDelta = function(view, delta, opt_anchor, opt
* @param {ol.Coordinate=} opt_anchor Anchor coordinate. * @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration. * @param {number=} opt_duration Duration.
*/ */
_ol_interaction_Interaction_.zoomWithoutConstraints = function(view, resolution, opt_anchor, opt_duration) { Interaction.zoomWithoutConstraints = function(view, resolution, opt_anchor, opt_duration) {
if (resolution) { if (resolution) {
var currentResolution = view.getResolution(); var currentResolution = view.getResolution();
var currentCenter = view.getCenter(); var currentCenter = view.getCenter();
@@ -240,4 +240,4 @@ _ol_interaction_Interaction_.zoomWithoutConstraints = function(view, resolution,
} }
} }
}; };
export default _ol_interaction_Interaction_; export default Interaction;
+4 -4
View File
@@ -6,7 +6,7 @@ import _ol_coordinate_ from '../coordinate.js';
import EventType from '../events/EventType.js'; import EventType from '../events/EventType.js';
import _ol_events_KeyCode_ from '../events/KeyCode.js'; import _ol_events_KeyCode_ from '../events/KeyCode.js';
import _ol_events_condition_ from '../events/condition.js'; import _ol_events_condition_ from '../events/condition.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js'; import Interaction from '../interaction/Interaction.js';
/** /**
* @classdesc * @classdesc
@@ -27,7 +27,7 @@ import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
*/ */
var _ol_interaction_KeyboardPan_ = function(opt_options) { var _ol_interaction_KeyboardPan_ = function(opt_options) {
_ol_interaction_Interaction_.call(this, { Interaction.call(this, {
handleEvent: _ol_interaction_KeyboardPan_.handleEvent handleEvent: _ol_interaction_KeyboardPan_.handleEvent
}); });
@@ -65,7 +65,7 @@ var _ol_interaction_KeyboardPan_ = function(opt_options) {
}; };
inherits(_ol_interaction_KeyboardPan_, _ol_interaction_Interaction_); inherits(_ol_interaction_KeyboardPan_, Interaction);
/** /**
* Handles the {@link ol.MapBrowserEvent map browser event} if it was a * Handles the {@link ol.MapBrowserEvent map browser event} if it was a
@@ -101,7 +101,7 @@ _ol_interaction_KeyboardPan_.handleEvent = function(mapBrowserEvent) {
} }
var delta = [deltaX, deltaY]; var delta = [deltaX, deltaY];
_ol_coordinate_.rotate(delta, view.getRotation()); _ol_coordinate_.rotate(delta, view.getRotation());
_ol_interaction_Interaction_.pan(view, delta, this.duration_); Interaction.pan(view, delta, this.duration_);
mapBrowserEvent.preventDefault(); mapBrowserEvent.preventDefault();
stopEvent = true; stopEvent = true;
} }
+4 -4
View File
@@ -4,7 +4,7 @@
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import EventType from '../events/EventType.js'; import EventType from '../events/EventType.js';
import _ol_events_condition_ from '../events/condition.js'; import _ol_events_condition_ from '../events/condition.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js'; import Interaction from '../interaction/Interaction.js';
/** /**
* @classdesc * @classdesc
@@ -25,7 +25,7 @@ import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
*/ */
var _ol_interaction_KeyboardZoom_ = function(opt_options) { var _ol_interaction_KeyboardZoom_ = function(opt_options) {
_ol_interaction_Interaction_.call(this, { Interaction.call(this, {
handleEvent: _ol_interaction_KeyboardZoom_.handleEvent handleEvent: _ol_interaction_KeyboardZoom_.handleEvent
}); });
@@ -52,7 +52,7 @@ var _ol_interaction_KeyboardZoom_ = function(opt_options) {
}; };
inherits(_ol_interaction_KeyboardZoom_, _ol_interaction_Interaction_); inherits(_ol_interaction_KeyboardZoom_, Interaction);
/** /**
@@ -75,7 +75,7 @@ _ol_interaction_KeyboardZoom_.handleEvent = function(mapBrowserEvent) {
var map = mapBrowserEvent.map; var map = mapBrowserEvent.map;
var delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_; var delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_;
var view = map.getView(); var view = map.getView();
_ol_interaction_Interaction_.zoomByDelta( Interaction.zoomByDelta(
view, delta, undefined, this.duration_); view, delta, undefined, this.duration_);
mapBrowserEvent.preventDefault(); mapBrowserEvent.preventDefault();
stopEvent = true; stopEvent = true;
+4 -4
View File
@@ -6,7 +6,7 @@ import _ol_ViewHint_ from '../ViewHint.js';
import {easeOut} from '../easing.js'; import {easeOut} from '../easing.js';
import EventType from '../events/EventType.js'; import EventType from '../events/EventType.js';
import _ol_has_ from '../has.js'; import _ol_has_ from '../has.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js'; import Interaction from '../interaction/Interaction.js';
import _ol_math_ from '../math.js'; import _ol_math_ from '../math.js';
@@ -27,7 +27,7 @@ var MAX_DELTA = 1;
*/ */
var _ol_interaction_MouseWheelZoom_ = function(opt_options) { var _ol_interaction_MouseWheelZoom_ = function(opt_options) {
_ol_interaction_Interaction_.call(this, { Interaction.call(this, {
handleEvent: _ol_interaction_MouseWheelZoom_.handleEvent handleEvent: _ol_interaction_MouseWheelZoom_.handleEvent
}); });
@@ -115,7 +115,7 @@ var _ol_interaction_MouseWheelZoom_ = function(opt_options) {
}; };
inherits(_ol_interaction_MouseWheelZoom_, _ol_interaction_Interaction_); inherits(_ol_interaction_MouseWheelZoom_, Interaction);
/** /**
@@ -261,7 +261,7 @@ _ol_interaction_MouseWheelZoom_.prototype.handleWheelZoom_ = function(map) {
} }
var maxDelta = MAX_DELTA; var maxDelta = MAX_DELTA;
var delta = _ol_math_.clamp(this.delta_, -maxDelta, maxDelta); var delta = _ol_math_.clamp(this.delta_, -maxDelta, maxDelta);
_ol_interaction_Interaction_.zoomByDelta(view, -delta, this.lastAnchor_, Interaction.zoomByDelta(view, -delta, this.lastAnchor_,
this.duration_); this.duration_);
this.mode_ = undefined; this.mode_ = undefined;
this.delta_ = 0; this.delta_ = 0;
+3 -3
View File
@@ -4,7 +4,7 @@
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_ViewHint_ from '../ViewHint.js'; import _ol_ViewHint_ from '../ViewHint.js';
import {FALSE} from '../functions.js'; import {FALSE} from '../functions.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js'; import Interaction from '../interaction/Interaction.js';
import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
import _ol_RotationConstraint_ from '../RotationConstraint.js'; import _ol_RotationConstraint_ from '../RotationConstraint.js';
@@ -115,7 +115,7 @@ _ol_interaction_PinchRotate_.handleDragEvent_ = function(mapBrowserEvent) {
if (this.rotating_) { if (this.rotating_) {
var rotation = view.getRotation(); var rotation = view.getRotation();
map.render(); map.render();
_ol_interaction_Interaction_.rotateWithoutConstraints(view, Interaction.rotateWithoutConstraints(view,
rotation + rotationDelta, this.anchor_); rotation + rotationDelta, this.anchor_);
} }
}; };
@@ -134,7 +134,7 @@ _ol_interaction_PinchRotate_.handleUpEvent_ = function(mapBrowserEvent) {
view.setHint(_ol_ViewHint_.INTERACTING, -1); view.setHint(_ol_ViewHint_.INTERACTING, -1);
if (this.rotating_) { if (this.rotating_) {
var rotation = view.getRotation(); var rotation = view.getRotation();
_ol_interaction_Interaction_.rotate( Interaction.rotate(
view, rotation, this.anchor_, this.duration_); view, rotation, this.anchor_, this.duration_);
} }
return false; return false;
+3 -3
View File
@@ -4,7 +4,7 @@
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_ViewHint_ from '../ViewHint.js'; import _ol_ViewHint_ from '../ViewHint.js';
import {FALSE} from '../functions.js'; import {FALSE} from '../functions.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js'; import Interaction from '../interaction/Interaction.js';
import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
/** /**
@@ -111,7 +111,7 @@ _ol_interaction_PinchZoom_.handleDragEvent_ = function(mapBrowserEvent) {
// scale, bypass the resolution constraint // scale, bypass the resolution constraint
map.render(); map.render();
_ol_interaction_Interaction_.zoomWithoutConstraints(view, newResolution, this.anchor_); Interaction.zoomWithoutConstraints(view, newResolution, this.anchor_);
}; };
@@ -134,7 +134,7 @@ _ol_interaction_PinchZoom_.handleUpEvent_ = function(mapBrowserEvent) {
// direction not to zoom out/in if user was pinching in/out. // direction not to zoom out/in if user was pinching in/out.
// Direction is > 0 if pinching out, and < 0 if pinching in. // Direction is > 0 if pinching out, and < 0 if pinching in.
var direction = this.lastScaleDelta_ - 1; var direction = this.lastScaleDelta_ - 1;
_ol_interaction_Interaction_.zoom(view, resolution, Interaction.zoom(view, resolution,
this.anchor_, this.duration_, direction); this.anchor_, this.duration_, direction);
} }
return false; return false;
+4 -3
View File
@@ -5,7 +5,7 @@ import {inherits, nullFunction} from '../index.js';
import {FALSE} from '../functions.js'; import {FALSE} from '../functions.js';
import MapBrowserEventType from '../MapBrowserEventType.js'; import MapBrowserEventType from '../MapBrowserEventType.js';
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js'; import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js'; import Interaction from '../interaction/Interaction.js';
import _ol_obj_ from '../obj.js'; import _ol_obj_ from '../obj.js';
/** /**
@@ -30,7 +30,7 @@ var _ol_interaction_Pointer_ = function(opt_options) {
var handleEvent = options.handleEvent ? var handleEvent = options.handleEvent ?
options.handleEvent : _ol_interaction_Pointer_.handleEvent; options.handleEvent : _ol_interaction_Pointer_.handleEvent;
_ol_interaction_Interaction_.call(this, { Interaction.call(this, {
handleEvent: handleEvent handleEvent: handleEvent
}); });
@@ -82,7 +82,7 @@ var _ol_interaction_Pointer_ = function(opt_options) {
}; };
inherits(_ol_interaction_Pointer_, _ol_interaction_Interaction_); inherits(_ol_interaction_Pointer_, Interaction);
/** /**
@@ -220,4 +220,5 @@ _ol_interaction_Pointer_.handleEvent = function(mapBrowserEvent) {
_ol_interaction_Pointer_.prototype.shouldStopEvent = function(handled) { _ol_interaction_Pointer_.prototype.shouldStopEvent = function(handled) {
return handled; return handled;
}; };
export default _ol_interaction_Pointer_; export default _ol_interaction_Pointer_;
+4 -4
View File
@@ -9,7 +9,7 @@ import Event from '../events/Event.js';
import _ol_events_condition_ from '../events/condition.js'; import _ol_events_condition_ from '../events/condition.js';
import {TRUE} from '../functions.js'; import {TRUE} from '../functions.js';
import GeometryType from '../geom/GeometryType.js'; import GeometryType from '../geom/GeometryType.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js'; import Interaction from '../interaction/Interaction.js';
import _ol_layer_Vector_ from '../layer/Vector.js'; import _ol_layer_Vector_ from '../layer/Vector.js';
import _ol_obj_ from '../obj.js'; import _ol_obj_ from '../obj.js';
import _ol_source_Vector_ from '../source/Vector.js'; import _ol_source_Vector_ from '../source/Vector.js';
@@ -35,7 +35,7 @@ import _ol_style_Style_ from '../style/Style.js';
*/ */
var _ol_interaction_Select_ = function(opt_options) { var _ol_interaction_Select_ = function(opt_options) {
_ol_interaction_Interaction_.call(this, { Interaction.call(this, {
handleEvent: _ol_interaction_Select_.handleEvent handleEvent: _ol_interaction_Select_.handleEvent
}); });
@@ -142,7 +142,7 @@ var _ol_interaction_Select_ = function(opt_options) {
}; };
inherits(_ol_interaction_Select_, _ol_interaction_Interaction_); inherits(_ol_interaction_Select_, Interaction);
/** /**
@@ -315,7 +315,7 @@ _ol_interaction_Select_.prototype.setMap = function(map) {
if (currentMap) { if (currentMap) {
selectedFeatures.forEach(currentMap.unskipFeature, currentMap); selectedFeatures.forEach(currentMap.unskipFeature, currentMap);
} }
_ol_interaction_Interaction_.prototype.setMap.call(this, map); Interaction.prototype.setMap.call(this, map);
this.featureOverlay_.setMap(map); this.featureOverlay_.setMap(map);
if (map) { if (map) {
selectedFeatures.forEach(map.skipFeature, map); selectedFeatures.forEach(map.skipFeature, map);
+7 -7
View File
@@ -3,7 +3,7 @@ import _ol_View_ from '../../../../src/ol/View.js';
import Event from '../../../../src/ol/events/Event.js'; import Event from '../../../../src/ol/events/Event.js';
import EventTarget from '../../../../src/ol/events/EventTarget.js'; import EventTarget from '../../../../src/ol/events/EventTarget.js';
import _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js'; import _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js';
import _ol_interaction_DragAndDrop_ from '../../../../src/ol/interaction/DragAndDrop.js'; import DragAndDrop from '../../../../src/ol/interaction/DragAndDrop.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
where('FileReader').describe('ol.interaction.DragAndDrop', function() { where('FileReader').describe('ol.interaction.DragAndDrop', function() {
@@ -19,7 +19,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() {
return new _ol_View_(); return new _ol_View_();
} }
}; };
interaction = new _ol_interaction_DragAndDrop_({ interaction = new DragAndDrop({
formatConstructors: [_ol_format_GeoJSON_] formatConstructors: [_ol_format_GeoJSON_]
}); });
}); });
@@ -27,8 +27,8 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() {
describe('constructor', function() { describe('constructor', function() {
it('can be constructed without arguments', function() { it('can be constructed without arguments', function() {
var interaction = new _ol_interaction_DragAndDrop_(); var interaction = new DragAndDrop();
expect(interaction).to.be.an(_ol_interaction_DragAndDrop_); expect(interaction).to.be.an(DragAndDrop);
}); });
it('sets formatConstructors on the instance', function() { it('sets formatConstructors on the instance', function() {
@@ -37,7 +37,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() {
it('accepts a source option', function() { it('accepts a source option', function() {
var source = new _ol_source_Vector_(); var source = new _ol_source_Vector_();
var drop = new _ol_interaction_DragAndDrop_({ var drop = new DragAndDrop({
formatConstructors: [_ol_format_GeoJSON_], formatConstructors: [_ol_format_GeoJSON_],
source: source source: source
}); });
@@ -73,7 +73,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() {
it('registers and unregisters listeners on a custom target', function() { it('registers and unregisters listeners on a custom target', function() {
var customTarget = new EventTarget(); var customTarget = new EventTarget();
interaction = new _ol_interaction_DragAndDrop_({ interaction = new DragAndDrop({
formatConstructors: [_ol_format_GeoJSON_], formatConstructors: [_ol_format_GeoJSON_],
target: customTarget target: customTarget
}); });
@@ -137,7 +137,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() {
it('adds dropped features to a source', function(done) { it('adds dropped features to a source', function(done) {
var source = new _ol_source_Vector_(); var source = new _ol_source_Vector_();
var drop = new _ol_interaction_DragAndDrop_({ var drop = new DragAndDrop({
formatConstructors: [_ol_format_GeoJSON_], formatConstructors: [_ol_format_GeoJSON_],
source: source source: source
}); });
@@ -1,8 +1,8 @@
import _ol_Map_ from '../../../../src/ol/Map.js'; import _ol_Map_ from '../../../../src/ol/Map.js';
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
import _ol_View_ from '../../../../src/ol/View.js'; import _ol_View_ from '../../../../src/ol/View.js';
import _ol_interaction_DragRotateAndZoom_ from '../../../../src/ol/interaction/DragRotateAndZoom.js'; import DragRotateAndZoom from '../../../../src/ol/interaction/DragRotateAndZoom.js';
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
@@ -12,8 +12,8 @@ describe('ol.interaction.DragRotateAndZoom', function() {
describe('constructor', function() { describe('constructor', function() {
it('can be constructed without arguments', function() { it('can be constructed without arguments', function() {
var instance = new _ol_interaction_DragRotateAndZoom_(); var instance = new DragRotateAndZoom();
expect(instance).to.be.an(_ol_interaction_DragRotateAndZoom_); expect(instance).to.be.an(DragRotateAndZoom);
}); });
}); });
@@ -36,7 +36,7 @@ describe('ol.interaction.DragRotateAndZoom', function() {
document.body.appendChild(target); document.body.appendChild(target);
var source = new _ol_source_Vector_(); var source = new _ol_source_Vector_();
var layer = new _ol_layer_Vector_({source: source}); var layer = new _ol_layer_Vector_({source: source});
interaction = new _ol_interaction_DragRotateAndZoom_(); interaction = new DragRotateAndZoom();
map = new _ol_Map_({ map = new _ol_Map_({
target: target, target: target,
layers: [layer], layers: [layer],
@@ -62,7 +62,7 @@ describe('ol.interaction.DragRotateAndZoom', function() {
new _ol_pointer_PointerEvent_('pointermove', {clientX: 20, clientY: 10}, {pointerType: 'mouse'}), new _ol_pointer_PointerEvent_('pointermove', {clientX: 20, clientY: 10}, {pointerType: 'mouse'}),
true); true);
interaction.lastAngle_ = Math.PI; interaction.lastAngle_ = Math.PI;
var spy = sinon.spy(_ol_interaction_Interaction_, 'rotateWithoutConstraints'); var spy = sinon.spy(Interaction, 'rotateWithoutConstraints');
interaction.handleDragEvent_(event); interaction.handleDragEvent_(event);
expect(spy.callCount).to.be(1); expect(spy.callCount).to.be(1);
expect(interaction.lastAngle_).to.be(-0.8308214428190254); expect(interaction.lastAngle_).to.be(-0.8308214428190254);
@@ -77,7 +77,7 @@ describe('ol.interaction.DragRotateAndZoom', function() {
true); true);
interaction.handleDragEvent_(event); interaction.handleDragEvent_(event);
expect(spy.callCount).to.be(1); expect(spy.callCount).to.be(1);
_ol_interaction_Interaction_.rotateWithoutConstraints.restore(); Interaction.rotateWithoutConstraints.restore();
}); });
}); });
+7 -7
View File
@@ -2,7 +2,7 @@ import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js'; import _ol_View_ from '../../../../src/ol/View.js';
import * as _ol_extent_ from '../../../../src/ol/extent.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js';
import Polygon from '../../../../src/ol/geom/Polygon.js'; import Polygon from '../../../../src/ol/geom/Polygon.js';
import _ol_interaction_DragZoom_ from '../../../../src/ol/interaction/DragZoom.js'; import DragZoom from '../../../../src/ol/interaction/DragZoom.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_render_Box_ from '../../../../src/ol/render/Box.js'; import _ol_render_Box_ from '../../../../src/ol/render/Box.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
@@ -48,15 +48,15 @@ describe('ol.interaction.DragZoom', function() {
describe('constructor', function() { describe('constructor', function() {
it('can be constructed without arguments', function() { it('can be constructed without arguments', function() {
var instance = new _ol_interaction_DragZoom_(); var instance = new DragZoom();
expect(instance).to.be.an(_ol_interaction_DragZoom_); expect(instance).to.be.an(DragZoom);
}); });
it('sets "ol-dragzoom" as box className', function() { it('sets "ol-dragzoom" as box className', function() {
var instance = new _ol_interaction_DragZoom_(); var instance = new DragZoom();
expect(instance.box_.element_.className).to.be('ol-box ol-dragzoom'); expect(instance.box_.element_.className).to.be('ol-box ol-dragzoom');
}); });
it('sets a custom box className', function() { it('sets a custom box className', function() {
var instance = new _ol_interaction_DragZoom_({className: 'test-dragzoom'}); var instance = new DragZoom({className: 'test-dragzoom'});
expect(instance.box_.element_.className).to.be('ol-box test-dragzoom'); expect(instance.box_.element_.className).to.be('ol-box test-dragzoom');
}); });
@@ -65,7 +65,7 @@ describe('ol.interaction.DragZoom', function() {
describe('#onBoxEnd()', function() { describe('#onBoxEnd()', function() {
it('centers the view on the box geometry', function(done) { it('centers the view on the box geometry', function(done) {
var interaction = new _ol_interaction_DragZoom_({ var interaction = new DragZoom({
duration: 10 duration: 10
}); });
map.addInteraction(interaction); map.addInteraction(interaction);
@@ -86,7 +86,7 @@ describe('ol.interaction.DragZoom', function() {
}); });
it('sets new resolution while zooming out', function(done) { it('sets new resolution while zooming out', function(done) {
var interaction = new _ol_interaction_DragZoom_({ var interaction = new DragZoom({
duration: 10, duration: 10,
out: true out: true
}); });
+23 -23
View File
@@ -12,8 +12,8 @@ import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
import Point from '../../../../src/ol/geom/Point.js'; import Point from '../../../../src/ol/geom/Point.js';
import Polygon from '../../../../src/ol/geom/Polygon.js'; import Polygon from '../../../../src/ol/geom/Polygon.js';
import _ol_interaction_Draw_ from '../../../../src/ol/interaction/Draw.js'; import Draw from '../../../../src/ol/interaction/Draw.js';
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
@@ -79,16 +79,16 @@ describe('ol.interaction.Draw', function() {
describe('constructor', function() { describe('constructor', function() {
it('creates a new interaction', function() { it('creates a new interaction', function() {
var draw = new _ol_interaction_Draw_({ var draw = new Draw({
source: source, source: source,
type: 'Point' type: 'Point'
}); });
expect(draw).to.be.a(_ol_interaction_Draw_); expect(draw).to.be.a(Draw);
expect(draw).to.be.a(_ol_interaction_Interaction_); expect(draw).to.be.a(Interaction);
}); });
it('accepts a freehand option', function() { it('accepts a freehand option', function() {
var draw = new _ol_interaction_Draw_({ var draw = new Draw({
source: source, source: source,
type: 'LineString', type: 'LineString',
freehand: true freehand: true
@@ -108,7 +108,7 @@ describe('ol.interaction.Draw', function() {
describe('specifying a geometryName', function() { describe('specifying a geometryName', function() {
beforeEach(function() { beforeEach(function() {
var draw = new _ol_interaction_Draw_({ var draw = new Draw({
source: source, source: source,
geometryName: 'the_geom', geometryName: 'the_geom',
type: 'Point' type: 'Point'
@@ -129,7 +129,7 @@ describe('ol.interaction.Draw', function() {
describe('specifying a clickTolerance', function() { describe('specifying a clickTolerance', function() {
beforeEach(function() { beforeEach(function() {
var draw = new _ol_interaction_Draw_({ var draw = new Draw({
source: source, source: source,
type: 'Point', type: 'Point',
clickTolerance: 6 clickTolerance: 6
@@ -158,7 +158,7 @@ describe('ol.interaction.Draw', function() {
var draw; var draw;
beforeEach(function() { beforeEach(function() {
draw = new _ol_interaction_Draw_({ draw = new Draw({
source: source, source: source,
type: 'Point' type: 'Point'
}); });
@@ -236,7 +236,7 @@ describe('ol.interaction.Draw', function() {
describe('drawing multipoints', function() { describe('drawing multipoints', function() {
beforeEach(function() { beforeEach(function() {
map.addInteraction(new _ol_interaction_Draw_({ map.addInteraction(new Draw({
source: source, source: source,
type: 'MultiPoint' type: 'MultiPoint'
})); }));
@@ -259,7 +259,7 @@ describe('ol.interaction.Draw', function() {
var draw; var draw;
beforeEach(function() { beforeEach(function() {
draw = new _ol_interaction_Draw_({ draw = new Draw({
source: source, source: source,
type: 'LineString' type: 'LineString'
}); });
@@ -427,7 +427,7 @@ describe('ol.interaction.Draw', function() {
describe('drawing with a finishCondition', function() { describe('drawing with a finishCondition', function() {
beforeEach(function() { beforeEach(function() {
var draw = new _ol_interaction_Draw_({ var draw = new Draw({
source: source, source: source,
type: 'LineString', type: 'LineString',
finishCondition: function(event) { finishCondition: function(event) {
@@ -477,7 +477,7 @@ describe('ol.interaction.Draw', function() {
describe('drawing multi-linestrings', function() { describe('drawing multi-linestrings', function() {
beforeEach(function() { beforeEach(function() {
map.addInteraction(new _ol_interaction_Draw_({ map.addInteraction(new Draw({
source: source, source: source,
type: 'MultiLineString' type: 'MultiLineString'
})); }));
@@ -511,7 +511,7 @@ describe('ol.interaction.Draw', function() {
var draw; var draw;
beforeEach(function() { beforeEach(function() {
draw = new _ol_interaction_Draw_({ draw = new Draw({
source: source, source: source,
type: 'Polygon' type: 'Polygon'
}); });
@@ -697,7 +697,7 @@ describe('ol.interaction.Draw', function() {
describe('drawing multi-polygons', function() { describe('drawing multi-polygons', function() {
beforeEach(function() { beforeEach(function() {
map.addInteraction(new _ol_interaction_Draw_({ map.addInteraction(new Draw({
source: source, source: source,
type: 'MultiPolygon' type: 'MultiPolygon'
})); }));
@@ -774,7 +774,7 @@ describe('ol.interaction.Draw', function() {
var draw; var draw;
beforeEach(function() { beforeEach(function() {
draw = new _ol_interaction_Draw_({ draw = new Draw({
source: source, source: source,
type: 'Circle' type: 'Circle'
}); });
@@ -846,7 +846,7 @@ describe('ol.interaction.Draw', function() {
var interaction; var interaction;
beforeEach(function() { beforeEach(function() {
interaction = new _ol_interaction_Draw_({ interaction = new Draw({
type: 'LineString' type: 'LineString'
}); });
@@ -915,7 +915,7 @@ describe('ol.interaction.Draw', function() {
var interaction; var interaction;
beforeEach(function() { beforeEach(function() {
interaction = new _ol_interaction_Draw_({ interaction = new Draw({
type: 'LineString' type: 'LineString'
}); });
expect(interaction.getActive()).to.be(true); expect(interaction.getActive()).to.be(true);
@@ -968,11 +968,11 @@ describe('ol.interaction.Draw', function() {
describe('ol.interaction.Draw.createRegularPolygon', function() { describe('ol.interaction.Draw.createRegularPolygon', function() {
it('creates a regular polygon in Circle mode', function() { it('creates a regular polygon in Circle mode', function() {
var draw = new _ol_interaction_Draw_({ var draw = new Draw({
source: source, source: source,
type: 'Circle', type: 'Circle',
geometryFunction: geometryFunction:
_ol_interaction_Draw_.createRegularPolygon(4, Math.PI / 4) Draw.createRegularPolygon(4, Math.PI / 4)
}); });
map.addInteraction(draw); map.addInteraction(draw);
@@ -998,10 +998,10 @@ describe('ol.interaction.Draw', function() {
describe('ol.interaction.Draw.createBox', function() { describe('ol.interaction.Draw.createBox', function() {
it('creates a box-shaped polygon in Circle mode', function() { it('creates a box-shaped polygon in Circle mode', function() {
var draw = new _ol_interaction_Draw_({ var draw = new Draw({
source: source, source: source,
type: 'Circle', type: 'Circle',
geometryFunction: _ol_interaction_Draw_.createBox() geometryFunction: Draw.createBox()
}); });
map.addInteraction(draw); map.addInteraction(draw);
@@ -1030,7 +1030,7 @@ describe('ol.interaction.Draw', function() {
var feature; var feature;
beforeEach(function() { beforeEach(function() {
draw = new _ol_interaction_Draw_({ draw = new Draw({
source: source, source: source,
type: 'LineString' type: 'LineString'
}); });
+19 -19
View File
@@ -1,7 +1,7 @@
import _ol_Map_ from '../../../../src/ol/Map.js'; import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js'; import _ol_View_ from '../../../../src/ol/View.js';
import EventTarget from '../../../../src/ol/events/EventTarget.js'; import EventTarget from '../../../../src/ol/events/EventTarget.js';
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js';
describe('ol.interaction.Interaction', function() { describe('ol.interaction.Interaction', function() {
@@ -9,11 +9,11 @@ describe('ol.interaction.Interaction', function() {
var interaction; var interaction;
beforeEach(function() { beforeEach(function() {
interaction = new _ol_interaction_Interaction_({}); interaction = new Interaction({});
}); });
it('creates a new interaction', function() { it('creates a new interaction', function() {
expect(interaction).to.be.a(_ol_interaction_Interaction_); expect(interaction).to.be.a(Interaction);
expect(interaction).to.be.a(EventTarget); expect(interaction).to.be.a(EventTarget);
}); });
@@ -27,13 +27,13 @@ describe('ol.interaction.Interaction', function() {
it('retrieves the associated map', function() { it('retrieves the associated map', function() {
var map = new _ol_Map_({}); var map = new _ol_Map_({});
var interaction = new _ol_interaction_Interaction_({}); var interaction = new Interaction({});
interaction.setMap(map); interaction.setMap(map);
expect(interaction.getMap()).to.be(map); expect(interaction.getMap()).to.be(map);
}); });
it('returns null if no map', function() { it('returns null if no map', function() {
var interaction = new _ol_interaction_Interaction_({}); var interaction = new Interaction({});
expect(interaction.getMap()).to.be(null); expect(interaction.getMap()).to.be(null);
}); });
@@ -43,13 +43,13 @@ describe('ol.interaction.Interaction', function() {
it('allows a map to be set', function() { it('allows a map to be set', function() {
var map = new _ol_Map_({}); var map = new _ol_Map_({});
var interaction = new _ol_interaction_Interaction_({}); var interaction = new Interaction({});
interaction.setMap(map); interaction.setMap(map);
expect(interaction.getMap()).to.be(map); expect(interaction.getMap()).to.be(map);
}); });
it('accepts null', function() { it('accepts null', function() {
var interaction = new _ol_interaction_Interaction_({}); var interaction = new Interaction({});
interaction.setMap(null); interaction.setMap(null);
expect(interaction.getMap()).to.be(null); expect(interaction.getMap()).to.be(null);
}); });
@@ -64,16 +64,16 @@ describe('ol.interaction.Interaction', function() {
resolutions: [4, 2, 1, 0.5, 0.25] resolutions: [4, 2, 1, 0.5, 0.25]
}); });
_ol_interaction_Interaction_.zoomByDelta(view, 1); Interaction.zoomByDelta(view, 1);
expect(view.getResolution()).to.be(0.5); expect(view.getResolution()).to.be(0.5);
_ol_interaction_Interaction_.zoomByDelta(view, -1); Interaction.zoomByDelta(view, -1);
expect(view.getResolution()).to.be(1); expect(view.getResolution()).to.be(1);
_ol_interaction_Interaction_.zoomByDelta(view, 2); Interaction.zoomByDelta(view, 2);
expect(view.getResolution()).to.be(0.25); expect(view.getResolution()).to.be(0.25);
_ol_interaction_Interaction_.zoomByDelta(view, -2); Interaction.zoomByDelta(view, -2);
expect(view.getResolution()).to.be(1); expect(view.getResolution()).to.be(1);
}); });
@@ -84,16 +84,16 @@ describe('ol.interaction.Interaction', function() {
resolutions: [4, 2, 1, 0.5, 0.25] resolutions: [4, 2, 1, 0.5, 0.25]
}); });
_ol_interaction_Interaction_.zoomByDelta(view, 1, [10, 10]); Interaction.zoomByDelta(view, 1, [10, 10]);
expect(view.getCenter()).to.eql([5, 5]); expect(view.getCenter()).to.eql([5, 5]);
_ol_interaction_Interaction_.zoomByDelta(view, -1, [0, 0]); Interaction.zoomByDelta(view, -1, [0, 0]);
expect(view.getCenter()).to.eql([10, 10]); expect(view.getCenter()).to.eql([10, 10]);
_ol_interaction_Interaction_.zoomByDelta(view, 2, [0, 0]); Interaction.zoomByDelta(view, 2, [0, 0]);
expect(view.getCenter()).to.eql([2.5, 2.5]); expect(view.getCenter()).to.eql([2.5, 2.5]);
_ol_interaction_Interaction_.zoomByDelta(view, -2, [0, 0]); Interaction.zoomByDelta(view, -2, [0, 0]);
expect(view.getCenter()).to.eql([10, 10]); expect(view.getCenter()).to.eql([10, 10]);
}); });
@@ -105,16 +105,16 @@ describe('ol.interaction.Interaction', function() {
resolutions: [4, 2, 1, 0.5, 0.25] resolutions: [4, 2, 1, 0.5, 0.25]
}); });
_ol_interaction_Interaction_.zoomByDelta(view, 1, [10, 10]); Interaction.zoomByDelta(view, 1, [10, 10]);
expect(view.getCenter()).to.eql([2.5, 2.5]); expect(view.getCenter()).to.eql([2.5, 2.5]);
_ol_interaction_Interaction_.zoomByDelta(view, -1, [0, 0]); Interaction.zoomByDelta(view, -1, [0, 0]);
expect(view.getCenter()).to.eql([2.5, 2.5]); expect(view.getCenter()).to.eql([2.5, 2.5]);
_ol_interaction_Interaction_.zoomByDelta(view, 2, [10, 10]); Interaction.zoomByDelta(view, 2, [10, 10]);
expect(view.getCenter()).to.eql([2.5, 2.5]); expect(view.getCenter()).to.eql([2.5, 2.5]);
_ol_interaction_Interaction_.zoomByDelta(view, -2, [0, 0]); Interaction.zoomByDelta(view, -2, [0, 0]);
expect(view.getCenter()).to.eql([2.5, 2.5]); expect(view.getCenter()).to.eql([2.5, 2.5]);
}); });
}); });
+4 -3
View File
@@ -2,7 +2,8 @@ import _ol_Map_ from '../../../../src/ol/Map.js';
import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js'; import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
import _ol_View_ from '../../../../src/ol/View.js'; import _ol_View_ from '../../../../src/ol/View.js';
import Event from '../../../../src/ol/events/Event.js'; import Event from '../../../../src/ol/events/Event.js';
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js';
describe('ol.interaction.KeyboardPan', function() { describe('ol.interaction.KeyboardPan', function() {
var map; var map;
@@ -23,7 +24,7 @@ describe('ol.interaction.KeyboardPan', function() {
describe('handleEvent()', function() { describe('handleEvent()', function() {
it('pans on arrow keys', function() { it('pans on arrow keys', function() {
var spy = sinon.spy(_ol_interaction_Interaction_, 'pan'); var spy = sinon.spy(Interaction, 'pan');
var event = new MapBrowserEvent('keydown', map, { var event = new MapBrowserEvent('keydown', map, {
type: 'keydown', type: 'keydown',
target: map.getTargetElement(), target: map.getTargetElement(),
@@ -41,7 +42,7 @@ describe('ol.interaction.KeyboardPan', function() {
expect(spy.getCall(1).args[1]).to.eql([0, 128]); expect(spy.getCall(1).args[1]).to.eql([0, 128]);
expect(spy.getCall(2).args[1]).to.eql([-128, 0]); expect(spy.getCall(2).args[1]).to.eql([-128, 0]);
expect(spy.getCall(3).args[1]).to.eql([128, 0]); expect(spy.getCall(3).args[1]).to.eql([128, 0]);
_ol_interaction_Interaction_.pan.restore(); Interaction.pan.restore();
}); });
}); });
@@ -2,7 +2,8 @@ import _ol_Map_ from '../../../../src/ol/Map.js';
import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js'; import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
import _ol_View_ from '../../../../src/ol/View.js'; import _ol_View_ from '../../../../src/ol/View.js';
import Event from '../../../../src/ol/events/Event.js'; import Event from '../../../../src/ol/events/Event.js';
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js';
describe('ol.interaction.KeyboardZoom', function() { describe('ol.interaction.KeyboardZoom', function() {
var map; var map;
@@ -23,7 +24,7 @@ describe('ol.interaction.KeyboardZoom', function() {
describe('handleEvent()', function() { describe('handleEvent()', function() {
it('zooms on + and - keys', function() { it('zooms on + and - keys', function() {
var spy = sinon.spy(_ol_interaction_Interaction_, 'zoomByDelta'); var spy = sinon.spy(Interaction, 'zoomByDelta');
var event = new MapBrowserEvent('keydown', map, { var event = new MapBrowserEvent('keydown', map, {
type: 'keydown', type: 'keydown',
target: map.getTargetElement(), target: map.getTargetElement(),
@@ -35,7 +36,7 @@ describe('ol.interaction.KeyboardZoom', function() {
map.handleMapBrowserEvent(event); map.handleMapBrowserEvent(event);
expect(spy.getCall(0).args[1]).to.eql(1); expect(spy.getCall(0).args[1]).to.eql(1);
expect(spy.getCall(1).args[1]).to.eql(-1); expect(spy.getCall(1).args[1]).to.eql(-1);
_ol_interaction_Interaction_.zoomByDelta.restore(); Interaction.zoomByDelta.restore();
}); });
}); });
+10 -10
View File
@@ -3,7 +3,7 @@ import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
import _ol_View_ from '../../../../src/ol/View.js'; import _ol_View_ from '../../../../src/ol/View.js';
import Event from '../../../../src/ol/events/Event.js'; import Event from '../../../../src/ol/events/Event.js';
import _ol_has_ from '../../../../src/ol/has.js'; import _ol_has_ from '../../../../src/ol/has.js';
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js';
import _ol_interaction_MouseWheelZoom_ from '../../../../src/ol/interaction/MouseWheelZoom.js'; import _ol_interaction_MouseWheelZoom_ from '../../../../src/ol/interaction/MouseWheelZoom.js';
@@ -33,13 +33,13 @@ describe('ol.interaction.MouseWheelZoom', function() {
describe('timeout duration', function() { describe('timeout duration', function() {
var clock; var clock;
beforeEach(function() { beforeEach(function() {
sinon.spy(_ol_interaction_Interaction_, 'zoomByDelta'); sinon.spy(Interaction, 'zoomByDelta');
clock = sinon.useFakeTimers(); clock = sinon.useFakeTimers();
}); });
afterEach(function() { afterEach(function() {
clock.restore(); clock.restore();
_ol_interaction_Interaction_.zoomByDelta.restore(); Interaction.zoomByDelta.restore();
}); });
it('works with the defaut value', function(done) { it('works with the defaut value', function(done) {
@@ -51,9 +51,9 @@ describe('ol.interaction.MouseWheelZoom', function() {
map.handleMapBrowserEvent(event); map.handleMapBrowserEvent(event);
clock.tick(50); clock.tick(50);
// default timeout is 80 ms, not called yet // default timeout is 80 ms, not called yet
expect(_ol_interaction_Interaction_.zoomByDelta.called).to.be(false); expect(Interaction.zoomByDelta.called).to.be(false);
clock.tick(30); clock.tick(30);
expect(_ol_interaction_Interaction_.zoomByDelta.called).to.be(true); expect(Interaction.zoomByDelta.called).to.be(true);
done(); done();
}); });
@@ -102,15 +102,15 @@ describe('ol.interaction.MouseWheelZoom', function() {
describe('spying on ol.interaction.Interaction.zoomByDelta', function() { describe('spying on ol.interaction.Interaction.zoomByDelta', function() {
beforeEach(function() { beforeEach(function() {
sinon.spy(_ol_interaction_Interaction_, 'zoomByDelta'); sinon.spy(Interaction, 'zoomByDelta');
}); });
afterEach(function() { afterEach(function() {
_ol_interaction_Interaction_.zoomByDelta.restore(); Interaction.zoomByDelta.restore();
}); });
it('works in DOM_DELTA_LINE mode (wheel)', function(done) { it('works in DOM_DELTA_LINE mode (wheel)', function(done) {
map.once('postrender', function() { map.once('postrender', function() {
var call = _ol_interaction_Interaction_.zoomByDelta.getCall(0); var call = Interaction.zoomByDelta.getCall(0);
expect(call.args[1]).to.be(-1); expect(call.args[1]).to.be(-1);
expect(call.args[2]).to.eql([0, 0]); expect(call.args[2]).to.eql([0, 0]);
done(); done();
@@ -130,7 +130,7 @@ describe('ol.interaction.MouseWheelZoom', function() {
var origHasSafari = _ol_has_.SAFARI; var origHasSafari = _ol_has_.SAFARI;
_ol_has_.SAFARI = true; _ol_has_.SAFARI = true;
map.once('postrender', function() { map.once('postrender', function() {
var call = _ol_interaction_Interaction_.zoomByDelta.getCall(0); var call = Interaction.zoomByDelta.getCall(0);
expect(call.args[1]).to.be(-1); expect(call.args[1]).to.be(-1);
expect(call.args[2]).to.eql([0, 0]); expect(call.args[2]).to.eql([0, 0]);
_ol_has_.SAFARI = origHasSafari; _ol_has_.SAFARI = origHasSafari;
@@ -150,7 +150,7 @@ describe('ol.interaction.MouseWheelZoom', function() {
var origHasSafari = _ol_has_.SAFARI; var origHasSafari = _ol_has_.SAFARI;
_ol_has_.SAFARI = false; _ol_has_.SAFARI = false;
map.once('postrender', function() { map.once('postrender', function() {
var call = _ol_interaction_Interaction_.zoomByDelta.getCall(0); var call = Interaction.zoomByDelta.getCall(0);
expect(call.args[1]).to.be(-1); expect(call.args[1]).to.be(-1);
expect(call.args[2]).to.eql([0, 0]); expect(call.args[2]).to.eql([0, 0]);
_ol_has_.SAFARI = origHasSafari; _ol_has_.SAFARI = origHasSafari;
+2 -2
View File
@@ -5,7 +5,7 @@ import MapBrowserEventType from '../../../../src/ol/MapBrowserEventType.js';
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
import _ol_View_ from '../../../../src/ol/View.js'; import _ol_View_ from '../../../../src/ol/View.js';
import Polygon from '../../../../src/ol/geom/Polygon.js'; import Polygon from '../../../../src/ol/geom/Polygon.js';
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js';
import _ol_interaction_Select_ from '../../../../src/ol/interaction/Select.js'; import _ol_interaction_Select_ from '../../../../src/ol/interaction/Select.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
@@ -105,7 +105,7 @@ describe('ol.interaction.Select', function() {
it('creates a new interaction', function() { it('creates a new interaction', function() {
var select = new _ol_interaction_Select_(); var select = new _ol_interaction_Select_();
expect(select).to.be.a(_ol_interaction_Select_); expect(select).to.be.a(_ol_interaction_Select_);
expect(select).to.be.a(_ol_interaction_Interaction_); expect(select).to.be.a(Interaction);
}); });
describe('user-provided collection', function() { describe('user-provided collection', function() {
+2 -2
View File
@@ -5,7 +5,7 @@ import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js
import _ol_View_ from '../../../../src/ol/View.js'; import _ol_View_ from '../../../../src/ol/View.js';
import Point from '../../../../src/ol/geom/Point.js'; import Point from '../../../../src/ol/geom/Point.js';
import _ol_interaction_Translate_ from '../../../../src/ol/interaction/Translate.js'; import _ol_interaction_Translate_ from '../../../../src/ol/interaction/Translate.js';
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
@@ -136,7 +136,7 @@ describe('ol.interaction.Translate', function() {
features: features features: features
}); });
expect(translate).to.be.a(_ol_interaction_Translate_); expect(translate).to.be.a(_ol_interaction_Translate_);
expect(translate).to.be.a(_ol_interaction_Interaction_); expect(translate).to.be.a(Interaction);
}); });
}); });
+6 -6
View File
@@ -6,8 +6,8 @@ import _ol_View_ from '../../../src/ol/View.js';
import Point from '../../../src/ol/geom/Point.js'; import Point from '../../../src/ol/geom/Point.js';
import _ol_has_ from '../../../src/ol/has.js'; import _ol_has_ from '../../../src/ol/has.js';
import _ol_interaction_ from '../../../src/ol/interaction.js'; import _ol_interaction_ from '../../../src/ol/interaction.js';
import _ol_interaction_DoubleClickZoom_ from '../../../src/ol/interaction/DoubleClickZoom.js'; import DoubleClickZoom from '../../../src/ol/interaction/DoubleClickZoom.js';
import _ol_interaction_Interaction_ from '../../../src/ol/interaction/Interaction.js'; import Interaction from '../../../src/ol/interaction/Interaction.js';
import _ol_interaction_MouseWheelZoom_ from '../../../src/ol/interaction/MouseWheelZoom.js'; import _ol_interaction_MouseWheelZoom_ from '../../../src/ol/interaction/MouseWheelZoom.js';
import _ol_interaction_PinchZoom_ from '../../../src/ol/interaction/PinchZoom.js'; import _ol_interaction_PinchZoom_ from '../../../src/ol/interaction/PinchZoom.js';
import _ol_layer_Tile_ from '../../../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../../../src/ol/layer/Tile.js';
@@ -77,7 +77,7 @@ describe('ol.Map', function() {
describe('#addInteraction()', function() { describe('#addInteraction()', function() {
it('adds an interaction to the map', function() { it('adds an interaction to the map', function() {
var map = new _ol_Map_({}); var map = new _ol_Map_({});
var interaction = new _ol_interaction_Interaction_({}); var interaction = new Interaction({});
var before = map.getInteractions().getLength(); var before = map.getInteractions().getLength();
map.addInteraction(interaction); map.addInteraction(interaction);
@@ -90,7 +90,7 @@ describe('ol.Map', function() {
describe('#removeInteraction()', function() { describe('#removeInteraction()', function() {
it('removes an interaction from the map', function() { it('removes an interaction from the map', function() {
var map = new _ol_Map_({}); var map = new _ol_Map_({});
var interaction = new _ol_interaction_Interaction_({}); var interaction = new Interaction({});
var before = map.getInteractions().getLength(); var before = map.getInteractions().getLength();
map.addInteraction(interaction); map.addInteraction(interaction);
@@ -524,7 +524,7 @@ describe('ol.Map', function() {
it('create double click interaction with default delta', function() { it('create double click interaction with default delta', function() {
var interactions = _ol_interaction_.defaults(options); var interactions = _ol_interaction_.defaults(options);
expect(interactions.getLength()).to.eql(1); expect(interactions.getLength()).to.eql(1);
expect(interactions.item(0)).to.be.a(_ol_interaction_DoubleClickZoom_); expect(interactions.item(0)).to.be.a(DoubleClickZoom);
expect(interactions.item(0).delta_).to.eql(1); expect(interactions.item(0).delta_).to.eql(1);
}); });
}); });
@@ -534,7 +534,7 @@ describe('ol.Map', function() {
options.zoomDelta = 7; options.zoomDelta = 7;
var interactions = _ol_interaction_.defaults(options); var interactions = _ol_interaction_.defaults(options);
expect(interactions.getLength()).to.eql(1); expect(interactions.getLength()).to.eql(1);
expect(interactions.item(0)).to.be.a(_ol_interaction_DoubleClickZoom_); expect(interactions.item(0)).to.be.a(DoubleClickZoom);
expect(interactions.item(0).delta_).to.eql(7); expect(interactions.item(0).delta_).to.eql(7);
}); });
}); });