Rename chain function to all

This commit is contained in:
Andreas Hocevar
2020-06-13 08:37:46 +02:00
parent 3de2ea0624
commit dbe080d362
3 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -14,11 +14,11 @@ import {assert} from '../asserts.js';
*/ */
/** /**
* Creates a condition function that is only fulfilled when a chain of conditions pass. * Creates a condition function that passes when all provided conditions pass.
* @param {...Condition} var_args Conditions to check. * @param {...Condition} var_args Conditions to check.
* @return {Condition} Condition function that checks a chain of conditions. * @return {Condition} Condition function.
*/ */
export function chain(var_args) { export function all(var_args) {
const conditions = arguments; const conditions = arguments;
/** /**
* @param {import("../MapBrowserEvent.js").default} event Event. * @param {import("../MapBrowserEvent.js").default} event Event.
+3 -3
View File
@@ -6,7 +6,7 @@ import PointerInteraction, {
} from './Pointer.js'; } from './Pointer.js';
import {FALSE} from '../functions.js'; import {FALSE} from '../functions.js';
import { import {
chain, all,
focusWithTabindex, focusWithTabindex,
noModifierKeys, noModifierKeys,
primaryAction, primaryAction,
@@ -66,14 +66,14 @@ class DragPan extends PointerInteraction {
const condition = options.condition const condition = options.condition
? options.condition ? options.condition
: chain(noModifierKeys, primaryAction); : all(noModifierKeys, primaryAction);
/** /**
* @private * @private
* @type {import("../events/condition.js").Condition} * @type {import("../events/condition.js").Condition}
*/ */
this.condition_ = options.onFocusOnly this.condition_ = options.onFocusOnly
? chain(focusWithTabindex, condition) ? all(focusWithTabindex, condition)
: condition; : condition;
/** /**
+2 -2
View File
@@ -4,7 +4,7 @@
import EventType from '../events/EventType.js'; import EventType from '../events/EventType.js';
import Interaction, {zoomByDelta} from './Interaction.js'; import Interaction, {zoomByDelta} from './Interaction.js';
import {DEVICE_PIXEL_RATIO, FIREFOX} from '../has.js'; import {DEVICE_PIXEL_RATIO, FIREFOX} from '../has.js';
import {always, chain, focusWithTabindex} from '../events/condition.js'; import {all, always, focusWithTabindex} from '../events/condition.js';
import {clamp} from '../math.js'; import {clamp} from '../math.js';
/** /**
@@ -103,7 +103,7 @@ class MouseWheelZoom extends Interaction {
* @type {import("../events/condition.js").Condition} * @type {import("../events/condition.js").Condition}
*/ */
this.condition_ = options.onFocusOnly this.condition_ = options.onFocusOnly
? chain(focusWithTabindex, condition) ? all(focusWithTabindex, condition)
: condition; : condition;
/** /**