Merge pull request #7765 from marcjansen/names-names-names
Named exports from events condition
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import Map from '../src/ol/Map.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 DragBox from '../src/ol/interaction/DragBox.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
|
||||
const dragBox = new DragBox({
|
||||
condition: _ol_events_condition_.platformModifierKeyOnly
|
||||
condition: platformModifierKeyOnly
|
||||
});
|
||||
|
||||
map.addInteraction(dragBox);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Map from '../src/ol/Map.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 ExtentInteraction from '../src/ol/interaction/Extent.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
@@ -30,7 +30,7 @@ const map = new Map({
|
||||
});
|
||||
|
||||
const extent = new ExtentInteraction({
|
||||
condition: _ol_events_condition_.platformModifierKeyOnly
|
||||
condition: platformModifierKeyOnly
|
||||
});
|
||||
map.addInteraction(extent);
|
||||
extent.setActive(false);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Map from '../src/ol/Map.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 Select from '../src/ol/interaction/Select.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
@@ -35,18 +35,17 @@ const selectSingleClick = new Select();
|
||||
|
||||
// select interaction working on "click"
|
||||
const selectClick = new Select({
|
||||
condition: _ol_events_condition_.click
|
||||
condition: click
|
||||
});
|
||||
|
||||
// select interaction working on "pointermove"
|
||||
const selectPointerMove = new Select({
|
||||
condition: _ol_events_condition_.pointerMove
|
||||
condition: pointerMove
|
||||
});
|
||||
|
||||
const selectAltClick = new Select({
|
||||
condition: function(mapBrowserEvent) {
|
||||
return _ol_events_condition_.click(mapBrowserEvent) &&
|
||||
_ol_events_condition_.altKeyOnly(mapBrowserEvent);
|
||||
return click(mapBrowserEvent) && altKeyOnly(mapBrowserEvent);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {TRUE, FALSE} from '../functions.js';
|
||||
import {WEBKIT, MAC} from '../has.js';
|
||||
const _ol_events_condition_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -16,7 +15,7 @@ const _ol_events_condition_ = {};
|
||||
* @return {boolean} True if only the alt key is pressed.
|
||||
* @api
|
||||
*/
|
||||
_ol_events_condition_.altKeyOnly = function(mapBrowserEvent) {
|
||||
export const altKeyOnly = function(mapBrowserEvent) {
|
||||
const originalEvent = mapBrowserEvent.originalEvent;
|
||||
return (
|
||||
originalEvent.altKey &&
|
||||
@@ -33,7 +32,7 @@ _ol_events_condition_.altKeyOnly = function(mapBrowserEvent) {
|
||||
* @return {boolean} True if only the alt and shift keys are pressed.
|
||||
* @api
|
||||
*/
|
||||
_ol_events_condition_.altShiftKeysOnly = function(mapBrowserEvent) {
|
||||
export const altShiftKeysOnly = function(mapBrowserEvent) {
|
||||
const originalEvent = mapBrowserEvent.originalEvent;
|
||||
return (
|
||||
originalEvent.altKey &&
|
||||
@@ -50,7 +49,7 @@ _ol_events_condition_.altShiftKeysOnly = function(mapBrowserEvent) {
|
||||
* @function
|
||||
* @api
|
||||
*/
|
||||
_ol_events_condition_.always = TRUE;
|
||||
export const always = TRUE;
|
||||
|
||||
|
||||
/**
|
||||
@@ -60,7 +59,7 @@ _ol_events_condition_.always = TRUE;
|
||||
* @return {boolean} True if the event is a map `click` event.
|
||||
* @api
|
||||
*/
|
||||
_ol_events_condition_.click = function(mapBrowserEvent) {
|
||||
export const click = function(mapBrowserEvent) {
|
||||
return mapBrowserEvent.type == MapBrowserEventType.CLICK;
|
||||
};
|
||||
|
||||
@@ -74,7 +73,7 @@ _ol_events_condition_.click = function(mapBrowserEvent) {
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} The result.
|
||||
*/
|
||||
_ol_events_condition_.mouseActionButton = function(mapBrowserEvent) {
|
||||
export const mouseActionButton = function(mapBrowserEvent) {
|
||||
const originalEvent = mapBrowserEvent.originalEvent;
|
||||
return originalEvent.button == 0 &&
|
||||
!(WEBKIT && MAC && originalEvent.ctrlKey);
|
||||
@@ -89,7 +88,7 @@ _ol_events_condition_.mouseActionButton = function(mapBrowserEvent) {
|
||||
* @function
|
||||
* @api
|
||||
*/
|
||||
_ol_events_condition_.never = FALSE;
|
||||
export const never = FALSE;
|
||||
|
||||
|
||||
/**
|
||||
@@ -100,7 +99,7 @@ _ol_events_condition_.never = FALSE;
|
||||
* @return {boolean} True if the browser event is a `pointermove` event.
|
||||
* @api
|
||||
*/
|
||||
_ol_events_condition_.pointerMove = function(mapBrowserEvent) {
|
||||
export const pointerMove = function(mapBrowserEvent) {
|
||||
return mapBrowserEvent.type == 'pointermove';
|
||||
};
|
||||
|
||||
@@ -112,7 +111,7 @@ _ol_events_condition_.pointerMove = function(mapBrowserEvent) {
|
||||
* @return {boolean} True if the event is a map `singleclick` event.
|
||||
* @api
|
||||
*/
|
||||
_ol_events_condition_.singleClick = function(mapBrowserEvent) {
|
||||
export const singleClick = function(mapBrowserEvent) {
|
||||
return mapBrowserEvent.type == MapBrowserEventType.SINGLECLICK;
|
||||
};
|
||||
|
||||
@@ -124,7 +123,7 @@ _ol_events_condition_.singleClick = function(mapBrowserEvent) {
|
||||
* @return {boolean} True if the event is a map `dblclick` event.
|
||||
* @api
|
||||
*/
|
||||
_ol_events_condition_.doubleClick = function(mapBrowserEvent) {
|
||||
export const doubleClick = function(mapBrowserEvent) {
|
||||
return mapBrowserEvent.type == MapBrowserEventType.DBLCLICK;
|
||||
};
|
||||
|
||||
@@ -137,7 +136,7 @@ _ol_events_condition_.doubleClick = function(mapBrowserEvent) {
|
||||
* @return {boolean} True only if there no modifier keys are pressed.
|
||||
* @api
|
||||
*/
|
||||
_ol_events_condition_.noModifierKeys = function(mapBrowserEvent) {
|
||||
export const noModifierKeys = function(mapBrowserEvent) {
|
||||
const originalEvent = mapBrowserEvent.originalEvent;
|
||||
return (
|
||||
!originalEvent.altKey &&
|
||||
@@ -155,7 +154,7 @@ _ol_events_condition_.noModifierKeys = function(mapBrowserEvent) {
|
||||
* @return {boolean} True if only the platform modifier key is pressed.
|
||||
* @api
|
||||
*/
|
||||
_ol_events_condition_.platformModifierKeyOnly = function(mapBrowserEvent) {
|
||||
export const platformModifierKeyOnly = function(mapBrowserEvent) {
|
||||
const originalEvent = mapBrowserEvent.originalEvent;
|
||||
return !originalEvent.altKey &&
|
||||
(MAC ? originalEvent.metaKey : originalEvent.ctrlKey) &&
|
||||
@@ -171,7 +170,7 @@ _ol_events_condition_.platformModifierKeyOnly = function(mapBrowserEvent) {
|
||||
* @return {boolean} True if only the shift key is pressed.
|
||||
* @api
|
||||
*/
|
||||
_ol_events_condition_.shiftKeyOnly = function(mapBrowserEvent) {
|
||||
export const shiftKeyOnly = function(mapBrowserEvent) {
|
||||
const originalEvent = mapBrowserEvent.originalEvent;
|
||||
return (
|
||||
!originalEvent.altKey &&
|
||||
@@ -188,7 +187,7 @@ _ol_events_condition_.shiftKeyOnly = function(mapBrowserEvent) {
|
||||
* @return {boolean} True only if the target element is not editable.
|
||||
* @api
|
||||
*/
|
||||
_ol_events_condition_.targetNotEditable = function(mapBrowserEvent) {
|
||||
export const targetNotEditable = function(mapBrowserEvent) {
|
||||
const target = mapBrowserEvent.originalEvent.target;
|
||||
const tagName = target.tagName;
|
||||
return (
|
||||
@@ -205,7 +204,7 @@ _ol_events_condition_.targetNotEditable = function(mapBrowserEvent) {
|
||||
* @return {boolean} True if the event originates from a mouse device.
|
||||
* @api
|
||||
*/
|
||||
_ol_events_condition_.mouseOnly = function(mapBrowserEvent) {
|
||||
export const mouseOnly = function(mapBrowserEvent) {
|
||||
assert(mapBrowserEvent.pointerEvent, 56); // mapBrowserEvent must originate from a pointer event
|
||||
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
|
||||
return /** @type {ol.MapBrowserEvent} */ (mapBrowserEvent).pointerEvent.pointerType == 'mouse';
|
||||
@@ -221,8 +220,7 @@ _ol_events_condition_.mouseOnly = function(mapBrowserEvent) {
|
||||
* @return {boolean} True if the event originates from a primary pointer.
|
||||
* @api
|
||||
*/
|
||||
_ol_events_condition_.primaryAction = function(mapBrowserEvent) {
|
||||
export const primaryAction = function(mapBrowserEvent) {
|
||||
const pointerEvent = mapBrowserEvent.pointerEvent;
|
||||
return pointerEvent.isPrimary && pointerEvent.button === 0;
|
||||
};
|
||||
export default _ol_events_condition_;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// FIXME draw drag box
|
||||
import Event from '../events/Event.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 _ol_render_Box_ from '../render/Box.js';
|
||||
|
||||
@@ -57,8 +57,7 @@ const DragBox = function(opt_options) {
|
||||
* @private
|
||||
* @type {ol.EventsConditionType}
|
||||
*/
|
||||
this.condition_ = options.condition ?
|
||||
options.condition : _ol_events_condition_.always;
|
||||
this.condition_ = options.condition ? options.condition : always;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -94,7 +93,7 @@ DragBox.defaultBoxEndCondition = function(mapBrowserEvent, startPixel, endPixel)
|
||||
* @private
|
||||
*/
|
||||
DragBox.handleDragEvent_ = function(mapBrowserEvent) {
|
||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -131,7 +130,7 @@ DragBox.prototype.onBoxEnd = nullFunction;
|
||||
* @private
|
||||
*/
|
||||
DragBox.handleUpEvent_ = function(mapBrowserEvent) {
|
||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -154,11 +153,11 @@ DragBox.handleUpEvent_ = function(mapBrowserEvent) {
|
||||
* @private
|
||||
*/
|
||||
DragBox.handleDownEvent_ = function(mapBrowserEvent) {
|
||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_ol_events_condition_.mouseActionButton(mapBrowserEvent) &&
|
||||
if (mouseActionButton(mapBrowserEvent) &&
|
||||
this.condition_(mapBrowserEvent)) {
|
||||
this.startPixel_ = mapBrowserEvent.pixel;
|
||||
this.box_.setMap(mapBrowserEvent.map);
|
||||
|
||||
@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
|
||||
import ViewHint from '../ViewHint.js';
|
||||
import _ol_coordinate_ from '../coordinate.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 PointerInteraction from '../interaction/Pointer.js';
|
||||
|
||||
@@ -48,8 +48,7 @@ const DragPan = function(opt_options) {
|
||||
* @private
|
||||
* @type {ol.EventsConditionType}
|
||||
*/
|
||||
this.condition_ = options.condition ?
|
||||
options.condition : _ol_events_condition_.noModifierKeys;
|
||||
this.condition_ = options.condition ? options.condition : noModifierKeys;
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {inherits} from '../index.js';
|
||||
import RotationConstraint from '../RotationConstraint.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 Interaction from '../interaction/Interaction.js';
|
||||
import PointerInteraction from '../interaction/Pointer.js';
|
||||
@@ -36,8 +36,7 @@ const DragRotate = function(opt_options) {
|
||||
* @private
|
||||
* @type {ol.EventsConditionType}
|
||||
*/
|
||||
this.condition_ = options.condition ?
|
||||
options.condition : _ol_events_condition_.altShiftKeysOnly;
|
||||
this.condition_ = options.condition ? options.condition : altShiftKeysOnly;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -61,7 +60,7 @@ inherits(DragRotate, PointerInteraction);
|
||||
* @private
|
||||
*/
|
||||
DragRotate.handleDragEvent_ = function(mapBrowserEvent) {
|
||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -91,7 +90,7 @@ DragRotate.handleDragEvent_ = function(mapBrowserEvent) {
|
||||
* @private
|
||||
*/
|
||||
DragRotate.handleUpEvent_ = function(mapBrowserEvent) {
|
||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -112,12 +111,11 @@ DragRotate.handleUpEvent_ = function(mapBrowserEvent) {
|
||||
* @private
|
||||
*/
|
||||
DragRotate.handleDownEvent_ = function(mapBrowserEvent) {
|
||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_ol_events_condition_.mouseActionButton(mapBrowserEvent) &&
|
||||
this.condition_(mapBrowserEvent)) {
|
||||
if (mouseActionButton(mapBrowserEvent) && this.condition_(mapBrowserEvent)) {
|
||||
const map = mapBrowserEvent.map;
|
||||
map.getView().setHint(ViewHint.INTERACTING, 1);
|
||||
this.lastAngle_ = undefined;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {inherits} from '../index.js';
|
||||
import RotationConstraint from '../RotationConstraint.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 PointerInteraction from '../interaction/Pointer.js';
|
||||
|
||||
@@ -37,8 +37,7 @@ const DragRotateAndZoom = function(opt_options) {
|
||||
* @private
|
||||
* @type {ol.EventsConditionType}
|
||||
*/
|
||||
this.condition_ = options.condition ?
|
||||
options.condition : _ol_events_condition_.shiftKeyOnly;
|
||||
this.condition_ = options.condition ? options.condition : shiftKeyOnly;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -75,7 +74,7 @@ inherits(DragRotateAndZoom, PointerInteraction);
|
||||
* @private
|
||||
*/
|
||||
DragRotateAndZoom.handleDragEvent_ = function(mapBrowserEvent) {
|
||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -111,7 +110,7 @@ DragRotateAndZoom.handleDragEvent_ = function(mapBrowserEvent) {
|
||||
* @private
|
||||
*/
|
||||
DragRotateAndZoom.handleUpEvent_ = function(mapBrowserEvent) {
|
||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -134,7 +133,7 @@ DragRotateAndZoom.handleUpEvent_ = function(mapBrowserEvent) {
|
||||
* @private
|
||||
*/
|
||||
DragRotateAndZoom.handleDownEvent_ = function(mapBrowserEvent) {
|
||||
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.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 DragBox from '../interaction/DragBox.js';
|
||||
|
||||
@@ -24,8 +24,7 @@ import DragBox from '../interaction/DragBox.js';
|
||||
const DragZoom = function(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
const condition = options.condition ?
|
||||
options.condition : _ol_events_condition_.shiftKeyOnly;
|
||||
const condition = options.condition ? options.condition : shiftKeyOnly;
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -10,7 +10,7 @@ import BaseObject from '../Object.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import {listen} from '../events.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 {TRUE, FALSE} from '../functions.js';
|
||||
import Circle from '../geom/Circle.js';
|
||||
@@ -291,8 +291,7 @@ const Draw = function(options) {
|
||||
* @private
|
||||
* @type {ol.EventsConditionType}
|
||||
*/
|
||||
this.condition_ = options.condition ?
|
||||
options.condition : _ol_events_condition_.noModifierKeys;
|
||||
this.condition_ = options.condition ? options.condition : noModifierKeys;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -300,10 +299,10 @@ const Draw = function(options) {
|
||||
*/
|
||||
this.freehandCondition_;
|
||||
if (options.freehand) {
|
||||
this.freehandCondition_ = _ol_events_condition_.always;
|
||||
this.freehandCondition_ = always;
|
||||
} else {
|
||||
this.freehandCondition_ = options.freehandCondition ?
|
||||
options.freehandCondition : _ol_events_condition_.shiftKeyOnly;
|
||||
options.freehandCondition : shiftKeyOnly;
|
||||
}
|
||||
|
||||
listen(this,
|
||||
|
||||
@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import EventType from '../events/EventType.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';
|
||||
|
||||
/**
|
||||
@@ -39,8 +39,8 @@ const KeyboardPan = function(opt_options) {
|
||||
* @return {boolean} Combined condition result.
|
||||
*/
|
||||
this.defaultCondition_ = function(mapBrowserEvent) {
|
||||
return _ol_events_condition_.noModifierKeys(mapBrowserEvent) &&
|
||||
_ol_events_condition_.targetNotEditable(mapBrowserEvent);
|
||||
return noModifierKeys(mapBrowserEvent) &&
|
||||
targetNotEditable(mapBrowserEvent);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.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';
|
||||
|
||||
/**
|
||||
@@ -35,8 +35,7 @@ const KeyboardZoom = function(opt_options) {
|
||||
* @private
|
||||
* @type {ol.EventsConditionType}
|
||||
*/
|
||||
this.condition_ = options.condition ? options.condition :
|
||||
_ol_events_condition_.targetNotEditable;
|
||||
this.condition_ = options.condition ? options.condition : targetNotEditable;
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -12,7 +12,7 @@ import _ol_coordinate_ from '../coordinate.js';
|
||||
import {listen, unlisten} from '../events.js';
|
||||
import Event from '../events/Event.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 GeometryType from '../geom/GeometryType.js';
|
||||
import Point from '../geom/Point.js';
|
||||
@@ -56,8 +56,7 @@ const Modify = function(options) {
|
||||
* @private
|
||||
* @type {ol.EventsConditionType}
|
||||
*/
|
||||
this.condition_ = options.condition ?
|
||||
options.condition : _ol_events_condition_.primaryAction;
|
||||
this.condition_ = options.condition ? options.condition : primaryAction;
|
||||
|
||||
|
||||
/**
|
||||
@@ -66,8 +65,7 @@ const Modify = function(options) {
|
||||
* @return {boolean} Combined condition result.
|
||||
*/
|
||||
this.defaultDeleteCondition_ = function(mapBrowserEvent) {
|
||||
return _ol_events_condition_.altKeyOnly(mapBrowserEvent) &&
|
||||
_ol_events_condition_.singleClick(mapBrowserEvent);
|
||||
return altKeyOnly(mapBrowserEvent) && singleClick(mapBrowserEvent);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -82,7 +80,7 @@ const Modify = function(options) {
|
||||
* @private
|
||||
*/
|
||||
this.insertVertexCondition_ = options.insertVertexCondition ?
|
||||
options.insertVertexCondition : _ol_events_condition_.always;
|
||||
options.insertVertexCondition : always;
|
||||
|
||||
/**
|
||||
* Editing vertex.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import ViewHint from '../ViewHint.js';
|
||||
import condition from '../events/condition.js';
|
||||
import {always} from '../events/condition.js';
|
||||
import {easeOut} from '../easing.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {DEVICE_PIXEL_RATIO, FIREFOX, SAFARI} from '../has.js';
|
||||
@@ -68,7 +68,7 @@ const MouseWheelZoom = function(opt_options) {
|
||||
* @private
|
||||
* @type {ol.EventsConditionType}
|
||||
*/
|
||||
this.condition_ = options.condition ? options.condition : condition.always;
|
||||
this.condition_ = options.condition ? options.condition : always;
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -6,7 +6,7 @@ import CollectionEventType from '../CollectionEventType.js';
|
||||
import {extend, includes} from '../array.js';
|
||||
import {listen} from '../events.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 GeometryType from '../geom/GeometryType.js';
|
||||
import Interaction from '../interaction/Interaction.js';
|
||||
@@ -45,29 +45,25 @@ const Select = function(opt_options) {
|
||||
* @private
|
||||
* @type {ol.EventsConditionType}
|
||||
*/
|
||||
this.condition_ = options.condition ?
|
||||
options.condition : _ol_events_condition_.singleClick;
|
||||
this.condition_ = options.condition ? options.condition : singleClick;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.EventsConditionType}
|
||||
*/
|
||||
this.addCondition_ = options.addCondition ?
|
||||
options.addCondition : _ol_events_condition_.never;
|
||||
this.addCondition_ = options.addCondition ? options.addCondition : never;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.EventsConditionType}
|
||||
*/
|
||||
this.removeCondition_ = options.removeCondition ?
|
||||
options.removeCondition : _ol_events_condition_.never;
|
||||
this.removeCondition_ = options.removeCondition ? options.removeCondition : never;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.EventsConditionType}
|
||||
*/
|
||||
this.toggleCondition_ = options.toggleCondition ?
|
||||
options.toggleCondition : _ol_events_condition_.shiftKeyOnly;
|
||||
this.toggleCondition_ = options.toggleCondition ? options.toggleCondition : shiftKeyOnly;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -283,7 +279,7 @@ Select.handleEvent = function(mapBrowserEvent) {
|
||||
new Select.Event(Select.EventType_.SELECT,
|
||||
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 {equals} from '../../../../src/ol/array.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 LineString from '../../../../src/ol/geom/LineString.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() {
|
||||
draw.freehand_ = true;
|
||||
draw.freehandCondition_ = _ol_events_condition_.always;
|
||||
draw.freehandCondition_ = always;
|
||||
|
||||
// no feture created when not moved
|
||||
simulateEvent('pointermove', 10, 20);
|
||||
|
||||
@@ -4,7 +4,7 @@ import Map from '../../../../src/ol/Map.js';
|
||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import View from '../../../../src/ol/View.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 LineString from '../../../../src/ol/geom/LineString.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
@@ -524,7 +524,7 @@ describe('ol.interaction.Modify', function() {
|
||||
beforeEach(function() {
|
||||
modify = new Modify({
|
||||
features: new Collection(features),
|
||||
deleteCondition: _ol_events_condition_.doubleClick
|
||||
deleteCondition: doubleClick
|
||||
});
|
||||
map.addInteraction(modify);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user