dragselect 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +47 -25
- package/deploying.md +7 -4
- package/dist/DragSelect.d.ts +10 -18
- package/dist/DragSelect.es6m.js +417 -570
- package/dist/DragSelect.js +417 -570
- package/dist/ds.es6m.min.js +1 -1
- package/dist/ds.min.js +1 -1
- package/dist/methods/createSelectorAreaElement.d.ts +1 -1
- package/dist/methods/getOverflowEdges.d.ts +1 -1
- package/dist/methods/hydrateSettings.d.ts +3 -0
- package/dist/methods/index.d.ts +1 -0
- package/dist/modules/Area.d.ts +10 -15
- package/dist/modules/Drag.d.ts +4 -40
- package/dist/modules/Interaction.d.ts +2 -24
- package/dist/modules/SelectableSet.d.ts +6 -38
- package/dist/modules/SelectedSet.d.ts +6 -10
- package/dist/modules/Selection.d.ts +2 -14
- package/dist/modules/Selector.d.ts +5 -11
- package/dist/modules/SelectorArea.d.ts +4 -17
- package/dist/stores/KeyStore.d.ts +2 -14
- package/dist/stores/ScrollStore.d.ts +2 -9
- package/dist/stores/SettingsStore.d.ts +39 -0
- package/dist/stores/index.d.ts +1 -0
- package/dist/types.d.ts +13 -32
- package/package.json +4 -3
- package/src/DragSelect.js +22 -174
- package/src/methods/createSelectorAreaElement.js +1 -3
- package/src/methods/hydrateSettings.js +109 -0
- package/src/methods/index.js +1 -0
- package/src/modules/Area.js +24 -22
- package/src/modules/Drag.js +37 -71
- package/src/modules/Interaction.js +31 -38
- package/src/modules/SelectableSet.js +29 -54
- package/src/modules/SelectedSet.js +4 -13
- package/src/modules/Selection.js +6 -19
- package/src/modules/Selector.js +21 -8
- package/src/modules/SelectorArea.js +12 -17
- package/src/stores/KeyStore.js +11 -37
- package/src/stores/ScrollStore.js +17 -17
- package/src/stores/SettingsStore.js +67 -0
- package/src/stores/index.js +1 -0
- package/src/types.js +4 -7
package/dist/DragSelect.es6m.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/***
|
|
2
2
|
|
|
3
|
-
~~~ Version 2.
|
|
3
|
+
~~~ Version 2.4.0 ~~~
|
|
4
4
|
|
|
5
5
|
******************************************
|
|
6
6
|
|
|
@@ -360,12 +360,6 @@ function _nonIterableRest() {
|
|
|
360
360
|
* @property {string} [selectedClass=ds-selected] the class assigned to the selected items
|
|
361
361
|
* @property {string} [selectorClass=ds-selector] the class assigned to the square selector helper
|
|
362
362
|
* @property {string} [selectorAreaClass=ds-selector-area] the class assigned to the square in which the selector resides. By default it's invisible
|
|
363
|
-
* @property {DSCallback} [callback] Deprecated: please use DragSelect.subscribe('callback', callback) instead
|
|
364
|
-
* @property {DSCallback} [onDragMove] Deprecated: please use DragSelect.subscribe('onDragMove', onDragMove) instead
|
|
365
|
-
* @property {DSCallback} [onDragStartBegin] Deprecated: please use DragSelect.subscribe('onDragStartBegin', onDragStartBegin) instead
|
|
366
|
-
* @property {DSCallback} [onDragStart] Deprecated: please use DragSelect.subscribe('onDragStart', onDragStart) instead
|
|
367
|
-
* @property {DSCallback} [onElementSelect] Deprecated: please use DragSelect.subscribe('onElementSelect', onElementSelect) instead
|
|
368
|
-
* @property {DSCallback} [onElementUnselect] Deprecated: please use DragSelect.subscribe('onElementUnselect', onElementUnselect) instead
|
|
369
363
|
*/
|
|
370
364
|
|
|
371
365
|
/**
|
|
@@ -377,6 +371,7 @@ function _nonIterableRest() {
|
|
|
377
371
|
* @property {boolean} [isDragging] Whether the interaction is a drag or a select
|
|
378
372
|
* @property {boolean} [isDraggingKeyboard] Whether or not the drag interaction is via keyboard
|
|
379
373
|
* @property {string} [key] Pressed key (lowercase)
|
|
374
|
+
* @property {Settings} [settings] the settings being updates/manipulated/passed, also holds the previous value. i.e. updating selectorClass will publish { settings: { selectorClass: 'newVal', 'selectorClass:pre': 'oldVal' } }
|
|
380
375
|
* @property {Array.<'top'|'bottom'|'left'|'right'|undefined>} [scroll_directions]
|
|
381
376
|
* @property {number} [scroll_multiplier]
|
|
382
377
|
*/
|
|
@@ -411,8 +406,11 @@ function _nonIterableRest() {
|
|
|
411
406
|
/** @typedef {'Interaction:init'|'Interaction:start'|'Interaction:end'|'Interaction:update'|'Area:modified'|'Area:scroll'|'PointerStore:updated'|'Selected:added'|'Selected:removed'|'Selectable:click'|'Selectable:pointer'|'KeyStore:down'|'KeyStore:up'} DSInternalEventNames */
|
|
412
407
|
|
|
413
408
|
/** @typedef {'Interaction:init:pre'|'Interaction:start:pre'|'Interaction:end:pre'|'Interaction:update:pre'|'Area:modified:pre'|'Area:scroll:pre'|'PointerStore:updated:pre'|'Selected:added:pre'|'Selected:removed:pre'|'Selectable:click:pre'|'Selectable:pointer:pre'|'KeyStore:down:pre'|'KeyStore:up:pre'} DSInternalEventNamesPre */
|
|
409
|
+
// @todo: update to typescript for complex defs like `Settings:updated:${string}` | `Settings:updated:${string}:pre`
|
|
414
410
|
|
|
415
|
-
/** @typedef {
|
|
411
|
+
/** @typedef {'Settings:updated'|'Settings:updated:pre'|'Settings:updated:*'|'Settings:updated:*:pre'} DSInternalSettingEvents */
|
|
412
|
+
|
|
413
|
+
/** @typedef {DSEventNames|DSInternalEventNames|DSInternalEventNamesPre|DSInternalSettingEvents} DSCallbackNames the name of the callback */
|
|
416
414
|
|
|
417
415
|
/** @typedef {{top:number,left:number,bottom:number,right:number,width:number,height:number}} DSBoundingRect */
|
|
418
416
|
|
|
@@ -536,17 +534,15 @@ var canScroll = (function (area) {
|
|
|
536
534
|
// @ts-check
|
|
537
535
|
/**
|
|
538
536
|
* Creates the SelectorArea
|
|
539
|
-
* @param {string} selectorAreaClass
|
|
540
537
|
* @return {HTMLDivElement}
|
|
541
538
|
*/
|
|
542
539
|
|
|
543
|
-
var createSelectorAreaElement = (function (
|
|
540
|
+
var createSelectorAreaElement = (function () {
|
|
544
541
|
var node = document.createElement('div');
|
|
545
542
|
node.style.position = 'fixed';
|
|
546
543
|
node.style.overflow = 'hidden';
|
|
547
544
|
node.style.pointerEvents = 'none';
|
|
548
545
|
node.style.zIndex = '999999999999999999';
|
|
549
|
-
node.classList.add(selectorAreaClass);
|
|
550
546
|
return node;
|
|
551
547
|
});
|
|
552
548
|
|
|
@@ -1073,6 +1069,107 @@ var handleUnSelection = (function (_ref) {
|
|
|
1073
1069
|
element.classList.remove(hoverClassName);
|
|
1074
1070
|
});
|
|
1075
1071
|
|
|
1072
|
+
/**
|
|
1073
|
+
* @param {string} key
|
|
1074
|
+
* @param {string} type
|
|
1075
|
+
* @param {*} fallback
|
|
1076
|
+
* @returns {void}
|
|
1077
|
+
*/
|
|
1078
|
+
var wrongTypeWarn = function wrongTypeWarn(key, type, fallback) {
|
|
1079
|
+
return console.warn("[DragSelect] TypeIssue: setting \"".concat(key, "\" is not of type \"").concat(type, "\"."));
|
|
1080
|
+
};
|
|
1081
|
+
/**
|
|
1082
|
+
* @param {string} key
|
|
1083
|
+
* @param {*} value
|
|
1084
|
+
* @param {boolean} withFallback
|
|
1085
|
+
* @param {*} fallback
|
|
1086
|
+
* @returns {object}
|
|
1087
|
+
*/
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
var hydrateHelper = function hydrateHelper(key, value, withFallback, fallback) {
|
|
1091
|
+
// no value available
|
|
1092
|
+
if (value === undefined) return withFallback ? _defineProperty({}, key, fallback) : {}; // force unsetting of a value
|
|
1093
|
+
|
|
1094
|
+
if (value === null) return _defineProperty({}, key, null); // TypeCheck [GENERIC]
|
|
1095
|
+
|
|
1096
|
+
var isAvailable = true; // if it’s not undefined, it was set voluntarily
|
|
1097
|
+
|
|
1098
|
+
var forceFallback = false; // TypeCheck [String]
|
|
1099
|
+
|
|
1100
|
+
var expectedString = typeof fallback === 'string';
|
|
1101
|
+
if (expectedString) isAvailable = typeof value === 'string' || value instanceof String;
|
|
1102
|
+
|
|
1103
|
+
if (expectedString && !isAvailable) {
|
|
1104
|
+
forceFallback = true;
|
|
1105
|
+
wrongTypeWarn(key, 'string');
|
|
1106
|
+
} // TypeCheck [Number]
|
|
1107
|
+
|
|
1108
|
+
|
|
1109
|
+
var expectedNumber = !isNaN(fallback) && typeof fallback === 'number';
|
|
1110
|
+
if (expectedNumber) isAvailable = !isNaN(value) && typeof value === 'number';
|
|
1111
|
+
|
|
1112
|
+
if (expectedNumber && !isAvailable) {
|
|
1113
|
+
forceFallback = true;
|
|
1114
|
+
wrongTypeWarn(key, 'number');
|
|
1115
|
+
} // TypeCheck [Object]
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
var expectedObject = Object.prototype.toString.call(fallback) === "[object Object]";
|
|
1119
|
+
if (expectedObject) isAvailable = Object.prototype.toString.call(value) === "[object Object]";
|
|
1120
|
+
|
|
1121
|
+
if (expectedObject && !isAvailable) {
|
|
1122
|
+
forceFallback = true;
|
|
1123
|
+
wrongTypeWarn(key, 'object');
|
|
1124
|
+
} // TypeCheck [Boolean]
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
var expectedBoolean = typeof fallback === "boolean";
|
|
1128
|
+
if (expectedBoolean) isAvailable = typeof value === "boolean";
|
|
1129
|
+
|
|
1130
|
+
if (expectedBoolean && !isAvailable) {
|
|
1131
|
+
forceFallback = true;
|
|
1132
|
+
wrongTypeWarn(key, 'boolean');
|
|
1133
|
+
} // TypeCheck [Array]
|
|
1134
|
+
|
|
1135
|
+
|
|
1136
|
+
var expectedArray = Array.isArray(fallback);
|
|
1137
|
+
if (expectedArray) isAvailable = Array.isArray(value);
|
|
1138
|
+
|
|
1139
|
+
if (expectedArray && !isAvailable) {
|
|
1140
|
+
forceFallback = true;
|
|
1141
|
+
wrongTypeWarn(key, 'array');
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
var isFallback = forceFallback || withFallback; // Special rule for [dragKeys]
|
|
1145
|
+
|
|
1146
|
+
if (key === 'dragKeys' && isAvailable) return _defineProperty({}, key, Object.assign(fallback, value));else if (key === 'dragKeys' && !isAvailable) return isFallback ? _defineProperty({}, key, fallback) : {};
|
|
1147
|
+
return isAvailable ? _defineProperty({}, key, value) : isFallback ? _defineProperty({}, key, fallback) : {};
|
|
1148
|
+
};
|
|
1149
|
+
/**
|
|
1150
|
+
* This helper method creates the setting object,
|
|
1151
|
+
* - if the settings provided are of wrong type, the fallback value will be used
|
|
1152
|
+
* - - except for if settings are undefined or explicitly marked as "null"
|
|
1153
|
+
* - if "withfallback" is true, it will return the object with all settings:
|
|
1154
|
+
* - - if not provided from the settings object (or wrong type), the fallback will be used
|
|
1155
|
+
* (the fallback value for each setting is the last prop of the hydrateHelper)
|
|
1156
|
+
* @param {Settings} settings
|
|
1157
|
+
* @param {boolean} withFallback
|
|
1158
|
+
*/
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
var hydrateSettings = (function (settings, withFallback) {
|
|
1162
|
+
return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, hydrateHelper('area', settings.area, withFallback, document)), hydrateHelper('selectables', settings.selectables, withFallback, null)), hydrateHelper('autoScrollSpeed', settings.autoScrollSpeed, withFallback, 5)), hydrateHelper('overflowTolerance', settings.overflowTolerance, withFallback, {
|
|
1163
|
+
x: 25,
|
|
1164
|
+
y: 25
|
|
1165
|
+
})), hydrateHelper('zoom', settings.zoom, withFallback, 1)), hydrateHelper('customStyles', settings.customStyles, withFallback, false)), hydrateHelper('multiSelectMode', settings.multiSelectMode, withFallback, false)), hydrateHelper('multiSelectToggling', settings.multiSelectToggling, withFallback, true)), hydrateHelper('multiSelectKeys', settings.multiSelectKeys, withFallback, ['Control', 'Shift', 'Meta'])), hydrateHelper('selector', settings.selector, withFallback, null)), hydrateHelper('draggability', settings.draggability, withFallback, true)), hydrateHelper('immediateDrag', settings.immediateDrag, withFallback, true)), hydrateHelper('keyboardDrag', settings.keyboardDrag, withFallback, true)), hydrateHelper('dragKeys', settings.dragKeys, withFallback, {
|
|
1166
|
+
up: ['ArrowUp'],
|
|
1167
|
+
down: ['ArrowDown'],
|
|
1168
|
+
left: ['ArrowLeft'],
|
|
1169
|
+
right: ['ArrowRight']
|
|
1170
|
+
})), hydrateHelper('keyboardDragSpeed', settings.keyboardDragSpeed, withFallback, 10)), hydrateHelper('useTransform', settings.useTransform, withFallback, true)), hydrateHelper('hoverClass', settings.hoverClass, withFallback, 'ds-hover')), hydrateHelper('selectableClass', settings.selectableClass, withFallback, 'ds-selectable')), hydrateHelper('selectedClass', settings.selectedClass, withFallback, 'ds-selected')), hydrateHelper('selectorClass', settings.selectorClass, withFallback, 'ds-selector')), hydrateHelper('selectorAreaClass', settings.selectorAreaClass, withFallback, 'ds-selector-area'));
|
|
1171
|
+
});
|
|
1172
|
+
|
|
1076
1173
|
// @ts-check
|
|
1077
1174
|
/**
|
|
1078
1175
|
* Axis-Aligned Bounding Box Collision Detection.
|
|
@@ -1308,14 +1405,12 @@ var updateElementStylePos = (function (element, pos) {
|
|
|
1308
1405
|
element.style.height = "".concat(pos.height, "px");
|
|
1309
1406
|
});
|
|
1310
1407
|
|
|
1311
|
-
/**
|
|
1312
|
-
* @typedef {Object} AreaProps
|
|
1313
|
-
* @property {DSArea} area
|
|
1314
|
-
* @property {PubSub} PS
|
|
1315
|
-
* @property {number} zoom
|
|
1316
|
-
*/
|
|
1317
|
-
|
|
1318
1408
|
var Area = /*#__PURE__*/function () {
|
|
1409
|
+
/**
|
|
1410
|
+
* @type {DragSelect}
|
|
1411
|
+
* @private
|
|
1412
|
+
*/
|
|
1413
|
+
|
|
1319
1414
|
/**
|
|
1320
1415
|
* @type {DSModificationCallback}
|
|
1321
1416
|
* @private
|
|
@@ -1358,18 +1453,18 @@ var Area = /*#__PURE__*/function () {
|
|
|
1358
1453
|
|
|
1359
1454
|
/**
|
|
1360
1455
|
* @constructor Area
|
|
1361
|
-
* @param {
|
|
1456
|
+
* @param {{DS:DragSelect}} p
|
|
1362
1457
|
* @ignore
|
|
1363
1458
|
*/
|
|
1364
1459
|
function Area(_ref) {
|
|
1365
1460
|
var _this = this;
|
|
1366
1461
|
|
|
1367
|
-
var
|
|
1368
|
-
PS = _ref.PS,
|
|
1369
|
-
zoom = _ref.zoom;
|
|
1462
|
+
var DS = _ref.DS;
|
|
1370
1463
|
|
|
1371
1464
|
_classCallCheck(this, Area);
|
|
1372
1465
|
|
|
1466
|
+
_defineProperty(this, "DS", void 0);
|
|
1467
|
+
|
|
1373
1468
|
_defineProperty(this, "_modificationCallback", void 0);
|
|
1374
1469
|
|
|
1375
1470
|
_defineProperty(this, "_modificationObserver", void 0);
|
|
@@ -1394,13 +1489,13 @@ var Area = /*#__PURE__*/function () {
|
|
|
1394
1489
|
}); // first immediate debounce to update values after dom-update
|
|
1395
1490
|
|
|
1396
1491
|
setTimeout(function () {
|
|
1397
|
-
_this.PubSub.publish('Area:modified:pre', {
|
|
1492
|
+
_this.DS.PubSub.publish('Area:modified:pre', {
|
|
1398
1493
|
item: _this
|
|
1399
1494
|
});
|
|
1400
1495
|
|
|
1401
1496
|
_this.reset();
|
|
1402
1497
|
|
|
1403
|
-
_this.PubSub.publish('Area:modified', {
|
|
1498
|
+
_this.DS.PubSub.publish('Area:modified', {
|
|
1404
1499
|
item: _this
|
|
1405
1500
|
});
|
|
1406
1501
|
});
|
|
@@ -1429,32 +1524,36 @@ var Area = /*#__PURE__*/function () {
|
|
|
1429
1524
|
scroll_multiplier: multiplier
|
|
1430
1525
|
};
|
|
1431
1526
|
|
|
1432
|
-
_this.PubSub.publish('Area:scroll:pre', data);
|
|
1527
|
+
_this.DS.PubSub.publish('Area:scroll:pre', data);
|
|
1433
1528
|
|
|
1434
1529
|
scrollElement(_this._node, directions, multiplier);
|
|
1435
1530
|
|
|
1436
|
-
_this.PubSub.publish('Area:scroll', data);
|
|
1531
|
+
_this.DS.PubSub.publish('Area:scroll', data);
|
|
1437
1532
|
});
|
|
1438
1533
|
|
|
1439
|
-
this.
|
|
1440
|
-
this.
|
|
1441
|
-
|
|
1534
|
+
this.DS = DS;
|
|
1535
|
+
this.setArea(this.DS.stores.SettingsStore.s.area); // @ts-ignore: @todo: update to typescript
|
|
1536
|
+
|
|
1537
|
+
this.DS.PubSub.subscribe('Settings:updated:area', function (_ref2) {
|
|
1538
|
+
var settings = _ref2.settings;
|
|
1539
|
+
return _this.setArea(settings.area);
|
|
1540
|
+
});
|
|
1442
1541
|
this._modificationCallback = debounce(function (event) {
|
|
1443
|
-
_this.PubSub.publish('Area:modified:pre', {
|
|
1542
|
+
_this.DS.PubSub.publish('Area:modified:pre', {
|
|
1444
1543
|
event: event,
|
|
1445
1544
|
item: _this
|
|
1446
1545
|
});
|
|
1447
1546
|
|
|
1448
1547
|
_this.reset();
|
|
1449
1548
|
|
|
1450
|
-
_this.PubSub.publish('Area:modified', {
|
|
1549
|
+
_this.DS.PubSub.publish('Area:modified', {
|
|
1451
1550
|
event: event,
|
|
1452
1551
|
item: _this
|
|
1453
1552
|
});
|
|
1454
1553
|
}, 60);
|
|
1455
1554
|
this._modificationObserver = new MutationObserver(this._modificationCallback);
|
|
1456
|
-
this.PubSub.subscribe('Interaction:init', this.start);
|
|
1457
|
-
this.PubSub.subscribe('Interaction:end', this.reset);
|
|
1555
|
+
this.DS.PubSub.subscribe('Interaction:init', this.start);
|
|
1556
|
+
this.DS.PubSub.subscribe('Interaction:end', this.reset);
|
|
1458
1557
|
}
|
|
1459
1558
|
/** @param {DSArea} area */
|
|
1460
1559
|
|
|
@@ -1505,7 +1604,7 @@ var Area = /*#__PURE__*/function () {
|
|
|
1505
1604
|
key: "rect",
|
|
1506
1605
|
get: function get() {
|
|
1507
1606
|
if (this._rect) return this._rect;
|
|
1508
|
-
return this._rect = getAreaRect(this.HTMLNode, this.
|
|
1607
|
+
return this._rect = getAreaRect(this.HTMLNode, this.DS.stores.SettingsStore.s.zoom);
|
|
1509
1608
|
}
|
|
1510
1609
|
}, {
|
|
1511
1610
|
key: "parentNodes",
|
|
@@ -1536,11 +1635,6 @@ var Area = /*#__PURE__*/function () {
|
|
|
1536
1635
|
}();
|
|
1537
1636
|
|
|
1538
1637
|
var Drag = /*#__PURE__*/function () {
|
|
1539
|
-
/**
|
|
1540
|
-
* @type {boolean}
|
|
1541
|
-
* @private
|
|
1542
|
-
*/
|
|
1543
|
-
|
|
1544
1638
|
/**
|
|
1545
1639
|
* @type {Vect2}
|
|
1546
1640
|
* @private
|
|
@@ -1556,11 +1650,6 @@ var Drag = /*#__PURE__*/function () {
|
|
|
1556
1650
|
* @private
|
|
1557
1651
|
*/
|
|
1558
1652
|
|
|
1559
|
-
/**
|
|
1560
|
-
* @type {boolean}
|
|
1561
|
-
* @private
|
|
1562
|
-
*/
|
|
1563
|
-
|
|
1564
1653
|
/**
|
|
1565
1654
|
* @type {DSDragKeys}
|
|
1566
1655
|
* @private
|
|
@@ -1572,68 +1661,52 @@ var Drag = /*#__PURE__*/function () {
|
|
|
1572
1661
|
*/
|
|
1573
1662
|
|
|
1574
1663
|
/**
|
|
1575
|
-
* @
|
|
1576
|
-
* @
|
|
1577
|
-
*/
|
|
1578
|
-
|
|
1579
|
-
/**
|
|
1580
|
-
* @type {number}
|
|
1581
|
-
* @private
|
|
1582
|
-
*/
|
|
1583
|
-
|
|
1584
|
-
/**
|
|
1585
|
-
* @type {number}
|
|
1586
|
-
* @private
|
|
1587
|
-
*/
|
|
1588
|
-
|
|
1589
|
-
/**
|
|
1590
|
-
* @param {Object} p
|
|
1591
|
-
* @param {DragSelect} p.DS
|
|
1592
|
-
* @param {boolean} p.draggability
|
|
1593
|
-
* @param {boolean} p.useTransform
|
|
1594
|
-
* @param {DSDragKeys} p.dragKeys
|
|
1595
|
-
* @param {boolean} p.keyboardDrag
|
|
1596
|
-
* @param {number} p.keyboardDragSpeed
|
|
1597
|
-
* @param {number} p.zoom
|
|
1664
|
+
* @constructor Drag
|
|
1665
|
+
* @param {{DS:DragSelect}} obj
|
|
1598
1666
|
* @ignore
|
|
1599
1667
|
*/
|
|
1600
1668
|
function Drag(_ref) {
|
|
1601
1669
|
var _this = this;
|
|
1602
1670
|
|
|
1603
|
-
var DS = _ref.DS
|
|
1604
|
-
dragKeys = _ref.dragKeys,
|
|
1605
|
-
draggability = _ref.draggability,
|
|
1606
|
-
keyboardDrag = _ref.keyboardDrag,
|
|
1607
|
-
keyboardDragSpeed = _ref.keyboardDragSpeed,
|
|
1608
|
-
useTransform = _ref.useTransform,
|
|
1609
|
-
zoom = _ref.zoom;
|
|
1671
|
+
var DS = _ref.DS;
|
|
1610
1672
|
|
|
1611
1673
|
_classCallCheck(this, Drag);
|
|
1612
1674
|
|
|
1613
|
-
_defineProperty(this, "_useTransform", void 0);
|
|
1614
|
-
|
|
1615
1675
|
_defineProperty(this, "_prevCursorPos", void 0);
|
|
1616
1676
|
|
|
1617
1677
|
_defineProperty(this, "_prevScrollPos", void 0);
|
|
1618
1678
|
|
|
1619
1679
|
_defineProperty(this, "_elements", []);
|
|
1620
1680
|
|
|
1621
|
-
_defineProperty(this, "_draggability", void 0);
|
|
1622
|
-
|
|
1623
1681
|
_defineProperty(this, "_dragKeys", void 0);
|
|
1624
1682
|
|
|
1625
|
-
_defineProperty(this, "_dragKeysFlat",
|
|
1626
|
-
|
|
1627
|
-
_defineProperty(this, "
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1683
|
+
_defineProperty(this, "_dragKeysFlat", []);
|
|
1684
|
+
|
|
1685
|
+
_defineProperty(this, "assignDragkeys", function () {
|
|
1686
|
+
_this._dragKeys = {
|
|
1687
|
+
up: _this.DS.stores.SettingsStore.s.dragKeys.up.map(function (k) {
|
|
1688
|
+
return k.toLowerCase();
|
|
1689
|
+
}),
|
|
1690
|
+
down: _this.DS.stores.SettingsStore.s.dragKeys.down.map(function (k) {
|
|
1691
|
+
return k.toLowerCase();
|
|
1692
|
+
}),
|
|
1693
|
+
left: _this.DS.stores.SettingsStore.s.dragKeys.left.map(function (k) {
|
|
1694
|
+
return k.toLowerCase();
|
|
1695
|
+
}),
|
|
1696
|
+
right: _this.DS.stores.SettingsStore.s.dragKeys.right.map(function (k) {
|
|
1697
|
+
return k.toLowerCase();
|
|
1698
|
+
})
|
|
1699
|
+
};
|
|
1700
|
+
_this._dragKeysFlat = [].concat(_toConsumableArray(_this._dragKeys.up), _toConsumableArray(_this._dragKeys.down), _toConsumableArray(_this._dragKeys.left), _toConsumableArray(_this._dragKeys.right));
|
|
1701
|
+
});
|
|
1632
1702
|
|
|
1633
1703
|
_defineProperty(this, "keyboardDrag", function (_ref2) {
|
|
1634
1704
|
var event = _ref2.event,
|
|
1635
1705
|
key = _ref2.key;
|
|
1636
|
-
|
|
1706
|
+
|
|
1707
|
+
var _key = key.toLowerCase();
|
|
1708
|
+
|
|
1709
|
+
if (!_this.DS.stores.SettingsStore.s.keyboardDrag || !_this._dragKeysFlat.includes(_key) || !_this.DS.SelectedSet.size || !_this.DS.stores.SettingsStore.s.draggability || _this.DS["continue"]) return;
|
|
1637
1710
|
var publishData = {
|
|
1638
1711
|
event: event,
|
|
1639
1712
|
isDragging: true,
|
|
@@ -1648,9 +1721,9 @@ var Drag = /*#__PURE__*/function () {
|
|
|
1648
1721
|
|
|
1649
1722
|
var posDirection = handleKeyboardDragPosDifference({
|
|
1650
1723
|
shiftKey: _this.DS.stores.KeyStore.currentValues.includes('shift'),
|
|
1651
|
-
keyboardDragSpeed: _this.
|
|
1652
|
-
zoom: _this.
|
|
1653
|
-
key:
|
|
1724
|
+
keyboardDragSpeed: _this.DS.stores.SettingsStore.s.keyboardDragSpeed,
|
|
1725
|
+
zoom: _this.DS.stores.SettingsStore.s.zoom,
|
|
1726
|
+
key: _key,
|
|
1654
1727
|
scrollCallback: _this.DS.Area.scroll,
|
|
1655
1728
|
scrollDiff: _this._scrollDiff,
|
|
1656
1729
|
canScroll: _this.DS.stores.ScrollStore.canScroll,
|
|
@@ -1662,7 +1735,7 @@ var Drag = /*#__PURE__*/function () {
|
|
|
1662
1735
|
element: element,
|
|
1663
1736
|
posDirection: posDirection,
|
|
1664
1737
|
containerRect: _this.DS.SelectorArea.rect,
|
|
1665
|
-
useTransform: _this.
|
|
1738
|
+
useTransform: _this.DS.stores.SettingsStore.s.useTransform
|
|
1666
1739
|
});
|
|
1667
1740
|
});
|
|
1668
1741
|
|
|
@@ -1672,10 +1745,13 @@ var Drag = /*#__PURE__*/function () {
|
|
|
1672
1745
|
_defineProperty(this, "keyboardEnd", function (_ref3) {
|
|
1673
1746
|
var event = _ref3.event,
|
|
1674
1747
|
key = _ref3.key;
|
|
1675
|
-
|
|
1748
|
+
|
|
1749
|
+
var _key = key.toLowerCase();
|
|
1750
|
+
|
|
1751
|
+
if (!_this.DS.stores.SettingsStore.s.keyboardDrag || !_this._dragKeysFlat.includes(_key) || !_this.DS.SelectedSet.size || !_this.DS.stores.SettingsStore.s.draggability) return;
|
|
1676
1752
|
var publishData = {
|
|
1677
1753
|
event: event,
|
|
1678
|
-
isDragging: _this.
|
|
1754
|
+
isDragging: _this.DS.stores.SettingsStore.s.draggability,
|
|
1679
1755
|
isDraggingKeyboard: true
|
|
1680
1756
|
};
|
|
1681
1757
|
|
|
@@ -1714,7 +1790,7 @@ var Drag = /*#__PURE__*/function () {
|
|
|
1714
1790
|
element: element,
|
|
1715
1791
|
posDirection: posDirection,
|
|
1716
1792
|
containerRect: _this.DS.SelectorArea.rect,
|
|
1717
|
-
useTransform: _this.
|
|
1793
|
+
useTransform: _this.DS.stores.SettingsStore.s.useTransform
|
|
1718
1794
|
});
|
|
1719
1795
|
});
|
|
1720
1796
|
});
|
|
@@ -1725,27 +1801,10 @@ var Drag = /*#__PURE__*/function () {
|
|
|
1725
1801
|
});
|
|
1726
1802
|
});
|
|
1727
1803
|
|
|
1728
|
-
this.DS = DS;
|
|
1729
|
-
|
|
1730
|
-
this.
|
|
1731
|
-
this.
|
|
1732
|
-
this._zoom = zoom;
|
|
1733
|
-
this._draggability = draggability;
|
|
1734
|
-
this._dragKeys = {
|
|
1735
|
-
up: dragKeys.up.map(function (k) {
|
|
1736
|
-
return k.toLowerCase();
|
|
1737
|
-
}),
|
|
1738
|
-
down: dragKeys.down.map(function (k) {
|
|
1739
|
-
return k.toLowerCase();
|
|
1740
|
-
}),
|
|
1741
|
-
left: dragKeys.left.map(function (k) {
|
|
1742
|
-
return k.toLowerCase();
|
|
1743
|
-
}),
|
|
1744
|
-
right: dragKeys.right.map(function (k) {
|
|
1745
|
-
return k.toLowerCase();
|
|
1746
|
-
})
|
|
1747
|
-
};
|
|
1748
|
-
this._dragKeysFlat = [].concat(_toConsumableArray(this._dragKeys.up), _toConsumableArray(this._dragKeys.down), _toConsumableArray(this._dragKeys.left), _toConsumableArray(this._dragKeys.right));
|
|
1804
|
+
this.DS = DS; // @ts-ignore: @todo: update to typescript
|
|
1805
|
+
|
|
1806
|
+
this.DS.subscribe('Settings:updated:dragKeys', this.assignDragkeys);
|
|
1807
|
+
this.assignDragkeys();
|
|
1749
1808
|
this.DS.subscribe('Interaction:start', this.start);
|
|
1750
1809
|
this.DS.subscribe('Interaction:end', this.stop);
|
|
1751
1810
|
this.DS.subscribe('Interaction:update', this.update);
|
|
@@ -1781,50 +1840,22 @@ var Drag = /*#__PURE__*/function () {
|
|
|
1781
1840
|
}();
|
|
1782
1841
|
|
|
1783
1842
|
var Interaction = /*#__PURE__*/function () {
|
|
1784
|
-
/**
|
|
1785
|
-
* @type {DSArea}
|
|
1786
|
-
* @private
|
|
1787
|
-
* */
|
|
1788
|
-
|
|
1789
|
-
/**
|
|
1790
|
-
* @type {boolean}
|
|
1791
|
-
* @private
|
|
1792
|
-
* */
|
|
1793
|
-
|
|
1794
|
-
/**
|
|
1795
|
-
* @type {boolean}
|
|
1796
|
-
* @private
|
|
1797
|
-
* */
|
|
1798
|
-
|
|
1799
1843
|
/** @type {boolean} */
|
|
1800
1844
|
|
|
1801
1845
|
/** @type {boolean} */
|
|
1802
1846
|
|
|
1803
1847
|
/**
|
|
1804
1848
|
* @constructor Interaction
|
|
1805
|
-
* @param {
|
|
1806
|
-
* @param {DSArea} obj.areaElement
|
|
1807
|
-
* @param {boolean} obj.draggability
|
|
1808
|
-
* @param {boolean} obj.immediateDrag
|
|
1809
|
-
* @param {DragSelect} obj.DS
|
|
1849
|
+
* @param {{DS:DragSelect}} obj
|
|
1810
1850
|
* @ignore
|
|
1811
1851
|
*/
|
|
1812
1852
|
function Interaction(_ref) {
|
|
1813
1853
|
var _this = this;
|
|
1814
1854
|
|
|
1815
|
-
var
|
|
1816
|
-
DS = _ref.DS,
|
|
1817
|
-
draggability = _ref.draggability,
|
|
1818
|
-
immediateDrag = _ref.immediateDrag;
|
|
1855
|
+
var DS = _ref.DS;
|
|
1819
1856
|
|
|
1820
1857
|
_classCallCheck(this, Interaction);
|
|
1821
1858
|
|
|
1822
|
-
_defineProperty(this, "_areaElement", void 0);
|
|
1823
|
-
|
|
1824
|
-
_defineProperty(this, "_draggability", void 0);
|
|
1825
|
-
|
|
1826
|
-
_defineProperty(this, "_immediateDrag", void 0);
|
|
1827
|
-
|
|
1828
1859
|
_defineProperty(this, "isInteracting", void 0);
|
|
1829
1860
|
|
|
1830
1861
|
_defineProperty(this, "isDragging", void 0);
|
|
@@ -1836,9 +1867,9 @@ var Interaction = /*#__PURE__*/function () {
|
|
|
1836
1867
|
_defineProperty(this, "_init", function () {
|
|
1837
1868
|
_this.stop();
|
|
1838
1869
|
|
|
1839
|
-
_this.
|
|
1870
|
+
_this.DS.Area.HTMLNode.addEventListener('mousedown', _this.start);
|
|
1840
1871
|
|
|
1841
|
-
_this.
|
|
1872
|
+
_this.DS.Area.HTMLNode.addEventListener('touchstart', _this.start, {
|
|
1842
1873
|
passive: false
|
|
1843
1874
|
});
|
|
1844
1875
|
|
|
@@ -1869,21 +1900,24 @@ var Interaction = /*#__PURE__*/function () {
|
|
|
1869
1900
|
});
|
|
1870
1901
|
|
|
1871
1902
|
_defineProperty(this, "isDragEvent", function (event) {
|
|
1872
|
-
|
|
1903
|
+
var clickedElement =
|
|
1904
|
+
/** @type {Element} */
|
|
1905
|
+
event.target.closest(".".concat(_this.DS.stores.SettingsStore.s.selectableClass));
|
|
1906
|
+
if (!_this.DS.stores.SettingsStore.s.draggability || _this.DS.stores.KeyStore.isMultiSelectKeyPressed(event) || !clickedElement) return false;
|
|
1873
1907
|
|
|
1874
|
-
if (_this.
|
|
1908
|
+
if (_this.DS.stores.SettingsStore.s.immediateDrag) {
|
|
1875
1909
|
if (!_this.DS.SelectedSet.size) _this.DS.SelectedSet.add(
|
|
1876
1910
|
/** @type {DSElement} */
|
|
1877
|
-
|
|
1911
|
+
clickedElement);else if (!_this.DS.SelectedSet.has(clickedElement)) {
|
|
1878
1912
|
_this.DS.SelectedSet.clear();
|
|
1879
1913
|
|
|
1880
1914
|
_this.DS.SelectedSet.add(
|
|
1881
1915
|
/** @type {DSElement} */
|
|
1882
|
-
|
|
1916
|
+
clickedElement);
|
|
1883
1917
|
}
|
|
1884
1918
|
}
|
|
1885
1919
|
|
|
1886
|
-
if (_this.DS.SelectedSet.has(
|
|
1920
|
+
if (_this.DS.SelectedSet.has(clickedElement)) return true;
|
|
1887
1921
|
return false;
|
|
1888
1922
|
});
|
|
1889
1923
|
|
|
@@ -1914,9 +1948,9 @@ var Interaction = /*#__PURE__*/function () {
|
|
|
1914
1948
|
_this.isInteracting = false;
|
|
1915
1949
|
_this.isDragging = false;
|
|
1916
1950
|
|
|
1917
|
-
_this.
|
|
1951
|
+
_this.DS.Area.HTMLNode.removeEventListener('mousedown', _this.start);
|
|
1918
1952
|
|
|
1919
|
-
_this.
|
|
1953
|
+
_this.DS.Area.HTMLNode.removeEventListener('touchstart', _this.start, {
|
|
1920
1954
|
// @ts-ignore
|
|
1921
1955
|
passive: false
|
|
1922
1956
|
});
|
|
@@ -1957,10 +1991,9 @@ var Interaction = /*#__PURE__*/function () {
|
|
|
1957
1991
|
});
|
|
1958
1992
|
});
|
|
1959
1993
|
|
|
1960
|
-
this.
|
|
1961
|
-
|
|
1962
|
-
this.
|
|
1963
|
-
this.DS = DS;
|
|
1994
|
+
this.DS = DS; // @ts-ignore: @todo: update to typescript
|
|
1995
|
+
|
|
1996
|
+
this.DS.subscribe('Settings:updated:area', this.init);
|
|
1964
1997
|
this.DS.subscribe('PointerStore:updated', this.update);
|
|
1965
1998
|
this.DS.subscribe('Selectable:click', this.onClick);
|
|
1966
1999
|
this.DS.subscribe('Selectable:pointer', function (_ref4) {
|
|
@@ -2081,68 +2114,22 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
|
|
|
2081
2114
|
|
|
2082
2115
|
var _super = _createSuper(SelectableSet);
|
|
2083
2116
|
|
|
2084
|
-
/**
|
|
2085
|
-
* @type {DSElements}
|
|
2086
|
-
* @private
|
|
2087
|
-
* */
|
|
2088
|
-
|
|
2089
|
-
/**
|
|
2090
|
-
* @type {string}
|
|
2091
|
-
* @private
|
|
2092
|
-
* */
|
|
2093
|
-
|
|
2094
|
-
/**
|
|
2095
|
-
* @type {string}
|
|
2096
|
-
* @private
|
|
2097
|
-
* */
|
|
2098
|
-
|
|
2099
|
-
/**
|
|
2100
|
-
* @type {boolean}
|
|
2101
|
-
* @private
|
|
2102
|
-
* */
|
|
2103
|
-
|
|
2104
|
-
/**
|
|
2105
|
-
* @type {boolean}
|
|
2106
|
-
* @private
|
|
2107
|
-
* */
|
|
2108
|
-
|
|
2109
2117
|
/**
|
|
2110
2118
|
* @constructor SelectableSet
|
|
2111
|
-
* @param {
|
|
2112
|
-
* @param {DSInputElements} p.elements
|
|
2113
|
-
* @param {DragSelect} p.DS
|
|
2114
|
-
* @param {string} p.className
|
|
2115
|
-
* @param {string} p.hoverClassName
|
|
2116
|
-
* @param {boolean} p.useTransform
|
|
2117
|
-
* @param {boolean} p.draggability
|
|
2119
|
+
* @param {{DS:DragSelect}} obj
|
|
2118
2120
|
* @ignore
|
|
2119
2121
|
*/
|
|
2120
2122
|
function SelectableSet(_ref) {
|
|
2121
2123
|
var _this;
|
|
2122
2124
|
|
|
2123
|
-
var
|
|
2124
|
-
className = _ref.className,
|
|
2125
|
-
hoverClassName = _ref.hoverClassName,
|
|
2126
|
-
draggability = _ref.draggability,
|
|
2127
|
-
useTransform = _ref.useTransform,
|
|
2128
|
-
DS = _ref.DS;
|
|
2125
|
+
var DS = _ref.DS;
|
|
2129
2126
|
|
|
2130
2127
|
_classCallCheck(this, SelectableSet);
|
|
2131
2128
|
|
|
2132
2129
|
_this = _super.call(this);
|
|
2133
2130
|
|
|
2134
|
-
_defineProperty(_assertThisInitialized(_this), "_initElements", void 0);
|
|
2135
|
-
|
|
2136
|
-
_defineProperty(_assertThisInitialized(_this), "_className", void 0);
|
|
2137
|
-
|
|
2138
|
-
_defineProperty(_assertThisInitialized(_this), "_hoverClassName", void 0);
|
|
2139
|
-
|
|
2140
|
-
_defineProperty(_assertThisInitialized(_this), "_useTransform", void 0);
|
|
2141
|
-
|
|
2142
|
-
_defineProperty(_assertThisInitialized(_this), "_draggability", void 0);
|
|
2143
|
-
|
|
2144
2131
|
_defineProperty(_assertThisInitialized(_this), "init", function () {
|
|
2145
|
-
return _this.
|
|
2132
|
+
return toArray(_this.DS.stores.SettingsStore.s.selectables).forEach(function (el) {
|
|
2146
2133
|
return _this.add(el);
|
|
2147
2134
|
});
|
|
2148
2135
|
});
|
|
@@ -2178,13 +2165,25 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
|
|
|
2178
2165
|
});
|
|
2179
2166
|
|
|
2180
2167
|
_this.DS = DS;
|
|
2181
|
-
_this._initElements = toArray(_elements);
|
|
2182
|
-
_this._className = className;
|
|
2183
|
-
_this._hoverClassName = hoverClassName;
|
|
2184
|
-
_this._useTransform = useTransform;
|
|
2185
|
-
_this._draggability = draggability;
|
|
2186
2168
|
|
|
2187
|
-
_this.DS.subscribe('Interaction:init', _this.init);
|
|
2169
|
+
_this.DS.subscribe('Interaction:init', _this.init); // @ts-ignore: @todo: update to typescript
|
|
2170
|
+
|
|
2171
|
+
|
|
2172
|
+
_this.DS.PubSub.subscribe('Settings:updated:selectables', function () {
|
|
2173
|
+
_this.clear();
|
|
2174
|
+
|
|
2175
|
+
_this.init();
|
|
2176
|
+
}); // @ts-ignore: @todo: update to typescript
|
|
2177
|
+
|
|
2178
|
+
|
|
2179
|
+
_this.DS.subscribe('Settings:updated:selectableClass', function (_ref2) {
|
|
2180
|
+
var settings = _ref2.settings;
|
|
2181
|
+
|
|
2182
|
+
_this.forEach(function (el) {
|
|
2183
|
+
el.classList.remove(settings['selectableClass:pre']);
|
|
2184
|
+
el.classList.add(settings['selectableClass']);
|
|
2185
|
+
});
|
|
2186
|
+
});
|
|
2188
2187
|
|
|
2189
2188
|
return _this;
|
|
2190
2189
|
}
|
|
@@ -2194,14 +2193,14 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
|
|
|
2194
2193
|
|
|
2195
2194
|
/** @param {DSElement} element */
|
|
2196
2195
|
value: function add(element) {
|
|
2197
|
-
element.classList.add(this.
|
|
2196
|
+
element.classList.add(this.DS.stores.SettingsStore.s.selectableClass);
|
|
2198
2197
|
element.addEventListener('click', this._onClick);
|
|
2199
2198
|
element.addEventListener('mousedown', this._onPointer);
|
|
2200
2199
|
element.addEventListener('touchstart', this._onPointer, {
|
|
2201
2200
|
// @ts-ignore
|
|
2202
2201
|
passive: false
|
|
2203
2202
|
});
|
|
2204
|
-
if (this.
|
|
2203
|
+
if (this.DS.stores.SettingsStore.s.draggability && !this.DS.stores.SettingsStore.s.useTransform) handleElementPositionAttribute({
|
|
2205
2204
|
computedStyle: window.getComputedStyle(element),
|
|
2206
2205
|
node: element
|
|
2207
2206
|
});
|
|
@@ -2212,8 +2211,8 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
|
|
|
2212
2211
|
}, {
|
|
2213
2212
|
key: "delete",
|
|
2214
2213
|
value: function _delete(element) {
|
|
2215
|
-
element.classList.remove(this.
|
|
2216
|
-
element.classList.remove(this.
|
|
2214
|
+
element.classList.remove(this.DS.stores.SettingsStore.s.selectableClass);
|
|
2215
|
+
element.classList.remove(this.DS.stores.SettingsStore.s.hoverClass);
|
|
2217
2216
|
element.removeEventListener('click', this._onClick);
|
|
2218
2217
|
element.removeEventListener('mousedown', this._onPointer);
|
|
2219
2218
|
element.removeEventListener('touchstart', this._onPointer, {
|
|
@@ -2239,30 +2238,20 @@ var SelectedSet = /*#__PURE__*/function (_Set) {
|
|
|
2239
2238
|
|
|
2240
2239
|
var _super = _createSuper(SelectedSet);
|
|
2241
2240
|
|
|
2242
|
-
/**
|
|
2243
|
-
* @type {string}
|
|
2244
|
-
* @private
|
|
2245
|
-
* */
|
|
2246
|
-
|
|
2247
2241
|
/**
|
|
2248
2242
|
* @constructor SelectableSet
|
|
2249
|
-
* @param {
|
|
2250
|
-
* @param {DragSelect} p.DS
|
|
2251
|
-
* @param {string} p.className
|
|
2243
|
+
* @param {{DS:DragSelect}} obj
|
|
2252
2244
|
* @ignore
|
|
2253
2245
|
*/
|
|
2254
2246
|
function SelectedSet(_ref) {
|
|
2255
2247
|
var _this;
|
|
2256
2248
|
|
|
2257
|
-
var
|
|
2258
|
-
DS = _ref.DS;
|
|
2249
|
+
var DS = _ref.DS;
|
|
2259
2250
|
|
|
2260
2251
|
_classCallCheck(this, SelectedSet);
|
|
2261
2252
|
|
|
2262
2253
|
_this = _super.call(this);
|
|
2263
2254
|
|
|
2264
|
-
_defineProperty(_assertThisInitialized(_this), "_className", void 0);
|
|
2265
|
-
|
|
2266
2255
|
_defineProperty(_assertThisInitialized(_this), "clear", function () {
|
|
2267
2256
|
return _this.forEach(function (el) {
|
|
2268
2257
|
return _this["delete"](el);
|
|
@@ -2282,7 +2271,6 @@ var SelectedSet = /*#__PURE__*/function (_Set) {
|
|
|
2282
2271
|
});
|
|
2283
2272
|
|
|
2284
2273
|
_this.DS = DS;
|
|
2285
|
-
_this._className = className;
|
|
2286
2274
|
return _this;
|
|
2287
2275
|
}
|
|
2288
2276
|
/** @param {DSElement} element */
|
|
@@ -2300,7 +2288,7 @@ var SelectedSet = /*#__PURE__*/function (_Set) {
|
|
|
2300
2288
|
|
|
2301
2289
|
_get(_getPrototypeOf(SelectedSet.prototype), "add", this).call(this, element);
|
|
2302
2290
|
|
|
2303
|
-
element.classList.add(this.
|
|
2291
|
+
element.classList.add(this.DS.stores.SettingsStore.s.selectedClass);
|
|
2304
2292
|
element.style.zIndex = "".concat((parseInt(element.style.zIndex) || 0) + 1);
|
|
2305
2293
|
this.DS.publish('Selected:added', publishData);
|
|
2306
2294
|
return this;
|
|
@@ -2319,7 +2307,7 @@ var SelectedSet = /*#__PURE__*/function (_Set) {
|
|
|
2319
2307
|
|
|
2320
2308
|
var deleted = _get(_getPrototypeOf(SelectedSet.prototype), "delete", this).call(this, element);
|
|
2321
2309
|
|
|
2322
|
-
element.classList.remove(this.
|
|
2310
|
+
element.classList.remove(this.DS.stores.SettingsStore.s.selectedClass);
|
|
2323
2311
|
element.style.zIndex = "".concat((parseInt(element.style.zIndex) || 0) - 1);
|
|
2324
2312
|
this.DS.publish('Selected:removed', publishData);
|
|
2325
2313
|
return deleted;
|
|
@@ -2356,36 +2344,20 @@ var Selection = /*#__PURE__*/function () {
|
|
|
2356
2344
|
* @private
|
|
2357
2345
|
* */
|
|
2358
2346
|
|
|
2359
|
-
/**
|
|
2360
|
-
* @type {string}
|
|
2361
|
-
* @private
|
|
2362
|
-
* */
|
|
2363
|
-
|
|
2364
|
-
/**
|
|
2365
|
-
* @type {boolean}
|
|
2366
|
-
* @private
|
|
2367
|
-
* */
|
|
2368
|
-
|
|
2369
2347
|
/**
|
|
2370
2348
|
* @constructor Selection
|
|
2371
|
-
* @param {{ DS:DragSelect
|
|
2349
|
+
* @param {{ DS:DragSelect }} p
|
|
2372
2350
|
* @ignore
|
|
2373
2351
|
*/
|
|
2374
2352
|
function Selection(_ref) {
|
|
2375
2353
|
var _this = this;
|
|
2376
2354
|
|
|
2377
|
-
var DS = _ref.DS
|
|
2378
|
-
hoverClassName = _ref.hoverClassName,
|
|
2379
|
-
multiSelectToggling = _ref.multiSelectToggling;
|
|
2355
|
+
var DS = _ref.DS;
|
|
2380
2356
|
|
|
2381
2357
|
_classCallCheck(this, Selection);
|
|
2382
2358
|
|
|
2383
2359
|
_defineProperty(this, "_prevSelectedSet", void 0);
|
|
2384
2360
|
|
|
2385
|
-
_defineProperty(this, "_hoverClassName", void 0);
|
|
2386
|
-
|
|
2387
|
-
_defineProperty(this, "_multiSelectToggling", void 0);
|
|
2388
|
-
|
|
2389
2361
|
_defineProperty(this, "start", function (_ref2) {
|
|
2390
2362
|
var event = _ref2.event,
|
|
2391
2363
|
isDragging = _ref2.isDragging;
|
|
@@ -2421,7 +2393,7 @@ var Selection = /*#__PURE__*/function () {
|
|
|
2421
2393
|
if (isCollision(elPosCombo[i][1], Selector.rect)) select.push(elPosCombo[i][0]);else unselect.push(elPosCombo[i][0]);
|
|
2422
2394
|
}
|
|
2423
2395
|
|
|
2424
|
-
var multiSelectionToggle = _this.DS.stores.KeyStore.isMultiSelectKeyPressed(event) && _this.
|
|
2396
|
+
var multiSelectionToggle = _this.DS.stores.KeyStore.isMultiSelectKeyPressed(event) && _this.DS.stores.SettingsStore.s.multiSelectToggling;
|
|
2425
2397
|
|
|
2426
2398
|
if (_this.DS["continue"]) return;
|
|
2427
2399
|
select.forEach(function (element) {
|
|
@@ -2430,7 +2402,7 @@ var Selection = /*#__PURE__*/function () {
|
|
|
2430
2402
|
force: force,
|
|
2431
2403
|
multiSelectionToggle: multiSelectionToggle,
|
|
2432
2404
|
SelectedSet: _this.DS.SelectedSet,
|
|
2433
|
-
hoverClassName: _this.
|
|
2405
|
+
hoverClassName: _this.DS.stores.SettingsStore.s.hoverClass
|
|
2434
2406
|
});
|
|
2435
2407
|
});
|
|
2436
2408
|
unselect.forEach(function (element) {
|
|
@@ -2438,14 +2410,12 @@ var Selection = /*#__PURE__*/function () {
|
|
|
2438
2410
|
element: element,
|
|
2439
2411
|
force: force,
|
|
2440
2412
|
SelectedSet: _this.DS.SelectedSet,
|
|
2441
|
-
hoverClassName: _this.
|
|
2413
|
+
hoverClassName: _this.DS.stores.SettingsStore.s.hoverClass,
|
|
2442
2414
|
PrevSelectedSet: _this._prevSelectedSet
|
|
2443
2415
|
});
|
|
2444
2416
|
});
|
|
2445
2417
|
});
|
|
2446
2418
|
|
|
2447
|
-
this._hoverClassName = hoverClassName;
|
|
2448
|
-
this._multiSelectToggling = multiSelectToggling;
|
|
2449
2419
|
this.DS = DS;
|
|
2450
2420
|
this.DS.subscribe('Interaction:start', this.start);
|
|
2451
2421
|
this.DS.subscribe('Interaction:update', this.update);
|
|
@@ -2480,25 +2450,29 @@ var Selector = /*#__PURE__*/function () {
|
|
|
2480
2450
|
|
|
2481
2451
|
/**
|
|
2482
2452
|
* @constructor Selector
|
|
2483
|
-
* @param {
|
|
2484
|
-
* @param {DragSelect} p.DS
|
|
2485
|
-
* @param {HTMLElement} p.selector
|
|
2486
|
-
* @param {string} p.selectorClass
|
|
2487
|
-
* @param {boolean} p.customStyles
|
|
2453
|
+
* @param {{ DS:DragSelect }} p
|
|
2488
2454
|
* @ignore
|
|
2489
2455
|
*/
|
|
2490
2456
|
function Selector(_ref) {
|
|
2491
2457
|
var _this = this;
|
|
2492
2458
|
|
|
2493
|
-
var DS = _ref.DS
|
|
2494
|
-
selector = _ref.selector,
|
|
2495
|
-
selectorClass = _ref.selectorClass,
|
|
2496
|
-
customStyles = _ref.customStyles;
|
|
2459
|
+
var DS = _ref.DS;
|
|
2497
2460
|
|
|
2498
2461
|
_classCallCheck(this, Selector);
|
|
2499
2462
|
|
|
2500
2463
|
_defineProperty(this, "_rect", void 0);
|
|
2501
2464
|
|
|
2465
|
+
_defineProperty(this, "attachSelector", function () {
|
|
2466
|
+
var _this$DS$SelectorArea, _this$DS$SelectorArea2;
|
|
2467
|
+
|
|
2468
|
+
if (_this.HTMLNode && (_this$DS$SelectorArea = _this.DS.SelectorArea) !== null && _this$DS$SelectorArea !== void 0 && _this$DS$SelectorArea.HTMLNode) _this.DS.SelectorArea.HTMLNode.removeChild(_this.HTMLNode);
|
|
2469
|
+
_this.HTMLNode = _this.DS.stores.SettingsStore.s.selector || createSelectorElement(_this.DS.stores.SettingsStore.s.customStyles);
|
|
2470
|
+
|
|
2471
|
+
_this.HTMLNode.classList.add(_this.DS.stores.SettingsStore.s.selectorClass);
|
|
2472
|
+
|
|
2473
|
+
if (_this.HTMLNode && (_this$DS$SelectorArea2 = _this.DS.SelectorArea) !== null && _this$DS$SelectorArea2 !== void 0 && _this$DS$SelectorArea2.HTMLNode) _this.DS.SelectorArea.HTMLNode.appendChild(_this.HTMLNode);
|
|
2474
|
+
});
|
|
2475
|
+
|
|
2502
2476
|
_defineProperty(this, "start", function (_ref2) {
|
|
2503
2477
|
var isDragging = _ref2.isDragging;
|
|
2504
2478
|
if (isDragging) return;
|
|
@@ -2530,9 +2504,18 @@ var Selector = /*#__PURE__*/function () {
|
|
|
2530
2504
|
_this._rect = null;
|
|
2531
2505
|
});
|
|
2532
2506
|
|
|
2533
|
-
this.DS = DS;
|
|
2534
|
-
|
|
2535
|
-
this.
|
|
2507
|
+
this.DS = DS; // @ts-ignore: @todo: update to typescript
|
|
2508
|
+
|
|
2509
|
+
this.DS.subscribe('Settings:updated:selectorClass', function (_ref4) {
|
|
2510
|
+
var settings = _ref4.settings;
|
|
2511
|
+
|
|
2512
|
+
_this.HTMLNode.classList.remove(settings['selectorClass:pre']);
|
|
2513
|
+
|
|
2514
|
+
_this.HTMLNode.classList.add(settings['selectorClass']);
|
|
2515
|
+
}); // @ts-ignore: @todo: update to typescript
|
|
2516
|
+
|
|
2517
|
+
this.DS.subscribe('Settings:updated:selector', this.attachSelector);
|
|
2518
|
+
this.attachSelector();
|
|
2536
2519
|
this.DS.subscribe('Interaction:start', this.start);
|
|
2537
2520
|
this.DS.subscribe('Interaction:update', this.update);
|
|
2538
2521
|
this.DS.subscribe('Interaction:end', this.stop);
|
|
@@ -2550,11 +2533,6 @@ var Selector = /*#__PURE__*/function () {
|
|
|
2550
2533
|
}();
|
|
2551
2534
|
|
|
2552
2535
|
var SelectorArea = /*#__PURE__*/function () {
|
|
2553
|
-
/**
|
|
2554
|
-
* @type {number}
|
|
2555
|
-
* @private
|
|
2556
|
-
* */
|
|
2557
|
-
|
|
2558
2536
|
/**
|
|
2559
2537
|
* @type {*}
|
|
2560
2538
|
* @private
|
|
@@ -2570,37 +2548,25 @@ var SelectorArea = /*#__PURE__*/function () {
|
|
|
2570
2548
|
* @private
|
|
2571
2549
|
*/
|
|
2572
2550
|
|
|
2573
|
-
/**
|
|
2574
|
-
* @type {Vect2}
|
|
2575
|
-
* @private
|
|
2576
|
-
*/
|
|
2577
|
-
|
|
2578
2551
|
/**
|
|
2579
2552
|
* @class SelectorArea
|
|
2580
2553
|
* @constructor SelectorArea
|
|
2581
|
-
* @param {{ DS:DragSelect
|
|
2554
|
+
* @param {{ DS:DragSelect }} obj
|
|
2582
2555
|
* @ignore
|
|
2583
2556
|
*/
|
|
2584
2557
|
function SelectorArea(_ref) {
|
|
2585
2558
|
var _this = this;
|
|
2586
2559
|
|
|
2587
|
-
var DS = _ref.DS
|
|
2588
|
-
selectorAreaClass = _ref.selectorAreaClass,
|
|
2589
|
-
autoScrollSpeed = _ref.autoScrollSpeed,
|
|
2590
|
-
overflowTolerance = _ref.overflowTolerance;
|
|
2560
|
+
var DS = _ref.DS;
|
|
2591
2561
|
|
|
2592
2562
|
_classCallCheck(this, SelectorArea);
|
|
2593
2563
|
|
|
2594
|
-
_defineProperty(this, "_autoScrollSpeed", void 0);
|
|
2595
|
-
|
|
2596
2564
|
_defineProperty(this, "_scrollInterval", void 0);
|
|
2597
2565
|
|
|
2598
2566
|
_defineProperty(this, "_rect", void 0);
|
|
2599
2567
|
|
|
2600
2568
|
_defineProperty(this, "currentEdges", []);
|
|
2601
2569
|
|
|
2602
|
-
_defineProperty(this, "_overflowTolerance", void 0);
|
|
2603
|
-
|
|
2604
2570
|
_defineProperty(this, "start", function () {
|
|
2605
2571
|
return _this.applyElements('append');
|
|
2606
2572
|
});
|
|
@@ -2651,9 +2617,9 @@ var SelectorArea = /*#__PURE__*/function () {
|
|
|
2651
2617
|
_this.currentEdges = getOverflowEdges({
|
|
2652
2618
|
elementRect: vect2rect(PointerStore.currentVal),
|
|
2653
2619
|
containerRect: _this.rect,
|
|
2654
|
-
tolerance: _this.
|
|
2620
|
+
tolerance: _this.DS.stores.SettingsStore.s.overflowTolerance
|
|
2655
2621
|
});
|
|
2656
|
-
if (_this.currentEdges.length) Area.scroll(_this.currentEdges, _this.
|
|
2622
|
+
if (_this.currentEdges.length) Area.scroll(_this.currentEdges, _this.DS.stores.SettingsStore.s.autoScrollSpeed);
|
|
2657
2623
|
});
|
|
2658
2624
|
|
|
2659
2625
|
_defineProperty(this, "stopAutoScroll", function () {
|
|
@@ -2666,10 +2632,18 @@ var SelectorArea = /*#__PURE__*/function () {
|
|
|
2666
2632
|
return isCollision(_this.rect, elementRect || element.getBoundingClientRect());
|
|
2667
2633
|
});
|
|
2668
2634
|
|
|
2669
|
-
this._autoScrollSpeed = autoScrollSpeed;
|
|
2670
|
-
this._overflowTolerance = overflowTolerance;
|
|
2671
2635
|
this.DS = DS;
|
|
2672
|
-
this.HTMLNode = createSelectorAreaElement(
|
|
2636
|
+
this.HTMLNode = createSelectorAreaElement(); // @ts-ignore: @todo: update to typescript
|
|
2637
|
+
|
|
2638
|
+
this.DS.subscribe('Settings:updated:selectorAreaClass', function (_ref2) {
|
|
2639
|
+
var settings = _ref2.settings;
|
|
2640
|
+
|
|
2641
|
+
_this.HTMLNode.classList.remove(settings['selectorAreaClass:pre']);
|
|
2642
|
+
|
|
2643
|
+
_this.HTMLNode.classList.add(settings['selectorAreaClass']);
|
|
2644
|
+
});
|
|
2645
|
+
this.HTMLNode.classList.add(this.DS.stores.SettingsStore.s.selectorAreaClass);
|
|
2646
|
+
this.DS.subscribe('Area:modified', this.updatePos);
|
|
2673
2647
|
this.DS.subscribe('Area:modified', this.updatePos);
|
|
2674
2648
|
this.DS.subscribe('Interaction:init', this.start);
|
|
2675
2649
|
this.DS.subscribe('Interaction:start', this.startAutoScroll);
|
|
@@ -2710,16 +2684,6 @@ var SelectorArea = /*#__PURE__*/function () {
|
|
|
2710
2684
|
}();
|
|
2711
2685
|
|
|
2712
2686
|
var KeyStore = /*#__PURE__*/function () {
|
|
2713
|
-
/**
|
|
2714
|
-
* @type {boolean}
|
|
2715
|
-
* @private
|
|
2716
|
-
* */
|
|
2717
|
-
|
|
2718
|
-
/**
|
|
2719
|
-
* @type {DSMultiSelectKeys}
|
|
2720
|
-
* @private
|
|
2721
|
-
* */
|
|
2722
|
-
|
|
2723
2687
|
/**
|
|
2724
2688
|
* @type {Set<string>}
|
|
2725
2689
|
* @private
|
|
@@ -2733,22 +2697,16 @@ var KeyStore = /*#__PURE__*/function () {
|
|
|
2733
2697
|
/**
|
|
2734
2698
|
* @class KeyStore
|
|
2735
2699
|
* @constructor KeyStore
|
|
2736
|
-
* @param {{DS:DragSelect
|
|
2700
|
+
* @param {{DS:DragSelect}} p
|
|
2737
2701
|
* @ignore
|
|
2738
2702
|
*/
|
|
2739
2703
|
function KeyStore(_ref) {
|
|
2740
2704
|
var _this = this;
|
|
2741
2705
|
|
|
2742
|
-
var DS = _ref.DS
|
|
2743
|
-
multiSelectKeys = _ref.multiSelectKeys,
|
|
2744
|
-
multiSelectMode = _ref.multiSelectMode;
|
|
2706
|
+
var DS = _ref.DS;
|
|
2745
2707
|
|
|
2746
2708
|
_classCallCheck(this, KeyStore);
|
|
2747
2709
|
|
|
2748
|
-
_defineProperty(this, "_multiSelectMode", void 0);
|
|
2749
|
-
|
|
2750
|
-
_defineProperty(this, "_multiSelectKeys", void 0);
|
|
2751
|
-
|
|
2752
2710
|
_defineProperty(this, "_currentValues", new Set());
|
|
2753
2711
|
|
|
2754
2712
|
_defineProperty(this, "_keyMapping", {
|
|
@@ -2808,25 +2766,6 @@ var KeyStore = /*#__PURE__*/function () {
|
|
|
2808
2766
|
});
|
|
2809
2767
|
|
|
2810
2768
|
this.DS = DS;
|
|
2811
|
-
this._multiSelectMode = multiSelectMode; // @TODO: remove after deprecation
|
|
2812
|
-
|
|
2813
|
-
this._multiSelectKeys = multiSelectKeys.map(function (key) {
|
|
2814
|
-
var deprecatedKeys = {
|
|
2815
|
-
ctrlKey: 'Control',
|
|
2816
|
-
shiftKey: 'Shift',
|
|
2817
|
-
metaKey: 'Meta'
|
|
2818
|
-
};
|
|
2819
|
-
/** @type {string} */
|
|
2820
|
-
|
|
2821
|
-
var newName = deprecatedKeys[key];
|
|
2822
|
-
|
|
2823
|
-
if (newName) {
|
|
2824
|
-
console.warn("[DragSelect] ".concat(key, " is deprecated. Use \"").concat(newName, "\" instead. Act Now!. See docs for more info"));
|
|
2825
|
-
return newName.toLowerCase();
|
|
2826
|
-
}
|
|
2827
|
-
|
|
2828
|
-
return key.toLowerCase();
|
|
2829
|
-
});
|
|
2830
2769
|
this.DS.subscribe('Interaction:init', this.init);
|
|
2831
2770
|
}
|
|
2832
2771
|
|
|
@@ -2837,11 +2776,14 @@ var KeyStore = /*#__PURE__*/function () {
|
|
|
2837
2776
|
value: function isMultiSelectKeyPressed(event) {
|
|
2838
2777
|
var _this2 = this;
|
|
2839
2778
|
|
|
2840
|
-
if (this.
|
|
2779
|
+
if (this.DS.stores.SettingsStore.s.multiSelectMode) return true;
|
|
2780
|
+
var multiSelectKeys = this.DS.stores.SettingsStore.s.multiSelectKeys.map(function (key) {
|
|
2781
|
+
return key.toLocaleLowerCase();
|
|
2782
|
+
});
|
|
2841
2783
|
if (this.currentValues.some(function (key) {
|
|
2842
|
-
return
|
|
2784
|
+
return multiSelectKeys.includes(key.toLocaleLowerCase());
|
|
2843
2785
|
})) return true;
|
|
2844
|
-
if (event &&
|
|
2786
|
+
if (event && multiSelectKeys.some(function (key) {
|
|
2845
2787
|
return event[_this2._keyMapping[key]];
|
|
2846
2788
|
})) return true;
|
|
2847
2789
|
return false;
|
|
@@ -3105,10 +3047,6 @@ var ScrollStore = /*#__PURE__*/function () {
|
|
|
3105
3047
|
* @type {Vect2}
|
|
3106
3048
|
* @private */
|
|
3107
3049
|
|
|
3108
|
-
/**
|
|
3109
|
-
* @type {DSArea}
|
|
3110
|
-
* @private */
|
|
3111
|
-
|
|
3112
3050
|
/**
|
|
3113
3051
|
* @type {boolean}
|
|
3114
3052
|
* @private */
|
|
@@ -3116,15 +3054,13 @@ var ScrollStore = /*#__PURE__*/function () {
|
|
|
3116
3054
|
/**
|
|
3117
3055
|
* @class ScrollStore
|
|
3118
3056
|
* @constructor ScrollStore
|
|
3119
|
-
* @param {{ DS:DragSelect
|
|
3057
|
+
* @param {{ DS:DragSelect }} p
|
|
3120
3058
|
* @ignore
|
|
3121
3059
|
*/
|
|
3122
3060
|
function ScrollStore(_ref) {
|
|
3123
3061
|
var _this = this;
|
|
3124
3062
|
|
|
3125
|
-
var DS = _ref.DS
|
|
3126
|
-
areaElement = _ref.areaElement,
|
|
3127
|
-
zoom = _ref.zoom;
|
|
3063
|
+
var DS = _ref.DS;
|
|
3128
3064
|
|
|
3129
3065
|
_classCallCheck(this, ScrollStore);
|
|
3130
3066
|
|
|
@@ -3132,26 +3068,24 @@ var ScrollStore = /*#__PURE__*/function () {
|
|
|
3132
3068
|
|
|
3133
3069
|
_defineProperty(this, "_currentVal", void 0);
|
|
3134
3070
|
|
|
3135
|
-
_defineProperty(this, "_areaElement", void 0);
|
|
3136
|
-
|
|
3137
3071
|
_defineProperty(this, "_canScroll", void 0);
|
|
3138
3072
|
|
|
3139
3073
|
_defineProperty(this, "init", function () {
|
|
3140
|
-
return _this.
|
|
3074
|
+
return _this.DS.stores.SettingsStore.s.area.addEventListener('scroll', _this.update);
|
|
3141
3075
|
});
|
|
3142
3076
|
|
|
3143
3077
|
_defineProperty(this, "start", function () {
|
|
3144
|
-
_this._currentVal = _this._initialVal = getCurrentScroll(_this.
|
|
3078
|
+
_this._currentVal = _this._initialVal = getCurrentScroll(_this.DS.stores.SettingsStore.s.area);
|
|
3145
3079
|
|
|
3146
|
-
_this.
|
|
3080
|
+
_this.DS.stores.SettingsStore.s.area.addEventListener('scroll', _this.update);
|
|
3147
3081
|
});
|
|
3148
3082
|
|
|
3149
3083
|
_defineProperty(this, "update", function () {
|
|
3150
|
-
return _this._currentVal = getCurrentScroll(_this.
|
|
3084
|
+
return _this._currentVal = getCurrentScroll(_this.DS.stores.SettingsStore.s.area);
|
|
3151
3085
|
});
|
|
3152
3086
|
|
|
3153
3087
|
_defineProperty(this, "stop", function () {
|
|
3154
|
-
_this.
|
|
3088
|
+
_this.DS.stores.SettingsStore.s.area.removeEventListener('scroll', _this.update);
|
|
3155
3089
|
|
|
3156
3090
|
_this._initialVal = {
|
|
3157
3091
|
x: 0,
|
|
@@ -3166,9 +3100,7 @@ var ScrollStore = /*#__PURE__*/function () {
|
|
|
3166
3100
|
_this.start();
|
|
3167
3101
|
});
|
|
3168
3102
|
|
|
3169
|
-
this._areaElement = areaElement;
|
|
3170
3103
|
this.DS = DS;
|
|
3171
|
-
this.zoom = zoom;
|
|
3172
3104
|
this.DS.subscribe('Interaction:init', this.init);
|
|
3173
3105
|
this.DS.subscribe('Interaction:start', function () {
|
|
3174
3106
|
return _this.start();
|
|
@@ -3182,14 +3114,14 @@ var ScrollStore = /*#__PURE__*/function () {
|
|
|
3182
3114
|
key: "canScroll",
|
|
3183
3115
|
get: function get() {
|
|
3184
3116
|
if (typeof this._canScroll === 'boolean') return this._canScroll;
|
|
3185
|
-
return this._canScroll = canScroll(this.
|
|
3117
|
+
return this._canScroll = canScroll(this.DS.stores.SettingsStore.s.area);
|
|
3186
3118
|
}
|
|
3187
3119
|
}, {
|
|
3188
3120
|
key: "scrollAmount",
|
|
3189
3121
|
get: function get() {
|
|
3190
3122
|
var scrollDiff = calc(this.currentVal, '-', this.initialVal); // if area is zoomed, the scroll values are skewed, we need to fix that manually :(
|
|
3191
3123
|
|
|
3192
|
-
var zoom = num2vect(this.zoom);
|
|
3124
|
+
var zoom = num2vect(this.DS.stores.SettingsStore.s.zoom);
|
|
3193
3125
|
var zoomScroll = calc(calc(scrollDiff, '*', zoom), '-', scrollDiff);
|
|
3194
3126
|
return {
|
|
3195
3127
|
x: scrollDiff.x + zoomScroll.x,
|
|
@@ -3208,7 +3140,7 @@ var ScrollStore = /*#__PURE__*/function () {
|
|
|
3208
3140
|
}, {
|
|
3209
3141
|
key: "currentVal",
|
|
3210
3142
|
get: function get() {
|
|
3211
|
-
if (!this._currentVal) this._currentVal = getCurrentScroll(this.
|
|
3143
|
+
if (!this._currentVal) this._currentVal = getCurrentScroll(this.DS.stores.SettingsStore.s.area);
|
|
3212
3144
|
return this._currentVal;
|
|
3213
3145
|
}
|
|
3214
3146
|
}]);
|
|
@@ -3216,6 +3148,102 @@ var ScrollStore = /*#__PURE__*/function () {
|
|
|
3216
3148
|
return ScrollStore;
|
|
3217
3149
|
}();
|
|
3218
3150
|
|
|
3151
|
+
var SettingsStore =
|
|
3152
|
+
/**
|
|
3153
|
+
* @type {Settings}
|
|
3154
|
+
* @private
|
|
3155
|
+
* */
|
|
3156
|
+
|
|
3157
|
+
/**
|
|
3158
|
+
* Holds the settings and their previous value `:pre`
|
|
3159
|
+
* @example {
|
|
3160
|
+
* autoScrollSpeed: 3,
|
|
3161
|
+
* 'autoScrollSpeed:pre': 5
|
|
3162
|
+
* }
|
|
3163
|
+
* @type {Settings}
|
|
3164
|
+
* */
|
|
3165
|
+
|
|
3166
|
+
/**
|
|
3167
|
+
* @class ScrollStore
|
|
3168
|
+
* @constructor ScrollStore
|
|
3169
|
+
* @param {{ DS:DragSelect, settings:Settings }} p
|
|
3170
|
+
* @ignore
|
|
3171
|
+
*/
|
|
3172
|
+
function SettingsStore(_ref) {
|
|
3173
|
+
var _this = this;
|
|
3174
|
+
|
|
3175
|
+
var DS = _ref.DS,
|
|
3176
|
+
_settings2 = _ref.settings;
|
|
3177
|
+
|
|
3178
|
+
_classCallCheck(this, SettingsStore);
|
|
3179
|
+
|
|
3180
|
+
_defineProperty(this, "_settings", {});
|
|
3181
|
+
|
|
3182
|
+
_defineProperty(this, "s", {});
|
|
3183
|
+
|
|
3184
|
+
_defineProperty(this, "update", function (_ref2) {
|
|
3185
|
+
var settings = _ref2.settings,
|
|
3186
|
+
init = _ref2.init;
|
|
3187
|
+
return _this.DS.publish('Settings:updated:pre', _objectSpread2({
|
|
3188
|
+
settings: settings
|
|
3189
|
+
}, init ? {
|
|
3190
|
+
init: init
|
|
3191
|
+
} : {}));
|
|
3192
|
+
});
|
|
3193
|
+
|
|
3194
|
+
_defineProperty(this, "_update", function (_ref3) {
|
|
3195
|
+
var settings = _ref3.settings,
|
|
3196
|
+
init = _ref3.init;
|
|
3197
|
+
|
|
3198
|
+
var _settings = hydrateSettings(settings, init);
|
|
3199
|
+
|
|
3200
|
+
var _loop = function _loop() {
|
|
3201
|
+
var _settings4;
|
|
3202
|
+
|
|
3203
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
3204
|
+
key = _Object$entries$_i[0],
|
|
3205
|
+
value = _Object$entries$_i[1];
|
|
3206
|
+
|
|
3207
|
+
if (!(key in _this._settings)) {
|
|
3208
|
+
Object.defineProperty(_this.s, key, {
|
|
3209
|
+
get: function get() {
|
|
3210
|
+
return _this._settings[key];
|
|
3211
|
+
},
|
|
3212
|
+
set: function set(newValue) {
|
|
3213
|
+
return _this.update({
|
|
3214
|
+
settings: _defineProperty({}, key, newValue)
|
|
3215
|
+
});
|
|
3216
|
+
}
|
|
3217
|
+
});
|
|
3218
|
+
}
|
|
3219
|
+
|
|
3220
|
+
_this._settings["".concat(key, ":pre")] = _this._settings[key];
|
|
3221
|
+
_this._settings[key] = value;
|
|
3222
|
+
var update = {
|
|
3223
|
+
settings: (_settings4 = {}, _defineProperty(_settings4, key, _this._settings[key]), _defineProperty(_settings4, "".concat(key, ":pre"), _this._settings["".concat(key, ":pre")]), _settings4)
|
|
3224
|
+
};
|
|
3225
|
+
|
|
3226
|
+
_this.DS.publish('Settings:updated', update); // @ts-ignore: @todo: update to typescript
|
|
3227
|
+
|
|
3228
|
+
|
|
3229
|
+
_this.DS.publish("Settings:updated:".concat(key), update);
|
|
3230
|
+
};
|
|
3231
|
+
|
|
3232
|
+
for (var _i = 0, _Object$entries = Object.entries(_settings); _i < _Object$entries.length; _i++) {
|
|
3233
|
+
_loop();
|
|
3234
|
+
}
|
|
3235
|
+
});
|
|
3236
|
+
|
|
3237
|
+
this.DS = DS;
|
|
3238
|
+
this.DS.subscribe('Settings:updated:pre', this._update);
|
|
3239
|
+
this.update({
|
|
3240
|
+
settings: _settings2,
|
|
3241
|
+
init: true
|
|
3242
|
+
});
|
|
3243
|
+
}
|
|
3244
|
+
/** @param {{settings: Settings, init?: boolean}} props */
|
|
3245
|
+
;
|
|
3246
|
+
|
|
3219
3247
|
//////////////////////////////////////////////////////////////////////////////////////
|
|
3220
3248
|
|
|
3221
3249
|
var DragSelect = /*#__PURE__*/function () {
|
|
@@ -3229,60 +3257,9 @@ var DragSelect = /*#__PURE__*/function () {
|
|
|
3229
3257
|
* @constructor DragSelect
|
|
3230
3258
|
* @param {Settings} settings
|
|
3231
3259
|
*/
|
|
3232
|
-
function DragSelect(
|
|
3260
|
+
function DragSelect(_settings) {
|
|
3233
3261
|
var _this = this;
|
|
3234
3262
|
|
|
3235
|
-
var _ref$area = _ref.area,
|
|
3236
|
-
area = _ref$area === void 0 ? document : _ref$area,
|
|
3237
|
-
_ref$selectables = _ref.selectables,
|
|
3238
|
-
selectables = _ref$selectables === void 0 ? [] : _ref$selectables,
|
|
3239
|
-
_ref$autoScrollSpeed = _ref.autoScrollSpeed,
|
|
3240
|
-
autoScrollSpeed = _ref$autoScrollSpeed === void 0 ? 5 : _ref$autoScrollSpeed,
|
|
3241
|
-
_ref$overflowToleranc = _ref.overflowTolerance,
|
|
3242
|
-
overflowTolerance = _ref$overflowToleranc === void 0 ? {
|
|
3243
|
-
x: 25,
|
|
3244
|
-
y: 25
|
|
3245
|
-
} : _ref$overflowToleranc,
|
|
3246
|
-
_ref$zoom = _ref.zoom,
|
|
3247
|
-
zoom = _ref$zoom === void 0 ? 1 : _ref$zoom,
|
|
3248
|
-
_ref$customStyles = _ref.customStyles,
|
|
3249
|
-
customStyles = _ref$customStyles === void 0 ? false : _ref$customStyles,
|
|
3250
|
-
_ref$multiSelectMode = _ref.multiSelectMode,
|
|
3251
|
-
multiSelectMode = _ref$multiSelectMode === void 0 ? false : _ref$multiSelectMode,
|
|
3252
|
-
_ref$multiSelectToggl = _ref.multiSelectToggling,
|
|
3253
|
-
multiSelectToggling = _ref$multiSelectToggl === void 0 ? true : _ref$multiSelectToggl,
|
|
3254
|
-
_ref$multiSelectKeys = _ref.multiSelectKeys,
|
|
3255
|
-
multiSelectKeys = _ref$multiSelectKeys === void 0 ? ['Control', 'Shift', 'Meta'] : _ref$multiSelectKeys,
|
|
3256
|
-
_ref$selector = _ref.selector,
|
|
3257
|
-
selector = _ref$selector === void 0 ? undefined : _ref$selector,
|
|
3258
|
-
_ref$draggability = _ref.draggability,
|
|
3259
|
-
draggability = _ref$draggability === void 0 ? true : _ref$draggability,
|
|
3260
|
-
_ref$immediateDrag = _ref.immediateDrag,
|
|
3261
|
-
immediateDrag = _ref$immediateDrag === void 0 ? true : _ref$immediateDrag,
|
|
3262
|
-
_ref$keyboardDrag = _ref.keyboardDrag,
|
|
3263
|
-
keyboardDrag = _ref$keyboardDrag === void 0 ? true : _ref$keyboardDrag,
|
|
3264
|
-
dragKeys = _ref.dragKeys,
|
|
3265
|
-
_ref$keyboardDragSpee = _ref.keyboardDragSpeed,
|
|
3266
|
-
keyboardDragSpeed = _ref$keyboardDragSpee === void 0 ? 10 : _ref$keyboardDragSpee,
|
|
3267
|
-
_ref$useTransform = _ref.useTransform,
|
|
3268
|
-
useTransform = _ref$useTransform === void 0 ? true : _ref$useTransform,
|
|
3269
|
-
_ref$hoverClass = _ref.hoverClass,
|
|
3270
|
-
hoverClass = _ref$hoverClass === void 0 ? 'ds-hover' : _ref$hoverClass,
|
|
3271
|
-
_ref$selectableClass = _ref.selectableClass,
|
|
3272
|
-
selectableClass = _ref$selectableClass === void 0 ? 'ds-selectable' : _ref$selectableClass,
|
|
3273
|
-
_ref$selectedClass = _ref.selectedClass,
|
|
3274
|
-
selectedClass = _ref$selectedClass === void 0 ? 'ds-selected' : _ref$selectedClass,
|
|
3275
|
-
_ref$selectorClass = _ref.selectorClass,
|
|
3276
|
-
selectorClass = _ref$selectorClass === void 0 ? 'ds-selector' : _ref$selectorClass,
|
|
3277
|
-
_ref$selectorAreaClas = _ref.selectorAreaClass,
|
|
3278
|
-
selectorAreaClass = _ref$selectorAreaClas === void 0 ? 'ds-selector-area' : _ref$selectorAreaClas,
|
|
3279
|
-
callback = _ref.callback,
|
|
3280
|
-
onDragMove = _ref.onDragMove,
|
|
3281
|
-
onDragStartBegin = _ref.onDragStartBegin,
|
|
3282
|
-
onDragStart = _ref.onDragStart,
|
|
3283
|
-
onElementSelect = _ref.onElementSelect,
|
|
3284
|
-
onElementUnselect = _ref.onElementUnselect;
|
|
3285
|
-
|
|
3286
3263
|
_classCallCheck(this, DragSelect);
|
|
3287
3264
|
|
|
3288
3265
|
_defineProperty(this, "continue", false);
|
|
@@ -3337,90 +3314,57 @@ var DragSelect = /*#__PURE__*/function () {
|
|
|
3337
3314
|
return _this.Interaction.isDragging;
|
|
3338
3315
|
});
|
|
3339
3316
|
|
|
3317
|
+
_defineProperty(this, "setSettings", function (settings) {
|
|
3318
|
+
return _this.stores.SettingsStore.update({
|
|
3319
|
+
settings: settings
|
|
3320
|
+
});
|
|
3321
|
+
});
|
|
3322
|
+
|
|
3340
3323
|
this.PubSub = new PubSub({
|
|
3341
3324
|
DS: this
|
|
3342
3325
|
});
|
|
3343
3326
|
this.subscribe = this.PubSub.subscribe;
|
|
3344
3327
|
this.unsubscribe = this.PubSub.unsubscribe;
|
|
3345
3328
|
this.publish = this.PubSub.publish;
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
this.stores = {
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
areaElement: area,
|
|
3363
|
-
zoom: zoom
|
|
3364
|
-
}),
|
|
3365
|
-
KeyStore: new KeyStore({
|
|
3366
|
-
DS: this,
|
|
3367
|
-
multiSelectKeys: multiSelectKeys,
|
|
3368
|
-
multiSelectMode: multiSelectMode
|
|
3369
|
-
})
|
|
3370
|
-
};
|
|
3329
|
+
this.stores =
|
|
3330
|
+
/** @type {{ SettingsStore:SettingsStore, PointerStore:PointerStore, ScrollStore:ScrollStore, KeyStore:KeyStore }} */
|
|
3331
|
+
{};
|
|
3332
|
+
this.stores.SettingsStore = new SettingsStore({
|
|
3333
|
+
DS: this,
|
|
3334
|
+
settings: _settings
|
|
3335
|
+
});
|
|
3336
|
+
this.stores.PointerStore = new PointerStore({
|
|
3337
|
+
DS: this
|
|
3338
|
+
});
|
|
3339
|
+
this.stores.ScrollStore = new ScrollStore({
|
|
3340
|
+
DS: this
|
|
3341
|
+
});
|
|
3342
|
+
this.stores.KeyStore = new KeyStore({
|
|
3343
|
+
DS: this
|
|
3344
|
+
});
|
|
3371
3345
|
this.Area = new Area({
|
|
3372
|
-
|
|
3373
|
-
PS: this.PubSub,
|
|
3374
|
-
zoom: zoom
|
|
3346
|
+
DS: this
|
|
3375
3347
|
});
|
|
3376
3348
|
this.Selector = new Selector({
|
|
3377
|
-
DS: this
|
|
3378
|
-
selector: selector,
|
|
3379
|
-
selectorClass: selectorClass,
|
|
3380
|
-
customStyles: customStyles
|
|
3349
|
+
DS: this
|
|
3381
3350
|
});
|
|
3382
3351
|
this.SelectorArea = new SelectorArea({
|
|
3383
|
-
DS: this
|
|
3384
|
-
selectorAreaClass: selectorAreaClass,
|
|
3385
|
-
autoScrollSpeed: autoScrollSpeed,
|
|
3386
|
-
overflowTolerance: overflowTolerance
|
|
3352
|
+
DS: this
|
|
3387
3353
|
});
|
|
3388
3354
|
this.SelectableSet = new SelectableSet({
|
|
3389
|
-
|
|
3390
|
-
DS: this,
|
|
3391
|
-
className: selectableClass,
|
|
3392
|
-
hoverClassName: hoverClass,
|
|
3393
|
-
useTransform: useTransform,
|
|
3394
|
-
draggability: draggability
|
|
3355
|
+
DS: this
|
|
3395
3356
|
});
|
|
3396
3357
|
this.SelectedSet = new SelectedSet({
|
|
3397
|
-
DS: this
|
|
3398
|
-
className: selectedClass
|
|
3358
|
+
DS: this
|
|
3399
3359
|
});
|
|
3400
3360
|
this.Selection = new Selection({
|
|
3401
|
-
DS: this
|
|
3402
|
-
hoverClassName: hoverClass,
|
|
3403
|
-
multiSelectToggling: multiSelectToggling
|
|
3361
|
+
DS: this
|
|
3404
3362
|
});
|
|
3405
3363
|
this.Drag = new Drag({
|
|
3406
|
-
DS: this
|
|
3407
|
-
draggability: draggability,
|
|
3408
|
-
useTransform: useTransform,
|
|
3409
|
-
keyboardDrag: keyboardDrag,
|
|
3410
|
-
dragKeys: Object.assign({
|
|
3411
|
-
up: ['ArrowUp'],
|
|
3412
|
-
down: ['ArrowDown'],
|
|
3413
|
-
left: ['ArrowLeft'],
|
|
3414
|
-
right: ['ArrowRight']
|
|
3415
|
-
}, dragKeys),
|
|
3416
|
-
zoom: zoom,
|
|
3417
|
-
keyboardDragSpeed: keyboardDragSpeed
|
|
3364
|
+
DS: this
|
|
3418
3365
|
});
|
|
3419
3366
|
this.Interaction = new Interaction({
|
|
3420
|
-
|
|
3421
|
-
DS: this,
|
|
3422
|
-
draggability: draggability,
|
|
3423
|
-
immediateDrag: immediateDrag
|
|
3367
|
+
DS: this
|
|
3424
3368
|
}); // Subscriber Aliases
|
|
3425
3369
|
|
|
3426
3370
|
subscriberAliases({
|
|
@@ -3433,91 +3377,16 @@ var DragSelect = /*#__PURE__*/function () {
|
|
|
3433
3377
|
return _this["continue"] = false;
|
|
3434
3378
|
});
|
|
3435
3379
|
this.start();
|
|
3436
|
-
} //
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
_createClass(DragSelect, [{
|
|
3440
|
-
key: "_callbacksTemp",
|
|
3441
|
-
value: function _callbacksTemp(_ref2) {
|
|
3442
|
-
var callback = _ref2.callback,
|
|
3443
|
-
onDragMove = _ref2.onDragMove,
|
|
3444
|
-
onDragStart = _ref2.onDragStart,
|
|
3445
|
-
onDragStartBegin = _ref2.onDragStartBegin,
|
|
3446
|
-
onElementSelect = _ref2.onElementSelect,
|
|
3447
|
-
onElementUnselect = _ref2.onElementUnselect;
|
|
3448
|
-
|
|
3449
|
-
var warnMessage = function warnMessage(name, newName) {
|
|
3450
|
-
return console.warn("[DragSelect] ".concat(name, " is deprecated. Use DragSelect.subscribe(\"").concat(newName, "\", (callbackObject) => {}) instead. Act Now! See docs for more info"));
|
|
3451
|
-
};
|
|
3452
|
-
|
|
3453
|
-
if (callback) {
|
|
3454
|
-
warnMessage('callback', 'callback');
|
|
3455
|
-
this.subscribe('callback', function (_ref3) {
|
|
3456
|
-
var items = _ref3.items,
|
|
3457
|
-
item = _ref3.item,
|
|
3458
|
-
event = _ref3.event;
|
|
3459
|
-
return callback(items, event);
|
|
3460
|
-
});
|
|
3461
|
-
}
|
|
3380
|
+
} // Useful methods for the user
|
|
3381
|
+
//////////////////////////////////////////////////////////////////////////////////////
|
|
3462
3382
|
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
item = _ref4.item,
|
|
3468
|
-
event = _ref4.event;
|
|
3469
|
-
return onDragMove(event);
|
|
3470
|
-
});
|
|
3471
|
-
}
|
|
3472
|
-
|
|
3473
|
-
if (onDragStart) {
|
|
3474
|
-
warnMessage('onDragStart', 'dragstart');
|
|
3475
|
-
this.subscribe('dragstart', function (_ref5) {
|
|
3476
|
-
var items = _ref5.items,
|
|
3477
|
-
item = _ref5.item,
|
|
3478
|
-
event = _ref5.event;
|
|
3479
|
-
return onDragStart(event);
|
|
3480
|
-
});
|
|
3481
|
-
}
|
|
3482
|
-
|
|
3483
|
-
if (onDragStartBegin) {
|
|
3484
|
-
warnMessage('onDragStartBegin', 'dragstart');
|
|
3485
|
-
this.subscribe('dragstart', function (_ref6) {
|
|
3486
|
-
var items = _ref6.items,
|
|
3487
|
-
item = _ref6.item,
|
|
3488
|
-
event = _ref6.event;
|
|
3489
|
-
return onDragStartBegin(event);
|
|
3490
|
-
});
|
|
3491
|
-
}
|
|
3492
|
-
|
|
3493
|
-
if (onElementSelect) {
|
|
3494
|
-
warnMessage('onElementSelect', 'elementselect');
|
|
3495
|
-
this.subscribe('elementselect', function (_ref7) {
|
|
3496
|
-
var items = _ref7.items,
|
|
3497
|
-
item = _ref7.item,
|
|
3498
|
-
event = _ref7.event;
|
|
3499
|
-
return onElementSelect(item, event);
|
|
3500
|
-
});
|
|
3501
|
-
}
|
|
3502
|
-
|
|
3503
|
-
if (onElementUnselect) {
|
|
3504
|
-
warnMessage('onElementUnselect', 'elementunselect');
|
|
3505
|
-
this.subscribe('elementunselect', function (_ref8) {
|
|
3506
|
-
var items = _ref8.items,
|
|
3507
|
-
item = _ref8.item,
|
|
3508
|
-
event = _ref8.event;
|
|
3509
|
-
return onElementUnselect(item, event);
|
|
3510
|
-
});
|
|
3511
|
-
}
|
|
3512
|
-
} // Useful methods for the user
|
|
3513
|
-
//////////////////////////////////////////////////////////////////////////////////////
|
|
3383
|
+
/**
|
|
3384
|
+
* Initializes the functionality. Automatically triggered when created.
|
|
3385
|
+
* Also, reset the functionality after a teardown
|
|
3386
|
+
*/
|
|
3514
3387
|
|
|
3515
|
-
/**
|
|
3516
|
-
* Initializes the functionality. Automatically triggered when created.
|
|
3517
|
-
* Also, reset the functionality after a teardown
|
|
3518
|
-
*/
|
|
3519
3388
|
|
|
3520
|
-
|
|
3389
|
+
_createClass(DragSelect, [{
|
|
3521
3390
|
key: "stop",
|
|
3522
3391
|
|
|
3523
3392
|
/**
|
|
@@ -3689,6 +3558,7 @@ var DragSelect = /*#__PURE__*/function () {
|
|
|
3689
3558
|
value: function setSelectables(elements) {
|
|
3690
3559
|
var removeFromSelection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3691
3560
|
var addToSelection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
3561
|
+
console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)');
|
|
3692
3562
|
this.removeSelectables(elements, removeFromSelection);
|
|
3693
3563
|
return this.addSelectables(elements, addToSelection);
|
|
3694
3564
|
}
|
|
@@ -3709,29 +3579,6 @@ var DragSelect = /*#__PURE__*/function () {
|
|
|
3709
3579
|
}
|
|
3710
3580
|
/** The starting/initial position of the cursor/selector @return {Vect2} */
|
|
3711
3581
|
|
|
3712
|
-
}, {
|
|
3713
|
-
key: "getCursorPositionDifference",
|
|
3714
|
-
|
|
3715
|
-
/**
|
|
3716
|
-
* Utility method that returns the cursor position difference between start and now
|
|
3717
|
-
* @param {boolean} [usePreviousCursorDifference] if true, it will output the cursor position difference between the previous selection and now
|
|
3718
|
-
* @param {boolean} [useAreaPositions] if true, it will use cursor positions relative to the area
|
|
3719
|
-
* @return {Vect2}
|
|
3720
|
-
* @deprecated
|
|
3721
|
-
*/
|
|
3722
|
-
value: function getCursorPositionDifference() {
|
|
3723
|
-
var usePreviousCursorDifference = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
3724
|
-
var useAreaPositions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3725
|
-
console.warn('[DragSelect] Using .getCursorPositionDifference is deprecated. Calculate yourself instead. i.e. `.getCurrentCursorPosition().x - .getInitialCursorPosition().x`');
|
|
3726
|
-
var posA = useAreaPositions ? this.getCurrentCursorPositionArea() : this.getCurrentCursorPosition();
|
|
3727
|
-
var posB = usePreviousCursorDifference ? useAreaPositions ? this.getPreviousCursorPositionArea() : this.getPreviousCursorPosition() : useAreaPositions ? this.getInitialCursorPositionArea() : this.getInitialCursorPosition();
|
|
3728
|
-
return calc(posA, '-', posB);
|
|
3729
|
-
}
|
|
3730
|
-
/**
|
|
3731
|
-
* Whether the user is currently drag n dropping elements (instead of selection)
|
|
3732
|
-
* @return {boolean}
|
|
3733
|
-
*/
|
|
3734
|
-
|
|
3735
3582
|
}]);
|
|
3736
3583
|
|
|
3737
3584
|
return DragSelect;
|