Import events conditions explicitly
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import Map from '../src/ol/Map.js';
|
import Map from '../src/ol/Map.js';
|
||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import _ol_events_condition_ from '../src/ol/events/condition.js';
|
import {platformModifierKeyOnly} from '../src/ol/events/condition.js';
|
||||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
import DragBox from '../src/ol/interaction/DragBox.js';
|
import DragBox from '../src/ol/interaction/DragBox.js';
|
||||||
import Select from '../src/ol/interaction/Select.js';
|
import Select from '../src/ol/interaction/Select.js';
|
||||||
@@ -40,7 +40,7 @@ const selectedFeatures = select.getFeatures();
|
|||||||
|
|
||||||
// a DragBox interaction used to select features by drawing boxes
|
// a DragBox interaction used to select features by drawing boxes
|
||||||
const dragBox = new DragBox({
|
const dragBox = new DragBox({
|
||||||
condition: _ol_events_condition_.platformModifierKeyOnly
|
condition: platformModifierKeyOnly
|
||||||
});
|
});
|
||||||
|
|
||||||
map.addInteraction(dragBox);
|
map.addInteraction(dragBox);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Map from '../src/ol/Map.js';
|
import Map from '../src/ol/Map.js';
|
||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import _ol_events_condition_ from '../src/ol/events/condition.js';
|
import {platformModifierKeyOnly} from '../src/ol/events/condition.js';
|
||||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
import ExtentInteraction from '../src/ol/interaction/Extent.js';
|
import ExtentInteraction from '../src/ol/interaction/Extent.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
@@ -30,7 +30,7 @@ const map = new Map({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const extent = new ExtentInteraction({
|
const extent = new ExtentInteraction({
|
||||||
condition: _ol_events_condition_.platformModifierKeyOnly
|
condition: platformModifierKeyOnly
|
||||||
});
|
});
|
||||||
map.addInteraction(extent);
|
map.addInteraction(extent);
|
||||||
extent.setActive(false);
|
extent.setActive(false);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Map from '../src/ol/Map.js';
|
import Map from '../src/ol/Map.js';
|
||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import _ol_events_condition_ from '../src/ol/events/condition.js';
|
import {click, pointerMove, altKeyOnly} from '../src/ol/events/condition.js';
|
||||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
import Select from '../src/ol/interaction/Select.js';
|
import Select from '../src/ol/interaction/Select.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
@@ -35,18 +35,17 @@ const selectSingleClick = new Select();
|
|||||||
|
|
||||||
// select interaction working on "click"
|
// select interaction working on "click"
|
||||||
const selectClick = new Select({
|
const selectClick = new Select({
|
||||||
condition: _ol_events_condition_.click
|
condition: click
|
||||||
});
|
});
|
||||||
|
|
||||||
// select interaction working on "pointermove"
|
// select interaction working on "pointermove"
|
||||||
const selectPointerMove = new Select({
|
const selectPointerMove = new Select({
|
||||||
condition: _ol_events_condition_.pointerMove
|
condition: pointerMove
|
||||||
});
|
});
|
||||||
|
|
||||||
const selectAltClick = new Select({
|
const selectAltClick = new Select({
|
||||||
condition: function(mapBrowserEvent) {
|
condition: function(mapBrowserEvent) {
|
||||||
return _ol_events_condition_.click(mapBrowserEvent) &&
|
return click(mapBrowserEvent) && altKeyOnly(mapBrowserEvent);
|
||||||
_ol_events_condition_.altKeyOnly(mapBrowserEvent);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
// FIXME draw drag box
|
// FIXME draw drag box
|
||||||
import Event from '../events/Event.js';
|
import Event from '../events/Event.js';
|
||||||
import {inherits, nullFunction} from '../index.js';
|
import {inherits, nullFunction} from '../index.js';
|
||||||
import _ol_events_condition_ from '../events/condition.js';
|
import {always, mouseOnly, mouseActionButton} from '../events/condition.js';
|
||||||
import PointerInteraction from '../interaction/Pointer.js';
|
import PointerInteraction from '../interaction/Pointer.js';
|
||||||
import _ol_render_Box_ from '../render/Box.js';
|
import _ol_render_Box_ from '../render/Box.js';
|
||||||
|
|
||||||
@@ -57,8 +57,7 @@ const DragBox = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ?
|
this.condition_ = options.condition ? options.condition : always;
|
||||||
options.condition : _ol_events_condition_.always;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -94,7 +93,7 @@ DragBox.defaultBoxEndCondition = function(mapBrowserEvent, startPixel, endPixel)
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
DragBox.handleDragEvent_ = function(mapBrowserEvent) {
|
DragBox.handleDragEvent_ = function(mapBrowserEvent) {
|
||||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
if (!mouseOnly(mapBrowserEvent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +130,7 @@ DragBox.prototype.onBoxEnd = nullFunction;
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
DragBox.handleUpEvent_ = function(mapBrowserEvent) {
|
DragBox.handleUpEvent_ = function(mapBrowserEvent) {
|
||||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
if (!mouseOnly(mapBrowserEvent)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,11 +153,11 @@ DragBox.handleUpEvent_ = function(mapBrowserEvent) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
DragBox.handleDownEvent_ = function(mapBrowserEvent) {
|
DragBox.handleDownEvent_ = function(mapBrowserEvent) {
|
||||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
if (!mouseOnly(mapBrowserEvent)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_ol_events_condition_.mouseActionButton(mapBrowserEvent) &&
|
if (mouseActionButton(mapBrowserEvent) &&
|
||||||
this.condition_(mapBrowserEvent)) {
|
this.condition_(mapBrowserEvent)) {
|
||||||
this.startPixel_ = mapBrowserEvent.pixel;
|
this.startPixel_ = mapBrowserEvent.pixel;
|
||||||
this.box_.setMap(mapBrowserEvent.map);
|
this.box_.setMap(mapBrowserEvent.map);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
|
|||||||
import ViewHint from '../ViewHint.js';
|
import ViewHint from '../ViewHint.js';
|
||||||
import _ol_coordinate_ from '../coordinate.js';
|
import _ol_coordinate_ from '../coordinate.js';
|
||||||
import {easeOut} from '../easing.js';
|
import {easeOut} from '../easing.js';
|
||||||
import _ol_events_condition_ from '../events/condition.js';
|
import {noModifierKeys} from '../events/condition.js';
|
||||||
import {FALSE} from '../functions.js';
|
import {FALSE} from '../functions.js';
|
||||||
import PointerInteraction from '../interaction/Pointer.js';
|
import PointerInteraction from '../interaction/Pointer.js';
|
||||||
|
|
||||||
@@ -48,8 +48,7 @@ const DragPan = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ?
|
this.condition_ = options.condition ? options.condition : noModifierKeys;
|
||||||
options.condition : _ol_events_condition_.noModifierKeys;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import RotationConstraint from '../RotationConstraint.js';
|
import RotationConstraint from '../RotationConstraint.js';
|
||||||
import ViewHint from '../ViewHint.js';
|
import ViewHint from '../ViewHint.js';
|
||||||
import _ol_events_condition_ from '../events/condition.js';
|
import {altShiftKeysOnly, mouseOnly, mouseActionButton} from '../events/condition.js';
|
||||||
import {FALSE} from '../functions.js';
|
import {FALSE} from '../functions.js';
|
||||||
import Interaction from '../interaction/Interaction.js';
|
import Interaction from '../interaction/Interaction.js';
|
||||||
import PointerInteraction from '../interaction/Pointer.js';
|
import PointerInteraction from '../interaction/Pointer.js';
|
||||||
@@ -36,8 +36,7 @@ const DragRotate = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ?
|
this.condition_ = options.condition ? options.condition : altShiftKeysOnly;
|
||||||
options.condition : _ol_events_condition_.altShiftKeysOnly;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -61,7 +60,7 @@ inherits(DragRotate, PointerInteraction);
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
DragRotate.handleDragEvent_ = function(mapBrowserEvent) {
|
DragRotate.handleDragEvent_ = function(mapBrowserEvent) {
|
||||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
if (!mouseOnly(mapBrowserEvent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +90,7 @@ DragRotate.handleDragEvent_ = function(mapBrowserEvent) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
DragRotate.handleUpEvent_ = function(mapBrowserEvent) {
|
DragRotate.handleUpEvent_ = function(mapBrowserEvent) {
|
||||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
if (!mouseOnly(mapBrowserEvent)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,12 +111,11 @@ DragRotate.handleUpEvent_ = function(mapBrowserEvent) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
DragRotate.handleDownEvent_ = function(mapBrowserEvent) {
|
DragRotate.handleDownEvent_ = function(mapBrowserEvent) {
|
||||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
if (!mouseOnly(mapBrowserEvent)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_ol_events_condition_.mouseActionButton(mapBrowserEvent) &&
|
if (mouseActionButton(mapBrowserEvent) && this.condition_(mapBrowserEvent)) {
|
||||||
this.condition_(mapBrowserEvent)) {
|
|
||||||
const map = mapBrowserEvent.map;
|
const map = mapBrowserEvent.map;
|
||||||
map.getView().setHint(ViewHint.INTERACTING, 1);
|
map.getView().setHint(ViewHint.INTERACTING, 1);
|
||||||
this.lastAngle_ = undefined;
|
this.lastAngle_ = undefined;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import RotationConstraint from '../RotationConstraint.js';
|
import RotationConstraint from '../RotationConstraint.js';
|
||||||
import ViewHint from '../ViewHint.js';
|
import ViewHint from '../ViewHint.js';
|
||||||
import _ol_events_condition_ from '../events/condition.js';
|
import {shiftKeyOnly, mouseOnly} from '../events/condition.js';
|
||||||
import Interaction from '../interaction/Interaction.js';
|
import Interaction from '../interaction/Interaction.js';
|
||||||
import PointerInteraction from '../interaction/Pointer.js';
|
import PointerInteraction from '../interaction/Pointer.js';
|
||||||
|
|
||||||
@@ -37,8 +37,7 @@ const DragRotateAndZoom = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ?
|
this.condition_ = options.condition ? options.condition : shiftKeyOnly;
|
||||||
options.condition : _ol_events_condition_.shiftKeyOnly;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -75,7 +74,7 @@ inherits(DragRotateAndZoom, PointerInteraction);
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
DragRotateAndZoom.handleDragEvent_ = function(mapBrowserEvent) {
|
DragRotateAndZoom.handleDragEvent_ = function(mapBrowserEvent) {
|
||||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
if (!mouseOnly(mapBrowserEvent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +110,7 @@ DragRotateAndZoom.handleDragEvent_ = function(mapBrowserEvent) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
DragRotateAndZoom.handleUpEvent_ = function(mapBrowserEvent) {
|
DragRotateAndZoom.handleUpEvent_ = function(mapBrowserEvent) {
|
||||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
if (!mouseOnly(mapBrowserEvent)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +133,7 @@ DragRotateAndZoom.handleUpEvent_ = function(mapBrowserEvent) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
DragRotateAndZoom.handleDownEvent_ = function(mapBrowserEvent) {
|
DragRotateAndZoom.handleDownEvent_ = function(mapBrowserEvent) {
|
||||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
if (!mouseOnly(mapBrowserEvent)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import {easeOut} from '../easing.js';
|
import {easeOut} from '../easing.js';
|
||||||
import _ol_events_condition_ from '../events/condition.js';
|
import {shiftKeyOnly} from '../events/condition.js';
|
||||||
import {createOrUpdateFromCoordinates, getBottomLeft, getCenter, getTopRight, scaleFromCenter} from '../extent.js';
|
import {createOrUpdateFromCoordinates, getBottomLeft, getCenter, getTopRight, scaleFromCenter} from '../extent.js';
|
||||||
import DragBox from '../interaction/DragBox.js';
|
import DragBox from '../interaction/DragBox.js';
|
||||||
|
|
||||||
@@ -24,8 +24,7 @@ import DragBox from '../interaction/DragBox.js';
|
|||||||
const DragZoom = function(opt_options) {
|
const DragZoom = function(opt_options) {
|
||||||
const options = opt_options ? opt_options : {};
|
const options = opt_options ? opt_options : {};
|
||||||
|
|
||||||
const condition = options.condition ?
|
const condition = options.condition ? options.condition : shiftKeyOnly;
|
||||||
options.condition : _ol_events_condition_.shiftKeyOnly;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import BaseObject from '../Object.js';
|
|||||||
import _ol_coordinate_ from '../coordinate.js';
|
import _ol_coordinate_ from '../coordinate.js';
|
||||||
import {listen} from '../events.js';
|
import {listen} from '../events.js';
|
||||||
import Event from '../events/Event.js';
|
import Event from '../events/Event.js';
|
||||||
import _ol_events_condition_ from '../events/condition.js';
|
import {noModifierKeys, always, shiftKeyOnly} from '../events/condition.js';
|
||||||
import {boundingExtent, getBottomLeft, getBottomRight, getTopLeft, getTopRight} from '../extent.js';
|
import {boundingExtent, getBottomLeft, getBottomRight, getTopLeft, getTopRight} from '../extent.js';
|
||||||
import {TRUE, FALSE} from '../functions.js';
|
import {TRUE, FALSE} from '../functions.js';
|
||||||
import Circle from '../geom/Circle.js';
|
import Circle from '../geom/Circle.js';
|
||||||
@@ -291,8 +291,7 @@ const Draw = function(options) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ?
|
this.condition_ = options.condition ? options.condition : noModifierKeys;
|
||||||
options.condition : _ol_events_condition_.noModifierKeys;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -300,10 +299,10 @@ const Draw = function(options) {
|
|||||||
*/
|
*/
|
||||||
this.freehandCondition_;
|
this.freehandCondition_;
|
||||||
if (options.freehand) {
|
if (options.freehand) {
|
||||||
this.freehandCondition_ = _ol_events_condition_.always;
|
this.freehandCondition_ = always;
|
||||||
} else {
|
} else {
|
||||||
this.freehandCondition_ = options.freehandCondition ?
|
this.freehandCondition_ = options.freehandCondition ?
|
||||||
options.freehandCondition : _ol_events_condition_.shiftKeyOnly;
|
options.freehandCondition : shiftKeyOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
listen(this,
|
listen(this,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
|
|||||||
import _ol_coordinate_ from '../coordinate.js';
|
import _ol_coordinate_ from '../coordinate.js';
|
||||||
import EventType from '../events/EventType.js';
|
import EventType from '../events/EventType.js';
|
||||||
import KeyCode from '../events/KeyCode.js';
|
import KeyCode from '../events/KeyCode.js';
|
||||||
import _ol_events_condition_ from '../events/condition.js';
|
import {noModifierKeys, targetNotEditable} from '../events/condition.js';
|
||||||
import Interaction from '../interaction/Interaction.js';
|
import Interaction from '../interaction/Interaction.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,8 +39,8 @@ const KeyboardPan = function(opt_options) {
|
|||||||
* @return {boolean} Combined condition result.
|
* @return {boolean} Combined condition result.
|
||||||
*/
|
*/
|
||||||
this.defaultCondition_ = function(mapBrowserEvent) {
|
this.defaultCondition_ = function(mapBrowserEvent) {
|
||||||
return _ol_events_condition_.noModifierKeys(mapBrowserEvent) &&
|
return noModifierKeys(mapBrowserEvent) &&
|
||||||
_ol_events_condition_.targetNotEditable(mapBrowserEvent);
|
targetNotEditable(mapBrowserEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,7 +3,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 {targetNotEditable} from '../events/condition.js';
|
||||||
import Interaction from '../interaction/Interaction.js';
|
import Interaction from '../interaction/Interaction.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,8 +35,7 @@ const KeyboardZoom = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ? options.condition :
|
this.condition_ = options.condition ? options.condition : targetNotEditable;
|
||||||
_ol_events_condition_.targetNotEditable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import _ol_coordinate_ from '../coordinate.js';
|
|||||||
import {listen, unlisten} from '../events.js';
|
import {listen, unlisten} 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_events_condition_ from '../events/condition.js';
|
import {always, primaryAction, altKeyOnly, singleClick} from '../events/condition.js';
|
||||||
import {boundingExtent, buffer, createOrUpdateFromCoordinate} from '../extent.js';
|
import {boundingExtent, buffer, createOrUpdateFromCoordinate} from '../extent.js';
|
||||||
import GeometryType from '../geom/GeometryType.js';
|
import GeometryType from '../geom/GeometryType.js';
|
||||||
import Point from '../geom/Point.js';
|
import Point from '../geom/Point.js';
|
||||||
@@ -56,8 +56,7 @@ const Modify = function(options) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ?
|
this.condition_ = options.condition ? options.condition : primaryAction;
|
||||||
options.condition : _ol_events_condition_.primaryAction;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,8 +65,7 @@ const Modify = function(options) {
|
|||||||
* @return {boolean} Combined condition result.
|
* @return {boolean} Combined condition result.
|
||||||
*/
|
*/
|
||||||
this.defaultDeleteCondition_ = function(mapBrowserEvent) {
|
this.defaultDeleteCondition_ = function(mapBrowserEvent) {
|
||||||
return _ol_events_condition_.altKeyOnly(mapBrowserEvent) &&
|
return altKeyOnly(mapBrowserEvent) && singleClick(mapBrowserEvent);
|
||||||
_ol_events_condition_.singleClick(mapBrowserEvent);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,7 +80,7 @@ const Modify = function(options) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.insertVertexCondition_ = options.insertVertexCondition ?
|
this.insertVertexCondition_ = options.insertVertexCondition ?
|
||||||
options.insertVertexCondition : _ol_events_condition_.always;
|
options.insertVertexCondition : always;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Editing vertex.
|
* Editing vertex.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import ViewHint from '../ViewHint.js';
|
import ViewHint from '../ViewHint.js';
|
||||||
import condition from '../events/condition.js';
|
import {always} from '../events/condition.js';
|
||||||
import {easeOut} from '../easing.js';
|
import {easeOut} from '../easing.js';
|
||||||
import EventType from '../events/EventType.js';
|
import EventType from '../events/EventType.js';
|
||||||
import {DEVICE_PIXEL_RATIO, FIREFOX, SAFARI} from '../has.js';
|
import {DEVICE_PIXEL_RATIO, FIREFOX, SAFARI} from '../has.js';
|
||||||
@@ -68,7 +68,7 @@ const MouseWheelZoom = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ? options.condition : condition.always;
|
this.condition_ = options.condition ? options.condition : always;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import CollectionEventType from '../CollectionEventType.js';
|
|||||||
import {extend, includes} from '../array.js';
|
import {extend, includes} from '../array.js';
|
||||||
import {listen} from '../events.js';
|
import {listen} from '../events.js';
|
||||||
import Event from '../events/Event.js';
|
import Event from '../events/Event.js';
|
||||||
import _ol_events_condition_ from '../events/condition.js';
|
import {singleClick, never, shiftKeyOnly, pointerMove} 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 Interaction from '../interaction/Interaction.js';
|
import Interaction from '../interaction/Interaction.js';
|
||||||
@@ -45,29 +45,25 @@ const Select = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ?
|
this.condition_ = options.condition ? options.condition : singleClick;
|
||||||
options.condition : _ol_events_condition_.singleClick;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.addCondition_ = options.addCondition ?
|
this.addCondition_ = options.addCondition ? options.addCondition : never;
|
||||||
options.addCondition : _ol_events_condition_.never;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.removeCondition_ = options.removeCondition ?
|
this.removeCondition_ = options.removeCondition ? options.removeCondition : never;
|
||||||
options.removeCondition : _ol_events_condition_.never;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.toggleCondition_ = options.toggleCondition ?
|
this.toggleCondition_ = options.toggleCondition ? options.toggleCondition : shiftKeyOnly;
|
||||||
options.toggleCondition : _ol_events_condition_.shiftKeyOnly;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -283,7 +279,7 @@ Select.handleEvent = function(mapBrowserEvent) {
|
|||||||
new Select.Event(Select.EventType_.SELECT,
|
new Select.Event(Select.EventType_.SELECT,
|
||||||
selected, deselected, mapBrowserEvent));
|
selected, deselected, mapBrowserEvent));
|
||||||
}
|
}
|
||||||
return _ol_events_condition_.pointerMove(mapBrowserEvent);
|
return pointerMove(mapBrowserEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js
|
|||||||
import View from '../../../../src/ol/View.js';
|
import View from '../../../../src/ol/View.js';
|
||||||
import {equals} from '../../../../src/ol/array.js';
|
import {equals} from '../../../../src/ol/array.js';
|
||||||
import {listen} from '../../../../src/ol/events.js';
|
import {listen} from '../../../../src/ol/events.js';
|
||||||
import _ol_events_condition_ from '../../../../src/ol/events/condition.js';
|
import {always} from '../../../../src/ol/events/condition.js';
|
||||||
import Circle from '../../../../src/ol/geom/Circle.js';
|
import Circle from '../../../../src/ol/geom/Circle.js';
|
||||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||||
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
||||||
@@ -884,7 +884,7 @@ describe('ol.interaction.Draw', function() {
|
|||||||
|
|
||||||
it('supports freehand drawing for circles', function() {
|
it('supports freehand drawing for circles', function() {
|
||||||
draw.freehand_ = true;
|
draw.freehand_ = true;
|
||||||
draw.freehandCondition_ = _ol_events_condition_.always;
|
draw.freehandCondition_ = always;
|
||||||
|
|
||||||
// no feture created when not moved
|
// no feture created when not moved
|
||||||
simulateEvent('pointermove', 10, 20);
|
simulateEvent('pointermove', 10, 20);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import Map from '../../../../src/ol/Map.js';
|
|||||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||||
import View from '../../../../src/ol/View.js';
|
import View from '../../../../src/ol/View.js';
|
||||||
import {getListeners} from '../../../../src/ol/events.js';
|
import {getListeners} from '../../../../src/ol/events.js';
|
||||||
import _ol_events_condition_ from '../../../../src/ol/events/condition.js';
|
import {doubleClick} from '../../../../src/ol/events/condition.js';
|
||||||
import Circle from '../../../../src/ol/geom/Circle.js';
|
import Circle from '../../../../src/ol/geom/Circle.js';
|
||||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
@@ -524,7 +524,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
modify = new Modify({
|
modify = new Modify({
|
||||||
features: new Collection(features),
|
features: new Collection(features),
|
||||||
deleteCondition: _ol_events_condition_.doubleClick
|
deleteCondition: doubleClick
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user