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

View File

@@ -2,7 +2,7 @@ import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js';
import _ol_events_condition_ from '../src/ol/events/condition.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_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
@@ -39,7 +39,7 @@ map.addInteraction(select);
var selectedFeatures = select.getFeatures();
// 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
});

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_TopoJSON_ from '../src/ol/format/TopoJSON.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_Tile_ from '../src/ol/layer/Tile.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: [
_ol_format_GPX_,
_ol_format_GeoJSON_,

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_TopoJSON_ from '../src/ol/format/TopoJSON.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_Vector_ from '../src/ol/layer/Vector.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: [
_ol_format_GPX_,
_ol_format_GeoJSON_,

View File

@@ -1,14 +1,14 @@
import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js';
import _ol_interaction_ from '../src/ol/interaction.js';
import _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_source_OSM_ from '../src/ol/source/OSM.js';
var map = new _ol_Map_({
interactions: _ol_interaction_.defaults().extend([
new _ol_interaction_DragRotateAndZoom_()
new DragRotateAndZoom()
]),
layers: [
new _ol_layer_Tile_({

View File

@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.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_Snap_ from '../src/ol/interaction/Snap.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');
function addInteractions() {
draw = new _ol_interaction_Draw_({
draw = new Draw({
source: source,
type: typeSelect.value
});

View File

@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.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_Vector_ from '../src/ol/layer/Vector.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() {
var value = typeSelect.value;
if (value !== 'None') {
draw = new _ol_interaction_Draw_({
draw = new Draw({
source: source,
type: typeSelect.value
});

View File

@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.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_Vector_ from '../src/ol/layer/Vector.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() {
var value = typeSelect.value;
if (value !== 'None') {
draw = new _ol_interaction_Draw_({
draw = new Draw({
source: source,
type: typeSelect.value,
freehand: true

View File

@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
@@ -35,10 +35,10 @@ function addInteraction() {
var geometryFunction;
if (value === 'Square') {
value = 'Circle';
geometryFunction = _ol_interaction_Draw_.createRegularPolygon(4);
geometryFunction = Draw.createRegularPolygon(4);
} else if (value === 'Box') {
value = 'Circle';
geometryFunction = _ol_interaction_Draw_.createBox();
geometryFunction = Draw.createBox();
} else if (value === 'Star') {
value = 'Circle';
geometryFunction = function(coordinates, geometry) {
@@ -65,7 +65,7 @@ function addInteraction() {
return geometry;
};
}
draw = new _ol_interaction_Draw_({
draw = new Draw({
source: source,
type: value,
geometryFunction: geometryFunction

View File

@@ -3,7 +3,7 @@ import _ol_View_ from '../src/ol/View.js';
import _ol_control_ from '../src/ol/control.js';
import FullScreen from '../src/ol/control/FullScreen.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_source_BingMaps_ from '../src/ol/source/BingMaps.js';
@@ -13,7 +13,7 @@ var map = new _ol_Map_({
new FullScreen()
]),
interactions: _ol_interaction_.defaults().extend([
new _ol_interaction_DragRotateAndZoom_()
new DragRotateAndZoom()
]),
layers: [
new _ol_layer_Tile_({

View File

@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_Vector_ from '../src/ol/layer/Vector.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,
type: 'LineString'
}));

View File

@@ -5,7 +5,7 @@ import _ol_Sphere_ from '../src/ol/Sphere.js';
import _ol_View_ from '../src/ol/View.js';
import LineString from '../src/ol/geom/LineString.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_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
@@ -177,7 +177,7 @@ var formatArea = function(polygon) {
function addInteraction() {
var type = (typeSelect.value == 'area' ? 'Polygon' : 'LineString');
draw = new _ol_interaction_Draw_({
draw = new Draw({
source: source,
type: type,
style: new _ol_style_Style_({

View File

@@ -3,7 +3,7 @@ import _ol_View_ from '../src/ol/View.js';
import _ol_control_ from '../src/ol/control.js';
import OverviewMap from '../src/ol/control/OverviewMap.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_source_OSM_ from '../src/ol/source/OSM.js';
@@ -29,7 +29,7 @@ var map = new _ol_Map_({
overviewMapControl
]),
interactions: _ol_interaction_.defaults().extend([
new _ol_interaction_DragRotateAndZoom_()
new DragRotateAndZoom()
]),
layers: [
new _ol_layer_Tile_({

View File

@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.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_Select_ from '../src/ol/interaction/Select.js';
import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js';
@@ -73,7 +73,7 @@ Modify.init();
var optionsForm = document.getElementById('options-form');
var Draw = {
var ExampleDraw = {
init: function() {
map.addInteraction(this.Point);
this.Point.setActive(false);
@@ -84,19 +84,19 @@ var Draw = {
map.addInteraction(this.Circle);
this.Circle.setActive(false);
},
Point: new _ol_interaction_Draw_({
Point: new Draw({
source: vector.getSource(),
type: 'Point'
}),
LineString: new _ol_interaction_Draw_({
LineString: new Draw({
source: vector.getSource(),
type: 'LineString'
}),
Polygon: new _ol_interaction_Draw_({
Polygon: new Draw({
source: vector.getSource(),
type: 'Polygon'
}),
Circle: new _ol_interaction_Draw_({
Circle: new Draw({
source: vector.getSource(),
type: 'Circle'
}),
@@ -115,7 +115,7 @@ var Draw = {
}
}
};
Draw.init();
ExampleDraw.init();
/**

View File

@@ -7,7 +7,7 @@ import _ol_View_ from '../src/ol/View.js';
import Point from '../src/ol/geom/Point.js';
import LineString from '../src/ol/geom/LineString.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_layer_Tile_ from '../src/ol/layer/Tile.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'
});
draw.on('drawend', onDrawend);

View File

@@ -2,7 +2,7 @@ import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js';
import _ol_format_EsriJSON_ from '../src/ol/format/EsriJSON.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_Select_ from '../src/ol/interaction/Select.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,
type: 'Polygon'
});

View File

@@ -3,10 +3,10 @@
*/
import _ol_Collection_ from './Collection.js';
import _ol_Kinetic_ from './Kinetic.js';
import _ol_interaction_DoubleClickZoom_ from './interaction/DoubleClickZoom.js';
import _ol_interaction_DragPan_ from './interaction/DragPan.js';
import _ol_interaction_DragRotate_ from './interaction/DragRotate.js';
import _ol_interaction_DragZoom_ from './interaction/DragZoom.js';
import DoubleClickZoom from './interaction/DoubleClickZoom.js';
import DragPan from './interaction/DragPan.js';
import DragRotate from './interaction/DragRotate.js';
import DragZoom from './interaction/DragZoom.js';
import _ol_interaction_KeyboardPan_ from './interaction/KeyboardPan.js';
import _ol_interaction_KeyboardZoom_ from './interaction/KeyboardZoom.js';
import _ol_interaction_MouseWheelZoom_ from './interaction/MouseWheelZoom.js';
@@ -49,13 +49,13 @@ _ol_interaction_.defaults = function(opt_options) {
var altShiftDragRotate = options.altShiftDragRotate !== undefined ?
options.altShiftDragRotate : true;
if (altShiftDragRotate) {
interactions.push(new _ol_interaction_DragRotate_());
interactions.push(new DragRotate());
}
var doubleClickZoom = options.doubleClickZoom !== undefined ?
options.doubleClickZoom : true;
if (doubleClickZoom) {
interactions.push(new _ol_interaction_DoubleClickZoom_({
interactions.push(new DoubleClickZoom({
delta: options.zoomDelta,
duration: options.zoomDuration
}));
@@ -63,7 +63,7 @@ _ol_interaction_.defaults = function(opt_options) {
var dragPan = options.dragPan !== undefined ? options.dragPan : true;
if (dragPan) {
interactions.push(new _ol_interaction_DragPan_({
interactions.push(new DragPan({
kinetic: kinetic
}));
}
@@ -103,7 +103,7 @@ _ol_interaction_.defaults = function(opt_options) {
var shiftDragZoom = options.shiftDragZoom !== undefined ?
options.shiftDragZoom : true;
if (shiftDragZoom) {
interactions.push(new _ol_interaction_DragZoom_({
interactions.push(new DragZoom({
duration: options.zoomDuration
}));
}

View File

@@ -3,7 +3,7 @@
*/
import {inherits} from '../index.js';
import MapBrowserEventType from '../MapBrowserEventType.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import Interaction from '../interaction/Interaction.js';
/**
* @classdesc
@@ -14,7 +14,7 @@ import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
* @param {olx.interaction.DoubleClickZoomOptions=} opt_options Options.
* @api
*/
var _ol_interaction_DoubleClickZoom_ = function(opt_options) {
var DoubleClickZoom = function(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;
_ol_interaction_Interaction_.call(this, {
handleEvent: _ol_interaction_DoubleClickZoom_.handleEvent
Interaction.call(this, {
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}
* @api
*/
_ol_interaction_DoubleClickZoom_.handleEvent = function(mapBrowserEvent) {
DoubleClickZoom.handleEvent = function(mapBrowserEvent) {
var stopEvent = false;
var browserEvent = mapBrowserEvent.originalEvent;
if (mapBrowserEvent.type == MapBrowserEventType.DBLCLICK) {
@@ -55,11 +55,11 @@ _ol_interaction_DoubleClickZoom_.handleEvent = function(mapBrowserEvent) {
var anchor = mapBrowserEvent.coordinate;
var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
var view = map.getView();
_ol_interaction_Interaction_.zoomByDelta(
Interaction.zoomByDelta(
view, delta, anchor, this.duration_);
mapBrowserEvent.preventDefault();
stopEvent = true;
}
return !stopEvent;
};
export default _ol_interaction_DoubleClickZoom_;
export default DoubleClickZoom;

View File

@@ -8,7 +8,7 @@ import {TRUE} from '../functions.js';
import _ol_events_ from '../events.js';
import Event from '../events/Event.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';
/**
@@ -21,12 +21,12 @@ import {get as getProjection} from '../proj.js';
* @param {olx.interaction.DragAndDropOptions=} opt_options Options.
* @api
*/
var _ol_interaction_DragAndDrop_ = function(opt_options) {
var DragAndDrop = function(opt_options) {
var options = opt_options ? opt_options : {};
_ol_interaction_Interaction_.call(this, {
handleEvent: _ol_interaction_DragAndDrop_.handleEvent
Interaction.call(this, {
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}
* @private
*/
_ol_interaction_DragAndDrop_.handleDrop_ = function(event) {
DragAndDrop.handleDrop_ = function(event) {
var files = event.dataTransfer.files;
var i, ii, file;
for (i = 0, ii = files.length; i < ii; ++i) {
@@ -88,7 +88,7 @@ _ol_interaction_DragAndDrop_.handleDrop_ = function(event) {
* @param {Event} event Event.
* @private
*/
_ol_interaction_DragAndDrop_.handleStop_ = function(event) {
DragAndDrop.handleStop_ = function(event) {
event.stopPropagation();
event.preventDefault();
event.dataTransfer.dropEffect = 'copy';
@@ -100,7 +100,7 @@ _ol_interaction_DragAndDrop_.handleStop_ = function(event) {
* @param {Event} event Load event.
* @private
*/
_ol_interaction_DragAndDrop_.prototype.handleResult_ = function(file, event) {
DragAndDrop.prototype.handleResult_ = function(file, event) {
var result = event.target.result;
var map = this.getMap();
var projection = this.projection_;
@@ -134,8 +134,8 @@ _ol_interaction_DragAndDrop_.prototype.handleResult_ = function(file, event) {
this.source_.addFeatures(features);
}
this.dispatchEvent(
new _ol_interaction_DragAndDrop_.Event(
_ol_interaction_DragAndDrop_.EventType_.ADD_FEATURES, file,
new DragAndDrop.Event(
DragAndDrop.EventType_.ADD_FEATURES, file,
features, projection));
};
@@ -148,25 +148,25 @@ _ol_interaction_DragAndDrop_.prototype.handleResult_ = function(file, event) {
* @this {ol.interaction.DragAndDrop}
* @api
*/
_ol_interaction_DragAndDrop_.handleEvent = TRUE;
DragAndDrop.handleEvent = TRUE;
/**
* @private
*/
_ol_interaction_DragAndDrop_.prototype.registerListeners_ = function() {
DragAndDrop.prototype.registerListeners_ = function() {
var map = this.getMap();
if (map) {
var dropArea = this.target ? this.target : map.getViewport();
this.dropListenKeys_ = [
_ol_events_.listen(dropArea, EventType.DROP,
_ol_interaction_DragAndDrop_.handleDrop_, this),
DragAndDrop.handleDrop_, this),
_ol_events_.listen(dropArea, EventType.DRAGENTER,
_ol_interaction_DragAndDrop_.handleStop_, this),
DragAndDrop.handleStop_, this),
_ol_events_.listen(dropArea, EventType.DRAGOVER,
_ol_interaction_DragAndDrop_.handleStop_, this),
DragAndDrop.handleStop_, this),
_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
*/
_ol_interaction_DragAndDrop_.prototype.setActive = function(active) {
_ol_interaction_Interaction_.prototype.setActive.call(this, active);
DragAndDrop.prototype.setActive = function(active) {
Interaction.prototype.setActive.call(this, active);
if (active) {
this.registerListeners_();
} else {
@@ -188,9 +188,9 @@ _ol_interaction_DragAndDrop_.prototype.setActive = function(active) {
/**
* @inheritDoc
*/
_ol_interaction_DragAndDrop_.prototype.setMap = function(map) {
DragAndDrop.prototype.setMap = function(map) {
this.unregisterListeners_();
_ol_interaction_Interaction_.prototype.setMap.call(this, map);
Interaction.prototype.setMap.call(this, map);
if (this.getActive()) {
this.registerListeners_();
}
@@ -204,7 +204,7 @@ _ol_interaction_DragAndDrop_.prototype.setMap = function(map) {
* @private
* @return {Array.<ol.Feature>} Features.
*/
_ol_interaction_DragAndDrop_.prototype.tryReadFeatures_ = function(format, text, options) {
DragAndDrop.prototype.tryReadFeatures_ = function(format, text, options) {
try {
return format.readFeatures(text, options);
} catch (e) {
@@ -216,7 +216,7 @@ _ol_interaction_DragAndDrop_.prototype.tryReadFeatures_ = function(format, text,
/**
* @private
*/
_ol_interaction_DragAndDrop_.prototype.unregisterListeners_ = function() {
DragAndDrop.prototype.unregisterListeners_ = function() {
if (this.dropListenKeys_) {
this.dropListenKeys_.forEach(_ol_events_.unlistenByKey);
this.dropListenKeys_ = null;
@@ -228,7 +228,7 @@ _ol_interaction_DragAndDrop_.prototype.unregisterListeners_ = function() {
* @enum {string}
* @private
*/
_ol_interaction_DragAndDrop_.EventType_ = {
DragAndDrop.EventType_ = {
/**
* Triggered when features are added
* @event ol.interaction.DragAndDrop.Event#addfeatures
@@ -251,7 +251,7 @@ _ol_interaction_DragAndDrop_.EventType_ = {
* @param {Array.<ol.Feature>=} opt_features Features.
* @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);
@@ -277,5 +277,6 @@ _ol_interaction_DragAndDrop_.Event = function(type, file, opt_features, opt_proj
this.projection = opt_projection;
};
inherits(_ol_interaction_DragAndDrop_.Event, Event);
export default _ol_interaction_DragAndDrop_;
inherits(DragAndDrop.Event, Event);
export default DragAndDrop;

View File

@@ -25,12 +25,12 @@ import _ol_render_Box_ from '../render/Box.js';
* @param {olx.interaction.DragBoxOptions=} opt_options Options.
* @api
*/
var _ol_interaction_DragBox_ = function(opt_options) {
var DragBox = function(opt_options) {
_ol_interaction_Pointer_.call(this, {
handleDownEvent: _ol_interaction_DragBox_.handleDownEvent_,
handleDragEvent: _ol_interaction_DragBox_.handleDragEvent_,
handleUpEvent: _ol_interaction_DragBox_.handleUpEvent_
handleDownEvent: DragBox.handleDownEvent_,
handleDragEvent: DragBox.handleDragEvent_,
handleUpEvent: DragBox.handleUpEvent_
});
var options = opt_options ? opt_options : {};
@@ -65,10 +65,10 @@ var _ol_interaction_DragBox_ = function(opt_options) {
* @type {ol.DragBoxEndConditionType}
*/
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.
* @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 height = endPixel[1] - startPixel[1];
return width * width + height * height >= this.minArea_;
@@ -93,14 +93,14 @@ _ol_interaction_DragBox_.defaultBoxEndCondition = function(mapBrowserEvent, star
* @this {ol.interaction.DragBox}
* @private
*/
_ol_interaction_DragBox_.handleDragEvent_ = function(mapBrowserEvent) {
DragBox.handleDragEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return;
}
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));
};
@@ -110,7 +110,7 @@ _ol_interaction_DragBox_.handleDragEvent_ = function(mapBrowserEvent) {
* @return {ol.geom.Polygon} Geometry.
* @api
*/
_ol_interaction_DragBox_.prototype.getGeometry = function() {
DragBox.prototype.getGeometry = function() {
return this.box_.getGeometry();
};
@@ -121,7 +121,7 @@ _ol_interaction_DragBox_.prototype.getGeometry = function() {
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @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}
* @private
*/
_ol_interaction_DragBox_.handleUpEvent_ = function(mapBrowserEvent) {
DragBox.handleUpEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return true;
}
@@ -140,7 +140,7 @@ _ol_interaction_DragBox_.handleUpEvent_ = function(mapBrowserEvent) {
if (this.boxEndCondition_(mapBrowserEvent,
this.startPixel_, mapBrowserEvent.pixel)) {
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));
}
return false;
@@ -153,7 +153,7 @@ _ol_interaction_DragBox_.handleUpEvent_ = function(mapBrowserEvent) {
* @this {ol.interaction.DragBox}
* @private
*/
_ol_interaction_DragBox_.handleDownEvent_ = function(mapBrowserEvent) {
DragBox.handleDownEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return false;
}
@@ -163,7 +163,7 @@ _ol_interaction_DragBox_.handleDownEvent_ = function(mapBrowserEvent) {
this.startPixel_ = mapBrowserEvent.pixel;
this.box_.setMap(mapBrowserEvent.map);
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));
return true;
} else {
@@ -176,7 +176,7 @@ _ol_interaction_DragBox_.handleDownEvent_ = function(mapBrowserEvent) {
* @enum {string}
* @private
*/
_ol_interaction_DragBox_.EventType_ = {
DragBox.EventType_ = {
/**
* Triggered upon drag box start.
* @event ol.interaction.DragBox.Event#boxstart
@@ -212,7 +212,7 @@ _ol_interaction_DragBox_.EventType_ = {
* @constructor
* @implements {oli.DragBoxEvent}
*/
_ol_interaction_DragBox_.Event = function(type, coordinate, mapBrowserEvent) {
DragBox.Event = function(type, coordinate, mapBrowserEvent) {
Event.call(this, type);
/**
@@ -231,5 +231,6 @@ _ol_interaction_DragBox_.Event = function(type, coordinate, mapBrowserEvent) {
this.mapBrowserEvent = mapBrowserEvent;
};
inherits(_ol_interaction_DragBox_.Event, Event);
export default _ol_interaction_DragBox_;
inherits(DragBox.Event, Event);
export default DragBox;

View File

@@ -18,12 +18,12 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
* @param {olx.interaction.DragPanOptions=} opt_options Options.
* @api
*/
var _ol_interaction_DragPan_ = function(opt_options) {
var DragPan = function(opt_options) {
_ol_interaction_Pointer_.call(this, {
handleDownEvent: _ol_interaction_DragPan_.handleDownEvent_,
handleDragEvent: _ol_interaction_DragPan_.handleDragEvent_,
handleUpEvent: _ol_interaction_DragPan_.handleUpEvent_
handleDownEvent: DragPan.handleDownEvent_,
handleDragEvent: DragPan.handleDragEvent_,
handleUpEvent: DragPan.handleUpEvent_
});
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}
* @private
*/
_ol_interaction_DragPan_.handleDragEvent_ = function(mapBrowserEvent) {
DragPan.handleDragEvent_ = function(mapBrowserEvent) {
var targetPointers = this.targetPointers;
var centroid =
_ol_interaction_Pointer_.centroid(targetPointers);
@@ -104,7 +104,7 @@ _ol_interaction_DragPan_.handleDragEvent_ = function(mapBrowserEvent) {
* @this {ol.interaction.DragPan}
* @private
*/
_ol_interaction_DragPan_.handleUpEvent_ = function(mapBrowserEvent) {
DragPan.handleUpEvent_ = function(mapBrowserEvent) {
var map = mapBrowserEvent.map;
var view = map.getView();
if (this.targetPointers.length === 0) {
@@ -143,7 +143,7 @@ _ol_interaction_DragPan_.handleUpEvent_ = function(mapBrowserEvent) {
* @this {ol.interaction.DragPan}
* @private
*/
_ol_interaction_DragPan_.handleDownEvent_ = function(mapBrowserEvent) {
DragPan.handleDownEvent_ = function(mapBrowserEvent) {
if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) {
var map = mapBrowserEvent.map;
var view = map.getView();
@@ -171,5 +171,5 @@ _ol_interaction_DragPan_.handleDownEvent_ = function(mapBrowserEvent) {
/**
* @inheritDoc
*/
_ol_interaction_DragPan_.prototype.shouldStopEvent = FALSE;
export default _ol_interaction_DragPan_;
DragPan.prototype.shouldStopEvent = FALSE;
export default DragPan;

View File

@@ -6,7 +6,7 @@ import _ol_RotationConstraint_ from '../RotationConstraint.js';
import _ol_ViewHint_ from '../ViewHint.js';
import _ol_events_condition_ from '../events/condition.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';
/**
@@ -22,14 +22,14 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
* @param {olx.interaction.DragRotateOptions=} opt_options Options.
* @api
*/
var _ol_interaction_DragRotate_ = function(opt_options) {
var DragRotate = function(opt_options) {
var options = opt_options ? opt_options : {};
_ol_interaction_Pointer_.call(this, {
handleDownEvent: _ol_interaction_DragRotate_.handleDownEvent_,
handleDragEvent: _ol_interaction_DragRotate_.handleDragEvent_,
handleUpEvent: _ol_interaction_DragRotate_.handleUpEvent_
handleDownEvent: DragRotate.handleDownEvent_,
handleDragEvent: DragRotate.handleDragEvent_,
handleUpEvent: DragRotate.handleUpEvent_
});
/**
@@ -52,7 +52,7 @@ var _ol_interaction_DragRotate_ = function(opt_options) {
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}
* @private
*/
_ol_interaction_DragRotate_.handleDragEvent_ = function(mapBrowserEvent) {
DragRotate.handleDragEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return;
}
@@ -77,7 +77,7 @@ _ol_interaction_DragRotate_.handleDragEvent_ = function(mapBrowserEvent) {
if (this.lastAngle_ !== undefined) {
var delta = theta - this.lastAngle_;
var rotation = view.getRotation();
_ol_interaction_Interaction_.rotateWithoutConstraints(
Interaction.rotateWithoutConstraints(
view, rotation - delta);
}
this.lastAngle_ = theta;
@@ -90,7 +90,7 @@ _ol_interaction_DragRotate_.handleDragEvent_ = function(mapBrowserEvent) {
* @this {ol.interaction.DragRotate}
* @private
*/
_ol_interaction_DragRotate_.handleUpEvent_ = function(mapBrowserEvent) {
DragRotate.handleUpEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return true;
}
@@ -99,7 +99,7 @@ _ol_interaction_DragRotate_.handleUpEvent_ = function(mapBrowserEvent) {
var view = map.getView();
view.setHint(_ol_ViewHint_.INTERACTING, -1);
var rotation = view.getRotation();
_ol_interaction_Interaction_.rotate(view, rotation,
Interaction.rotate(view, rotation,
undefined, this.duration_);
return false;
};
@@ -111,7 +111,7 @@ _ol_interaction_DragRotate_.handleUpEvent_ = function(mapBrowserEvent) {
* @this {ol.interaction.DragRotate}
* @private
*/
_ol_interaction_DragRotate_.handleDownEvent_ = function(mapBrowserEvent) {
DragRotate.handleDownEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return false;
}
@@ -131,5 +131,5 @@ _ol_interaction_DragRotate_.handleDownEvent_ = function(mapBrowserEvent) {
/**
* @inheritDoc
*/
_ol_interaction_DragRotate_.prototype.shouldStopEvent = FALSE;
export default _ol_interaction_DragRotate_;
DragRotate.prototype.shouldStopEvent = FALSE;
export default DragRotate;

View File

@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
import _ol_RotationConstraint_ from '../RotationConstraint.js';
import _ol_ViewHint_ from '../ViewHint.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';
/**
@@ -23,14 +23,14 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
* @param {olx.interaction.DragRotateAndZoomOptions=} opt_options Options.
* @api
*/
var _ol_interaction_DragRotateAndZoom_ = function(opt_options) {
var DragRotateAndZoom = function(opt_options) {
var options = opt_options ? opt_options : {};
_ol_interaction_Pointer_.call(this, {
handleDownEvent: _ol_interaction_DragRotateAndZoom_.handleDownEvent_,
handleDragEvent: _ol_interaction_DragRotateAndZoom_.handleDragEvent_,
handleUpEvent: _ol_interaction_DragRotateAndZoom_.handleUpEvent_
handleDownEvent: DragRotateAndZoom.handleDownEvent_,
handleDragEvent: DragRotateAndZoom.handleDragEvent_,
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}
* @private
*/
_ol_interaction_DragRotateAndZoom_.handleDragEvent_ = function(mapBrowserEvent) {
DragRotateAndZoom.handleDragEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return;
}
@@ -89,13 +89,13 @@ _ol_interaction_DragRotateAndZoom_.handleDragEvent_ = function(mapBrowserEvent)
var view = map.getView();
if (view.getConstraints().rotation !== _ol_RotationConstraint_.disable && this.lastAngle_ !== undefined) {
var angleDelta = theta - this.lastAngle_;
_ol_interaction_Interaction_.rotateWithoutConstraints(
Interaction.rotateWithoutConstraints(
view, view.getRotation() - angleDelta);
}
this.lastAngle_ = theta;
if (this.lastMagnitude_ !== undefined) {
var resolution = this.lastMagnitude_ * (view.getResolution() / magnitude);
_ol_interaction_Interaction_.zoomWithoutConstraints(view, resolution);
Interaction.zoomWithoutConstraints(view, resolution);
}
if (this.lastMagnitude_ !== undefined) {
this.lastScaleDelta_ = this.lastMagnitude_ / magnitude;
@@ -110,7 +110,7 @@ _ol_interaction_DragRotateAndZoom_.handleDragEvent_ = function(mapBrowserEvent)
* @this {ol.interaction.DragRotateAndZoom}
* @private
*/
_ol_interaction_DragRotateAndZoom_.handleUpEvent_ = function(mapBrowserEvent) {
DragRotateAndZoom.handleUpEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return true;
}
@@ -119,8 +119,8 @@ _ol_interaction_DragRotateAndZoom_.handleUpEvent_ = function(mapBrowserEvent) {
var view = map.getView();
view.setHint(_ol_ViewHint_.INTERACTING, -1);
var direction = this.lastScaleDelta_ - 1;
_ol_interaction_Interaction_.rotate(view, view.getRotation());
_ol_interaction_Interaction_.zoom(view, view.getResolution(),
Interaction.rotate(view, view.getRotation());
Interaction.zoom(view, view.getResolution(),
undefined, this.duration_, direction);
this.lastScaleDelta_ = 0;
return false;
@@ -133,7 +133,7 @@ _ol_interaction_DragRotateAndZoom_.handleUpEvent_ = function(mapBrowserEvent) {
* @this {ol.interaction.DragRotateAndZoom}
* @private
*/
_ol_interaction_DragRotateAndZoom_.handleDownEvent_ = function(mapBrowserEvent) {
DragRotateAndZoom.handleDownEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
return false;
}
@@ -147,4 +147,4 @@ _ol_interaction_DragRotateAndZoom_.handleDownEvent_ = function(mapBrowserEvent)
return false;
}
};
export default _ol_interaction_DragRotateAndZoom_;
export default DragRotateAndZoom;

View File

@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
import {easeOut} from '../easing.js';
import _ol_events_condition_ from '../events/condition.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
@@ -21,7 +21,7 @@ import _ol_interaction_DragBox_ from '../interaction/DragBox.js';
* @param {olx.interaction.DragZoomOptions=} opt_options Options.
* @api
*/
var _ol_interaction_DragZoom_ = function(opt_options) {
var DragZoom = function(opt_options) {
var options = opt_options ? opt_options : {};
var condition = options.condition ?
@@ -39,20 +39,20 @@ var _ol_interaction_DragZoom_ = function(opt_options) {
*/
this.out_ = options.out !== undefined ? options.out : false;
_ol_interaction_DragBox_.call(this, {
DragBox.call(this, {
condition: condition,
className: options.className || 'ol-dragzoom'
});
};
inherits(_ol_interaction_DragZoom_, _ol_interaction_DragBox_);
inherits(DragZoom, DragBox);
/**
* @inheritDoc
*/
_ol_interaction_DragZoom_.prototype.onBoxEnd = function() {
DragZoom.prototype.onBoxEnd = function() {
var map = this.getMap();
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;

View File

@@ -36,12 +36,12 @@ import _ol_style_Style_ from '../style/Style.js';
* @param {olx.interaction.DrawOptions} options Options.
* @api
*/
var _ol_interaction_Draw_ = function(options) {
var Draw = function(options) {
_ol_interaction_Pointer_.call(this, {
handleDownEvent: _ol_interaction_Draw_.handleDownEvent_,
handleEvent: _ol_interaction_Draw_.handleEvent,
handleUpEvent: _ol_interaction_Draw_.handleUpEvent_
handleDownEvent: Draw.handleDownEvent_,
handleEvent: Draw.handleEvent,
handleUpEvent: Draw.handleUpEvent_
});
/**
@@ -95,7 +95,7 @@ var _ol_interaction_Draw_ = function(options) {
* @type {ol.interaction.Draw.Mode_}
* @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.
@@ -114,7 +114,7 @@ var _ol_interaction_Draw_ = function(options) {
*/
this.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
@@ -151,11 +151,11 @@ var _ol_interaction_Draw_ = function(options) {
} else {
var Constructor;
var mode = this.mode_;
if (mode === _ol_interaction_Draw_.Mode_.POINT) {
if (mode === Draw.Mode_.POINT) {
Constructor = Point;
} else if (mode === _ol_interaction_Draw_.Mode_.LINE_STRING) {
} else if (mode === Draw.Mode_.LINE_STRING) {
Constructor = LineString;
} else if (mode === _ol_interaction_Draw_.Mode_.POLYGON) {
} else if (mode === Draw.Mode_.POLYGON) {
Constructor = Polygon;
}
/**
@@ -167,7 +167,7 @@ var _ol_interaction_Draw_ = function(options) {
geometryFunction = function(coordinates, opt_geometry) {
var geometry = opt_geometry;
if (geometry) {
if (mode === _ol_interaction_Draw_.Mode_.POLYGON) {
if (mode === Draw.Mode_.POLYGON) {
if (coordinates[0].length) {
// Add a closing coordinate to match the first
geometry.setCoordinates([coordinates[0].concat([coordinates[0][0]])]);
@@ -255,7 +255,7 @@ var _ol_interaction_Draw_ = function(options) {
wrapX: options.wrapX ? options.wrapX : false
}),
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.
*/
_ol_interaction_Draw_.getDefaultStyleFunction = function() {
Draw.getDefaultStyleFunction = function() {
var styles = _ol_style_Style_.createDefaultEditing();
return function(feature, resolution) {
return styles[feature.getGeometry().getType()];
@@ -307,7 +307,7 @@ _ol_interaction_Draw_.getDefaultStyleFunction = function() {
/**
* @inheritDoc
*/
_ol_interaction_Draw_.prototype.setMap = function(map) {
Draw.prototype.setMap = function(map) {
_ol_interaction_Pointer_.prototype.setMap.call(this, map);
this.updateState_();
};
@@ -321,8 +321,8 @@ _ol_interaction_Draw_.prototype.setMap = function(map) {
* @this {ol.interaction.Draw}
* @api
*/
_ol_interaction_Draw_.handleEvent = function(event) {
this.freehand_ = this.mode_ !== _ol_interaction_Draw_.Mode_.POINT && this.freehandCondition_(event);
Draw.handleEvent = function(event) {
this.freehand_ = this.mode_ !== Draw.Mode_.POINT && this.freehandCondition_(event);
var pass = true;
if (this.freehand_ &&
event.type === MapBrowserEventType.POINTERDRAG &&
@@ -347,7 +347,7 @@ _ol_interaction_Draw_.handleEvent = function(event) {
* @this {ol.interaction.Draw}
* @private
*/
_ol_interaction_Draw_.handleDownEvent_ = function(event) {
Draw.handleDownEvent_ = function(event) {
this.shouldHandle_ = !this.freehand_;
if (this.freehand_) {
@@ -371,17 +371,17 @@ _ol_interaction_Draw_.handleDownEvent_ = function(event) {
* @this {ol.interaction.Draw}
* @private
*/
_ol_interaction_Draw_.handleUpEvent_ = function(event) {
Draw.handleUpEvent_ = function(event) {
var pass = true;
this.handlePointerMove_(event);
var circleMode = this.mode_ === _ol_interaction_Draw_.Mode_.CIRCLE;
var circleMode = this.mode_ === Draw.Mode_.CIRCLE;
if (this.shouldHandle_) {
if (!this.finishCoordinate_) {
this.startDrawing_(event);
if (this.mode_ === _ol_interaction_Draw_.Mode_.POINT) {
if (this.mode_ === Draw.Mode_.POINT) {
this.finishDrawing();
}
} else if (this.freehand_ || circleMode) {
@@ -411,7 +411,7 @@ _ol_interaction_Draw_.handleUpEvent_ = function(event) {
* @return {boolean} Pass the event to other interactions.
* @private
*/
_ol_interaction_Draw_.prototype.handlePointerMove_ = function(event) {
Draw.prototype.handlePointerMove_ = function(event) {
if (this.downPx_ &&
((!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.
* @private
*/
_ol_interaction_Draw_.prototype.atFinish_ = function(event) {
Draw.prototype.atFinish_ = function(event) {
var at = false;
if (this.sketchFeature_) {
var potentiallyDone = false;
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_;
} else if (this.mode_ === _ol_interaction_Draw_.Mode_.POLYGON) {
} else if (this.mode_ === Draw.Mode_.POLYGON) {
potentiallyDone = this.sketchCoords_[0].length >
this.minPoints_;
potentiallyFinishCoordinates = [this.sketchCoords_[0][0],
@@ -478,7 +478,7 @@ _ol_interaction_Draw_.prototype.atFinish_ = function(event) {
* @param {ol.MapBrowserEvent} event Event.
* @private
*/
_ol_interaction_Draw_.prototype.createOrUpdateSketchPoint_ = function(event) {
Draw.prototype.createOrUpdateSketchPoint_ = function(event) {
var coordinates = event.coordinate.slice();
if (!this.sketchPoint_) {
this.sketchPoint_ = new _ol_Feature_(new Point(coordinates));
@@ -495,17 +495,17 @@ _ol_interaction_Draw_.prototype.createOrUpdateSketchPoint_ = function(event) {
* @param {ol.MapBrowserEvent} event Event.
* @private
*/
_ol_interaction_Draw_.prototype.startDrawing_ = function(event) {
Draw.prototype.startDrawing_ = function(event) {
var start = event.coordinate;
this.finishCoordinate_ = start;
if (this.mode_ === _ol_interaction_Draw_.Mode_.POINT) {
if (this.mode_ === Draw.Mode_.POINT) {
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.sketchLineCoords_ = this.sketchCoords_[0];
} else {
this.sketchCoords_ = [start.slice(), start.slice()];
if (this.mode_ === _ol_interaction_Draw_.Mode_.CIRCLE) {
if (this.mode_ === Draw.Mode_.CIRCLE) {
this.sketchLineCoords_ = this.sketchCoords_;
}
}
@@ -520,7 +520,7 @@ _ol_interaction_Draw_.prototype.startDrawing_ = function(event) {
}
this.sketchFeature_.setGeometry(geometry);
this.updateSketchFeatures_();
this.dispatchEvent(new _ol_interaction_Draw_.Event(
this.dispatchEvent(new Draw.Event(
_ol_interaction_DrawEventType_.DRAWSTART, this.sketchFeature_));
};
@@ -530,13 +530,13 @@ _ol_interaction_Draw_.prototype.startDrawing_ = function(event) {
* @param {ol.MapBrowserEvent} event Event.
* @private
*/
_ol_interaction_Draw_.prototype.modifyDrawing_ = function(event) {
Draw.prototype.modifyDrawing_ = function(event) {
var coordinate = event.coordinate;
var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry());
var coordinates, last;
if (this.mode_ === _ol_interaction_Draw_.Mode_.POINT) {
if (this.mode_ === Draw.Mode_.POINT) {
last = this.sketchCoords_;
} else if (this.mode_ === _ol_interaction_Draw_.Mode_.POLYGON) {
} else if (this.mode_ === Draw.Mode_.POLYGON) {
coordinates = this.sketchCoords_[0];
last = coordinates[coordinates.length - 1];
if (this.atFinish_(event)) {
@@ -556,7 +556,7 @@ _ol_interaction_Draw_.prototype.modifyDrawing_ = function(event) {
}
var sketchLineGeom;
if (geometry instanceof Polygon &&
this.mode_ !== _ol_interaction_Draw_.Mode_.POLYGON) {
this.mode_ !== Draw.Mode_.POLYGON) {
if (!this.sketchLine_) {
this.sketchLine_ = new _ol_Feature_(new LineString(null));
}
@@ -577,12 +577,12 @@ _ol_interaction_Draw_.prototype.modifyDrawing_ = function(event) {
* @param {ol.MapBrowserEvent} event Event.
* @private
*/
_ol_interaction_Draw_.prototype.addToDrawing_ = function(event) {
Draw.prototype.addToDrawing_ = function(event) {
var coordinate = event.coordinate;
var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry());
var done;
var coordinates;
if (this.mode_ === _ol_interaction_Draw_.Mode_.LINE_STRING) {
if (this.mode_ === Draw.Mode_.LINE_STRING) {
this.finishCoordinate_ = coordinate.slice();
coordinates = this.sketchCoords_;
if (coordinates.length >= this.maxPoints_) {
@@ -594,7 +594,7 @@ _ol_interaction_Draw_.prototype.addToDrawing_ = function(event) {
}
coordinates.push(coordinate.slice());
this.geometryFunction_(coordinates, geometry);
} else if (this.mode_ === _ol_interaction_Draw_.Mode_.POLYGON) {
} else if (this.mode_ === Draw.Mode_.POLYGON) {
coordinates = this.sketchCoords_[0];
if (coordinates.length >= this.maxPoints_) {
if (this.freehand_) {
@@ -620,20 +620,20 @@ _ol_interaction_Draw_.prototype.addToDrawing_ = function(event) {
* Remove last point of the feature currently being drawn.
* @api
*/
_ol_interaction_Draw_.prototype.removeLastPoint = function() {
Draw.prototype.removeLastPoint = function() {
if (!this.sketchFeature_) {
return;
}
var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry());
var coordinates, sketchLineGeom;
if (this.mode_ === _ol_interaction_Draw_.Mode_.LINE_STRING) {
if (this.mode_ === Draw.Mode_.LINE_STRING) {
coordinates = this.sketchCoords_;
coordinates.splice(-2, 1);
this.geometryFunction_(coordinates, geometry);
if (coordinates.length >= 2) {
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.splice(-2, 1);
sketchLineGeom = /** @type {ol.geom.LineString} */ (this.sketchLine_.getGeometry());
@@ -655,15 +655,15 @@ _ol_interaction_Draw_.prototype.removeLastPoint = function() {
* inserting the feature.
* @api
*/
_ol_interaction_Draw_.prototype.finishDrawing = function() {
Draw.prototype.finishDrawing = function() {
var sketchFeature = this.abortDrawing_();
var coordinates = this.sketchCoords_;
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
coordinates.pop();
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
coordinates[0].pop();
this.geometryFunction_(coordinates, geometry);
@@ -680,7 +680,7 @@ _ol_interaction_Draw_.prototype.finishDrawing = function() {
}
// 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));
// Then insert feature
@@ -698,7 +698,7 @@ _ol_interaction_Draw_.prototype.finishDrawing = function() {
* @return {ol.Feature} The sketch feature (or null if none).
* @private
*/
_ol_interaction_Draw_.prototype.abortDrawing_ = function() {
Draw.prototype.abortDrawing_ = function() {
this.finishCoordinate_ = null;
var sketchFeature = this.sketchFeature_;
if (sketchFeature) {
@@ -718,7 +718,7 @@ _ol_interaction_Draw_.prototype.abortDrawing_ = function() {
* @param {!ol.Feature} feature Feature to be extended.
* @api
*/
_ol_interaction_Draw_.prototype.extend = function(feature) {
Draw.prototype.extend = function(feature) {
var geometry = feature.getGeometry();
var lineString = /** @type {ol.geom.LineString} */ (geometry);
this.sketchFeature_ = feature;
@@ -727,7 +727,7 @@ _ol_interaction_Draw_.prototype.extend = function(feature) {
this.finishCoordinate_ = last.slice();
this.sketchCoords_.push(last.slice());
this.updateSketchFeatures_();
this.dispatchEvent(new _ol_interaction_Draw_.Event(
this.dispatchEvent(new Draw.Event(
_ol_interaction_DrawEventType_.DRAWSTART, this.sketchFeature_));
};
@@ -735,14 +735,14 @@ _ol_interaction_Draw_.prototype.extend = function(feature) {
/**
* @inheritDoc
*/
_ol_interaction_Draw_.prototype.shouldStopEvent = FALSE;
Draw.prototype.shouldStopEvent = FALSE;
/**
* Redraw the sketch features.
* @private
*/
_ol_interaction_Draw_.prototype.updateSketchFeatures_ = function() {
Draw.prototype.updateSketchFeatures_ = function() {
var sketchFeatures = [];
if (this.sketchFeature_) {
sketchFeatures.push(this.sketchFeature_);
@@ -762,7 +762,7 @@ _ol_interaction_Draw_.prototype.updateSketchFeatures_ = function() {
/**
* @private
*/
_ol_interaction_Draw_.prototype.updateState_ = function() {
Draw.prototype.updateState_ = function() {
var map = this.getMap();
var active = this.getActive();
if (!map || !active) {
@@ -785,7 +785,7 @@ _ol_interaction_Draw_.prototype.updateState_ = function() {
* polygon.
* @api
*/
_ol_interaction_Draw_.createRegularPolygon = function(opt_sides, opt_angle) {
Draw.createRegularPolygon = function(opt_sides, opt_angle) {
return (
/**
* @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.
* @api
*/
_ol_interaction_Draw_.createBox = function() {
Draw.createBox = function() {
return (
/**
* @param {Array.<ol.Coordinate>} coordinates
@@ -845,19 +845,19 @@ _ol_interaction_Draw_.createBox = function() {
* @return {ol.interaction.Draw.Mode_} Drawing mode.
* @private
*/
_ol_interaction_Draw_.getMode_ = function(type) {
Draw.getMode_ = function(type) {
var mode;
if (type === GeometryType.POINT ||
type === GeometryType.MULTI_POINT) {
mode = _ol_interaction_Draw_.Mode_.POINT;
mode = Draw.Mode_.POINT;
} else if (type === GeometryType.LINE_STRING ||
type === GeometryType.MULTI_LINE_STRING) {
mode = _ol_interaction_Draw_.Mode_.LINE_STRING;
mode = Draw.Mode_.LINE_STRING;
} else if (type === GeometryType.POLYGON ||
type === GeometryType.MULTI_POLYGON) {
mode = _ol_interaction_Draw_.Mode_.POLYGON;
mode = Draw.Mode_.POLYGON;
} else if (type === GeometryType.CIRCLE) {
mode = _ol_interaction_Draw_.Mode_.CIRCLE;
mode = Draw.Mode_.CIRCLE;
}
return /** @type {!ol.interaction.Draw.Mode_} */ (mode);
};
@@ -869,7 +869,7 @@ _ol_interaction_Draw_.getMode_ = function(type) {
* @enum {string}
* @private
*/
_ol_interaction_Draw_.Mode_ = {
Draw.Mode_ = {
POINT: 'Point',
LINE_STRING: 'LineString',
POLYGON: 'Polygon',
@@ -887,7 +887,7 @@ _ol_interaction_Draw_.Mode_ = {
* @param {ol.interaction.DrawEventType} type Type.
* @param {ol.Feature} feature The feature drawn.
*/
_ol_interaction_Draw_.Event = function(type, feature) {
Draw.Event = function(type, feature) {
Event.call(this, type);
@@ -899,5 +899,6 @@ _ol_interaction_Draw_.Event = function(type, feature) {
this.feature = feature;
};
inherits(_ol_interaction_Draw_.Event, Event);
export default _ol_interaction_Draw_;
inherits(Draw.Event, Event);
export default Draw;

View File

@@ -26,7 +26,7 @@ import _ol_math_ from '../math.js';
* @extends {ol.Object}
* @api
*/
var _ol_interaction_Interaction_ = function(options) {
var Interaction = function(options) {
_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
* @api
*/
_ol_interaction_Interaction_.prototype.getActive = function() {
Interaction.prototype.getActive = function() {
return (
/** @type {boolean} */ this.get(_ol_interaction_Property_.ACTIVE)
);
@@ -66,7 +66,7 @@ _ol_interaction_Interaction_.prototype.getActive = function() {
* @return {ol.PluggableMap} Map.
* @api
*/
_ol_interaction_Interaction_.prototype.getMap = function() {
Interaction.prototype.getMap = function() {
return this.map_;
};
@@ -77,7 +77,7 @@ _ol_interaction_Interaction_.prototype.getMap = function() {
* @observable
* @api
*/
_ol_interaction_Interaction_.prototype.setActive = function(active) {
Interaction.prototype.setActive = function(active) {
this.set(_ol_interaction_Property_.ACTIVE, active);
};
@@ -88,7 +88,7 @@ _ol_interaction_Interaction_.prototype.setActive = function(active) {
* the map here.
* @param {ol.PluggableMap} map Map.
*/
_ol_interaction_Interaction_.prototype.setMap = function(map) {
Interaction.prototype.setMap = function(map) {
this.map_ = map;
};
@@ -98,7 +98,7 @@ _ol_interaction_Interaction_.prototype.setMap = function(map) {
* @param {ol.Coordinate} delta Delta.
* @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();
if (currentCenter) {
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 {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);
_ol_interaction_Interaction_.rotateWithoutConstraints(
Interaction.rotateWithoutConstraints(
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 {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) {
var currentRotation = view.getRotation();
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
* 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);
_ol_interaction_Interaction_.zoomWithoutConstraints(
Interaction.zoomWithoutConstraints(
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 {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 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);
};
@@ -219,7 +219,7 @@ _ol_interaction_Interaction_.zoomByDelta = function(view, delta, opt_anchor, opt
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @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) {
var currentResolution = view.getResolution();
var currentCenter = view.getCenter();
@@ -240,4 +240,4 @@ _ol_interaction_Interaction_.zoomWithoutConstraints = function(view, resolution,
}
}
};
export default _ol_interaction_Interaction_;
export default Interaction;

View File

@@ -6,7 +6,7 @@ import _ol_coordinate_ from '../coordinate.js';
import EventType from '../events/EventType.js';
import _ol_events_KeyCode_ from '../events/KeyCode.js';
import _ol_events_condition_ from '../events/condition.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import Interaction from '../interaction/Interaction.js';
/**
* @classdesc
@@ -27,7 +27,7 @@ import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
*/
var _ol_interaction_KeyboardPan_ = function(opt_options) {
_ol_interaction_Interaction_.call(this, {
Interaction.call(this, {
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
@@ -101,7 +101,7 @@ _ol_interaction_KeyboardPan_.handleEvent = function(mapBrowserEvent) {
}
var delta = [deltaX, deltaY];
_ol_coordinate_.rotate(delta, view.getRotation());
_ol_interaction_Interaction_.pan(view, delta, this.duration_);
Interaction.pan(view, delta, this.duration_);
mapBrowserEvent.preventDefault();
stopEvent = true;
}

View File

@@ -4,7 +4,7 @@
import {inherits} from '../index.js';
import EventType from '../events/EventType.js';
import _ol_events_condition_ from '../events/condition.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import Interaction from '../interaction/Interaction.js';
/**
* @classdesc
@@ -25,7 +25,7 @@ import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
*/
var _ol_interaction_KeyboardZoom_ = function(opt_options) {
_ol_interaction_Interaction_.call(this, {
Interaction.call(this, {
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 delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_;
var view = map.getView();
_ol_interaction_Interaction_.zoomByDelta(
Interaction.zoomByDelta(
view, delta, undefined, this.duration_);
mapBrowserEvent.preventDefault();
stopEvent = true;

View File

@@ -6,7 +6,7 @@ import _ol_ViewHint_ from '../ViewHint.js';
import {easeOut} from '../easing.js';
import EventType from '../events/EventType.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';
@@ -27,7 +27,7 @@ var MAX_DELTA = 1;
*/
var _ol_interaction_MouseWheelZoom_ = function(opt_options) {
_ol_interaction_Interaction_.call(this, {
Interaction.call(this, {
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 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.mode_ = undefined;
this.delta_ = 0;

View File

@@ -4,7 +4,7 @@
import {inherits} from '../index.js';
import _ol_ViewHint_ from '../ViewHint.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_RotationConstraint_ from '../RotationConstraint.js';
@@ -115,7 +115,7 @@ _ol_interaction_PinchRotate_.handleDragEvent_ = function(mapBrowserEvent) {
if (this.rotating_) {
var rotation = view.getRotation();
map.render();
_ol_interaction_Interaction_.rotateWithoutConstraints(view,
Interaction.rotateWithoutConstraints(view,
rotation + rotationDelta, this.anchor_);
}
};
@@ -134,7 +134,7 @@ _ol_interaction_PinchRotate_.handleUpEvent_ = function(mapBrowserEvent) {
view.setHint(_ol_ViewHint_.INTERACTING, -1);
if (this.rotating_) {
var rotation = view.getRotation();
_ol_interaction_Interaction_.rotate(
Interaction.rotate(
view, rotation, this.anchor_, this.duration_);
}
return false;

View File

@@ -4,7 +4,7 @@
import {inherits} from '../index.js';
import _ol_ViewHint_ from '../ViewHint.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';
/**
@@ -111,7 +111,7 @@ _ol_interaction_PinchZoom_.handleDragEvent_ = function(mapBrowserEvent) {
// scale, bypass the resolution constraint
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 is > 0 if pinching out, and < 0 if pinching in.
var direction = this.lastScaleDelta_ - 1;
_ol_interaction_Interaction_.zoom(view, resolution,
Interaction.zoom(view, resolution,
this.anchor_, this.duration_, direction);
}
return false;

View File

@@ -5,7 +5,7 @@ import {inherits, nullFunction} from '../index.js';
import {FALSE} from '../functions.js';
import MapBrowserEventType from '../MapBrowserEventType.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';
/**
@@ -30,7 +30,7 @@ var _ol_interaction_Pointer_ = function(opt_options) {
var handleEvent = options.handleEvent ?
options.handleEvent : _ol_interaction_Pointer_.handleEvent;
_ol_interaction_Interaction_.call(this, {
Interaction.call(this, {
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) {
return handled;
};
export default _ol_interaction_Pointer_;

View File

@@ -9,7 +9,7 @@ import Event from '../events/Event.js';
import _ol_events_condition_ from '../events/condition.js';
import {TRUE} from '../functions.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_obj_ from '../obj.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) {
_ol_interaction_Interaction_.call(this, {
Interaction.call(this, {
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) {
selectedFeatures.forEach(currentMap.unskipFeature, currentMap);
}
_ol_interaction_Interaction_.prototype.setMap.call(this, map);
Interaction.prototype.setMap.call(this, map);
this.featureOverlay_.setMap(map);
if (map) {
selectedFeatures.forEach(map.skipFeature, map);

View File

@@ -3,7 +3,7 @@ import _ol_View_ from '../../../../src/ol/View.js';
import Event from '../../../../src/ol/events/Event.js';
import EventTarget from '../../../../src/ol/events/EventTarget.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';
where('FileReader').describe('ol.interaction.DragAndDrop', function() {
@@ -19,7 +19,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() {
return new _ol_View_();
}
};
interaction = new _ol_interaction_DragAndDrop_({
interaction = new DragAndDrop({
formatConstructors: [_ol_format_GeoJSON_]
});
});
@@ -27,8 +27,8 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() {
describe('constructor', function() {
it('can be constructed without arguments', function() {
var interaction = new _ol_interaction_DragAndDrop_();
expect(interaction).to.be.an(_ol_interaction_DragAndDrop_);
var interaction = new DragAndDrop();
expect(interaction).to.be.an(DragAndDrop);
});
it('sets formatConstructors on the instance', function() {
@@ -37,7 +37,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() {
it('accepts a source option', function() {
var source = new _ol_source_Vector_();
var drop = new _ol_interaction_DragAndDrop_({
var drop = new DragAndDrop({
formatConstructors: [_ol_format_GeoJSON_],
source: source
});
@@ -73,7 +73,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() {
it('registers and unregisters listeners on a custom target', function() {
var customTarget = new EventTarget();
interaction = new _ol_interaction_DragAndDrop_({
interaction = new DragAndDrop({
formatConstructors: [_ol_format_GeoJSON_],
target: customTarget
});
@@ -137,7 +137,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() {
it('adds dropped features to a source', function(done) {
var source = new _ol_source_Vector_();
var drop = new _ol_interaction_DragAndDrop_({
var drop = new DragAndDrop({
formatConstructors: [_ol_format_GeoJSON_],
source: source
});

View File

@@ -1,8 +1,8 @@
import _ol_Map_ from '../../../../src/ol/Map.js';
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_interaction_DragRotateAndZoom_ from '../../../../src/ol/interaction/DragRotateAndZoom.js';
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js';
import DragRotateAndZoom from '../../../../src/ol/interaction/DragRotateAndZoom.js';
import Interaction from '../../../../src/ol/interaction/Interaction.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
@@ -12,8 +12,8 @@ describe('ol.interaction.DragRotateAndZoom', function() {
describe('constructor', function() {
it('can be constructed without arguments', function() {
var instance = new _ol_interaction_DragRotateAndZoom_();
expect(instance).to.be.an(_ol_interaction_DragRotateAndZoom_);
var instance = new DragRotateAndZoom();
expect(instance).to.be.an(DragRotateAndZoom);
});
});
@@ -36,7 +36,7 @@ describe('ol.interaction.DragRotateAndZoom', function() {
document.body.appendChild(target);
var source = new _ol_source_Vector_();
var layer = new _ol_layer_Vector_({source: source});
interaction = new _ol_interaction_DragRotateAndZoom_();
interaction = new DragRotateAndZoom();
map = new _ol_Map_({
target: target,
layers: [layer],
@@ -62,7 +62,7 @@ describe('ol.interaction.DragRotateAndZoom', function() {
new _ol_pointer_PointerEvent_('pointermove', {clientX: 20, clientY: 10}, {pointerType: 'mouse'}),
true);
interaction.lastAngle_ = Math.PI;
var spy = sinon.spy(_ol_interaction_Interaction_, 'rotateWithoutConstraints');
var spy = sinon.spy(Interaction, 'rotateWithoutConstraints');
interaction.handleDragEvent_(event);
expect(spy.callCount).to.be(1);
expect(interaction.lastAngle_).to.be(-0.8308214428190254);
@@ -77,7 +77,7 @@ describe('ol.interaction.DragRotateAndZoom', function() {
true);
interaction.handleDragEvent_(event);
expect(spy.callCount).to.be(1);
_ol_interaction_Interaction_.rotateWithoutConstraints.restore();
Interaction.rotateWithoutConstraints.restore();
});
});

View File

@@ -2,7 +2,7 @@ import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import * as _ol_extent_ from '../../../../src/ol/extent.js';
import 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_render_Box_ from '../../../../src/ol/render/Box.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
@@ -48,15 +48,15 @@ describe('ol.interaction.DragZoom', function() {
describe('constructor', function() {
it('can be constructed without arguments', function() {
var instance = new _ol_interaction_DragZoom_();
expect(instance).to.be.an(_ol_interaction_DragZoom_);
var instance = new DragZoom();
expect(instance).to.be.an(DragZoom);
});
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');
});
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');
});
@@ -65,7 +65,7 @@ describe('ol.interaction.DragZoom', function() {
describe('#onBoxEnd()', function() {
it('centers the view on the box geometry', function(done) {
var interaction = new _ol_interaction_DragZoom_({
var interaction = new DragZoom({
duration: 10
});
map.addInteraction(interaction);
@@ -86,7 +86,7 @@ describe('ol.interaction.DragZoom', function() {
});
it('sets new resolution while zooming out', function(done) {
var interaction = new _ol_interaction_DragZoom_({
var interaction = new DragZoom({
duration: 10,
out: true
});

View File

@@ -12,8 +12,8 @@ import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
import Point from '../../../../src/ol/geom/Point.js';
import Polygon from '../../../../src/ol/geom/Polygon.js';
import _ol_interaction_Draw_ from '../../../../src/ol/interaction/Draw.js';
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js';
import Draw from '../../../../src/ol/interaction/Draw.js';
import Interaction from '../../../../src/ol/interaction/Interaction.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
@@ -79,16 +79,16 @@ describe('ol.interaction.Draw', function() {
describe('constructor', function() {
it('creates a new interaction', function() {
var draw = new _ol_interaction_Draw_({
var draw = new Draw({
source: source,
type: 'Point'
});
expect(draw).to.be.a(_ol_interaction_Draw_);
expect(draw).to.be.a(_ol_interaction_Interaction_);
expect(draw).to.be.a(Draw);
expect(draw).to.be.a(Interaction);
});
it('accepts a freehand option', function() {
var draw = new _ol_interaction_Draw_({
var draw = new Draw({
source: source,
type: 'LineString',
freehand: true
@@ -108,7 +108,7 @@ describe('ol.interaction.Draw', function() {
describe('specifying a geometryName', function() {
beforeEach(function() {
var draw = new _ol_interaction_Draw_({
var draw = new Draw({
source: source,
geometryName: 'the_geom',
type: 'Point'
@@ -129,7 +129,7 @@ describe('ol.interaction.Draw', function() {
describe('specifying a clickTolerance', function() {
beforeEach(function() {
var draw = new _ol_interaction_Draw_({
var draw = new Draw({
source: source,
type: 'Point',
clickTolerance: 6
@@ -158,7 +158,7 @@ describe('ol.interaction.Draw', function() {
var draw;
beforeEach(function() {
draw = new _ol_interaction_Draw_({
draw = new Draw({
source: source,
type: 'Point'
});
@@ -236,7 +236,7 @@ describe('ol.interaction.Draw', function() {
describe('drawing multipoints', function() {
beforeEach(function() {
map.addInteraction(new _ol_interaction_Draw_({
map.addInteraction(new Draw({
source: source,
type: 'MultiPoint'
}));
@@ -259,7 +259,7 @@ describe('ol.interaction.Draw', function() {
var draw;
beforeEach(function() {
draw = new _ol_interaction_Draw_({
draw = new Draw({
source: source,
type: 'LineString'
});
@@ -427,7 +427,7 @@ describe('ol.interaction.Draw', function() {
describe('drawing with a finishCondition', function() {
beforeEach(function() {
var draw = new _ol_interaction_Draw_({
var draw = new Draw({
source: source,
type: 'LineString',
finishCondition: function(event) {
@@ -477,7 +477,7 @@ describe('ol.interaction.Draw', function() {
describe('drawing multi-linestrings', function() {
beforeEach(function() {
map.addInteraction(new _ol_interaction_Draw_({
map.addInteraction(new Draw({
source: source,
type: 'MultiLineString'
}));
@@ -511,7 +511,7 @@ describe('ol.interaction.Draw', function() {
var draw;
beforeEach(function() {
draw = new _ol_interaction_Draw_({
draw = new Draw({
source: source,
type: 'Polygon'
});
@@ -697,7 +697,7 @@ describe('ol.interaction.Draw', function() {
describe('drawing multi-polygons', function() {
beforeEach(function() {
map.addInteraction(new _ol_interaction_Draw_({
map.addInteraction(new Draw({
source: source,
type: 'MultiPolygon'
}));
@@ -774,7 +774,7 @@ describe('ol.interaction.Draw', function() {
var draw;
beforeEach(function() {
draw = new _ol_interaction_Draw_({
draw = new Draw({
source: source,
type: 'Circle'
});
@@ -846,7 +846,7 @@ describe('ol.interaction.Draw', function() {
var interaction;
beforeEach(function() {
interaction = new _ol_interaction_Draw_({
interaction = new Draw({
type: 'LineString'
});
@@ -915,7 +915,7 @@ describe('ol.interaction.Draw', function() {
var interaction;
beforeEach(function() {
interaction = new _ol_interaction_Draw_({
interaction = new Draw({
type: 'LineString'
});
expect(interaction.getActive()).to.be(true);
@@ -968,11 +968,11 @@ describe('ol.interaction.Draw', function() {
describe('ol.interaction.Draw.createRegularPolygon', function() {
it('creates a regular polygon in Circle mode', function() {
var draw = new _ol_interaction_Draw_({
var draw = new Draw({
source: source,
type: 'Circle',
geometryFunction:
_ol_interaction_Draw_.createRegularPolygon(4, Math.PI / 4)
Draw.createRegularPolygon(4, Math.PI / 4)
});
map.addInteraction(draw);
@@ -998,10 +998,10 @@ describe('ol.interaction.Draw', function() {
describe('ol.interaction.Draw.createBox', function() {
it('creates a box-shaped polygon in Circle mode', function() {
var draw = new _ol_interaction_Draw_({
var draw = new Draw({
source: source,
type: 'Circle',
geometryFunction: _ol_interaction_Draw_.createBox()
geometryFunction: Draw.createBox()
});
map.addInteraction(draw);
@@ -1030,7 +1030,7 @@ describe('ol.interaction.Draw', function() {
var feature;
beforeEach(function() {
draw = new _ol_interaction_Draw_({
draw = new Draw({
source: source,
type: 'LineString'
});

View File

@@ -1,7 +1,7 @@
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.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() {
@@ -9,11 +9,11 @@ describe('ol.interaction.Interaction', function() {
var interaction;
beforeEach(function() {
interaction = new _ol_interaction_Interaction_({});
interaction = new Interaction({});
});
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);
});
@@ -27,13 +27,13 @@ describe('ol.interaction.Interaction', function() {
it('retrieves the associated map', function() {
var map = new _ol_Map_({});
var interaction = new _ol_interaction_Interaction_({});
var interaction = new Interaction({});
interaction.setMap(map);
expect(interaction.getMap()).to.be(map);
});
it('returns null if no map', function() {
var interaction = new _ol_interaction_Interaction_({});
var interaction = new Interaction({});
expect(interaction.getMap()).to.be(null);
});
@@ -43,13 +43,13 @@ describe('ol.interaction.Interaction', function() {
it('allows a map to be set', function() {
var map = new _ol_Map_({});
var interaction = new _ol_interaction_Interaction_({});
var interaction = new Interaction({});
interaction.setMap(map);
expect(interaction.getMap()).to.be(map);
});
it('accepts null', function() {
var interaction = new _ol_interaction_Interaction_({});
var interaction = new Interaction({});
interaction.setMap(null);
expect(interaction.getMap()).to.be(null);
});
@@ -64,16 +64,16 @@ describe('ol.interaction.Interaction', function() {
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);
_ol_interaction_Interaction_.zoomByDelta(view, -1);
Interaction.zoomByDelta(view, -1);
expect(view.getResolution()).to.be(1);
_ol_interaction_Interaction_.zoomByDelta(view, 2);
Interaction.zoomByDelta(view, 2);
expect(view.getResolution()).to.be(0.25);
_ol_interaction_Interaction_.zoomByDelta(view, -2);
Interaction.zoomByDelta(view, -2);
expect(view.getResolution()).to.be(1);
});
@@ -84,16 +84,16 @@ describe('ol.interaction.Interaction', function() {
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]);
_ol_interaction_Interaction_.zoomByDelta(view, -1, [0, 0]);
Interaction.zoomByDelta(view, -1, [0, 0]);
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]);
_ol_interaction_Interaction_.zoomByDelta(view, -2, [0, 0]);
Interaction.zoomByDelta(view, -2, [0, 0]);
expect(view.getCenter()).to.eql([10, 10]);
});
@@ -105,16 +105,16 @@ describe('ol.interaction.Interaction', function() {
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]);
_ol_interaction_Interaction_.zoomByDelta(view, -1, [0, 0]);
Interaction.zoomByDelta(view, -1, [0, 0]);
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]);
_ol_interaction_Interaction_.zoomByDelta(view, -2, [0, 0]);
Interaction.zoomByDelta(view, -2, [0, 0]);
expect(view.getCenter()).to.eql([2.5, 2.5]);
});
});

View File

@@ -2,7 +2,8 @@ import _ol_Map_ from '../../../../src/ol/Map.js';
import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
import _ol_View_ from '../../../../src/ol/View.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() {
var map;
@@ -23,7 +24,7 @@ describe('ol.interaction.KeyboardPan', function() {
describe('handleEvent()', 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, {
type: 'keydown',
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(2).args[1]).to.eql([-128, 0]);
expect(spy.getCall(3).args[1]).to.eql([128, 0]);
_ol_interaction_Interaction_.pan.restore();
Interaction.pan.restore();
});
});

View File

@@ -2,7 +2,8 @@ import _ol_Map_ from '../../../../src/ol/Map.js';
import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
import _ol_View_ from '../../../../src/ol/View.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() {
var map;
@@ -23,7 +24,7 @@ describe('ol.interaction.KeyboardZoom', function() {
describe('handleEvent()', 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, {
type: 'keydown',
target: map.getTargetElement(),
@@ -35,7 +36,7 @@ describe('ol.interaction.KeyboardZoom', function() {
map.handleMapBrowserEvent(event);
expect(spy.getCall(0).args[1]).to.eql(1);
expect(spy.getCall(1).args[1]).to.eql(-1);
_ol_interaction_Interaction_.zoomByDelta.restore();
Interaction.zoomByDelta.restore();
});
});

View File

@@ -3,7 +3,7 @@ import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
import _ol_View_ from '../../../../src/ol/View.js';
import Event from '../../../../src/ol/events/Event.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';
@@ -33,13 +33,13 @@ describe('ol.interaction.MouseWheelZoom', function() {
describe('timeout duration', function() {
var clock;
beforeEach(function() {
sinon.spy(_ol_interaction_Interaction_, 'zoomByDelta');
sinon.spy(Interaction, 'zoomByDelta');
clock = sinon.useFakeTimers();
});
afterEach(function() {
clock.restore();
_ol_interaction_Interaction_.zoomByDelta.restore();
Interaction.zoomByDelta.restore();
});
it('works with the defaut value', function(done) {
@@ -51,9 +51,9 @@ describe('ol.interaction.MouseWheelZoom', function() {
map.handleMapBrowserEvent(event);
clock.tick(50);
// 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);
expect(_ol_interaction_Interaction_.zoomByDelta.called).to.be(true);
expect(Interaction.zoomByDelta.called).to.be(true);
done();
});
@@ -102,15 +102,15 @@ describe('ol.interaction.MouseWheelZoom', function() {
describe('spying on ol.interaction.Interaction.zoomByDelta', function() {
beforeEach(function() {
sinon.spy(_ol_interaction_Interaction_, 'zoomByDelta');
sinon.spy(Interaction, 'zoomByDelta');
});
afterEach(function() {
_ol_interaction_Interaction_.zoomByDelta.restore();
Interaction.zoomByDelta.restore();
});
it('works in DOM_DELTA_LINE mode (wheel)', function(done) {
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[2]).to.eql([0, 0]);
done();
@@ -130,7 +130,7 @@ describe('ol.interaction.MouseWheelZoom', function() {
var origHasSafari = _ol_has_.SAFARI;
_ol_has_.SAFARI = true;
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[2]).to.eql([0, 0]);
_ol_has_.SAFARI = origHasSafari;
@@ -150,7 +150,7 @@ describe('ol.interaction.MouseWheelZoom', function() {
var origHasSafari = _ol_has_.SAFARI;
_ol_has_.SAFARI = false;
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[2]).to.eql([0, 0]);
_ol_has_.SAFARI = origHasSafari;

View File

@@ -5,7 +5,7 @@ import MapBrowserEventType from '../../../../src/ol/MapBrowserEventType.js';
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
import _ol_View_ from '../../../../src/ol/View.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_layer_Vector_ from '../../../../src/ol/layer/Vector.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() {
var select = new _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() {

View File

@@ -5,7 +5,7 @@ import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js
import _ol_View_ from '../../../../src/ol/View.js';
import Point from '../../../../src/ol/geom/Point.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_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
@@ -136,7 +136,7 @@ describe('ol.interaction.Translate', function() {
features: features
});
expect(translate).to.be.a(_ol_interaction_Translate_);
expect(translate).to.be.a(_ol_interaction_Interaction_);
expect(translate).to.be.a(Interaction);
});
});

View File

@@ -6,8 +6,8 @@ import _ol_View_ from '../../../src/ol/View.js';
import Point from '../../../src/ol/geom/Point.js';
import _ol_has_ from '../../../src/ol/has.js';
import _ol_interaction_ from '../../../src/ol/interaction.js';
import _ol_interaction_DoubleClickZoom_ from '../../../src/ol/interaction/DoubleClickZoom.js';
import _ol_interaction_Interaction_ from '../../../src/ol/interaction/Interaction.js';
import DoubleClickZoom from '../../../src/ol/interaction/DoubleClickZoom.js';
import Interaction from '../../../src/ol/interaction/Interaction.js';
import _ol_interaction_MouseWheelZoom_ from '../../../src/ol/interaction/MouseWheelZoom.js';
import _ol_interaction_PinchZoom_ from '../../../src/ol/interaction/PinchZoom.js';
import _ol_layer_Tile_ from '../../../src/ol/layer/Tile.js';
@@ -77,7 +77,7 @@ describe('ol.Map', function() {
describe('#addInteraction()', function() {
it('adds an interaction to the map', function() {
var map = new _ol_Map_({});
var interaction = new _ol_interaction_Interaction_({});
var interaction = new Interaction({});
var before = map.getInteractions().getLength();
map.addInteraction(interaction);
@@ -90,7 +90,7 @@ describe('ol.Map', function() {
describe('#removeInteraction()', function() {
it('removes an interaction from the map', function() {
var map = new _ol_Map_({});
var interaction = new _ol_interaction_Interaction_({});
var interaction = new Interaction({});
var before = map.getInteractions().getLength();
map.addInteraction(interaction);
@@ -524,7 +524,7 @@ describe('ol.Map', function() {
it('create double click interaction with default delta', function() {
var interactions = _ol_interaction_.defaults(options);
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);
});
});
@@ -534,7 +534,7 @@ describe('ol.Map', function() {
options.zoomDelta = 7;
var interactions = _ol_interaction_.defaults(options);
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);
});
});