dragselect 2.3.1 → 2.4.1
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 +7 -0
- package/README.md +45 -23
- package/deploying.md +9 -4
- package/dist/DragSelect.d.ts +10 -18
- package/dist/DragSelect.es6m.js +412 -579
- package/dist/DragSelect.js +412 -579
- 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 -31
- 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 +3 -3
- package/src/DragSelect.js +22 -175
- 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 +14 -45
- 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.1 ~~~
|
|
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,59 +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
|
-
/**
|
|
1800
|
-
* @type {string}
|
|
1801
|
-
* @private
|
|
1802
|
-
* */
|
|
1803
|
-
|
|
1804
1843
|
/** @type {boolean} */
|
|
1805
1844
|
|
|
1806
1845
|
/** @type {boolean} */
|
|
1807
1846
|
|
|
1808
1847
|
/**
|
|
1809
1848
|
* @constructor Interaction
|
|
1810
|
-
* @param {
|
|
1811
|
-
* @param {DragSelect} obj.DS
|
|
1812
|
-
* @param {DSArea} obj.areaElement
|
|
1813
|
-
* @param {boolean} obj.draggability
|
|
1814
|
-
* @param {boolean} obj.immediateDrag
|
|
1815
|
-
* @param {string} obj.selectableClass
|
|
1849
|
+
* @param {{DS:DragSelect}} obj
|
|
1816
1850
|
* @ignore
|
|
1817
1851
|
*/
|
|
1818
1852
|
function Interaction(_ref) {
|
|
1819
1853
|
var _this = this;
|
|
1820
1854
|
|
|
1821
|
-
var DS = _ref.DS
|
|
1822
|
-
areaElement = _ref.areaElement,
|
|
1823
|
-
draggability = _ref.draggability,
|
|
1824
|
-
immediateDrag = _ref.immediateDrag,
|
|
1825
|
-
selectableClass = _ref.selectableClass;
|
|
1855
|
+
var DS = _ref.DS;
|
|
1826
1856
|
|
|
1827
1857
|
_classCallCheck(this, Interaction);
|
|
1828
1858
|
|
|
1829
|
-
_defineProperty(this, "_areaElement", void 0);
|
|
1830
|
-
|
|
1831
|
-
_defineProperty(this, "_draggability", void 0);
|
|
1832
|
-
|
|
1833
|
-
_defineProperty(this, "_immediateDrag", void 0);
|
|
1834
|
-
|
|
1835
|
-
_defineProperty(this, "_selectableClass", void 0);
|
|
1836
|
-
|
|
1837
1859
|
_defineProperty(this, "isInteracting", void 0);
|
|
1838
1860
|
|
|
1839
1861
|
_defineProperty(this, "isDragging", void 0);
|
|
@@ -1845,9 +1867,9 @@ var Interaction = /*#__PURE__*/function () {
|
|
|
1845
1867
|
_defineProperty(this, "_init", function () {
|
|
1846
1868
|
_this.stop();
|
|
1847
1869
|
|
|
1848
|
-
_this.
|
|
1870
|
+
_this.DS.Area.HTMLNode.addEventListener('mousedown', _this.start);
|
|
1849
1871
|
|
|
1850
|
-
_this.
|
|
1872
|
+
_this.DS.Area.HTMLNode.addEventListener('touchstart', _this.start, {
|
|
1851
1873
|
passive: false
|
|
1852
1874
|
});
|
|
1853
1875
|
|
|
@@ -1880,10 +1902,10 @@ var Interaction = /*#__PURE__*/function () {
|
|
|
1880
1902
|
_defineProperty(this, "isDragEvent", function (event) {
|
|
1881
1903
|
var clickedElement =
|
|
1882
1904
|
/** @type {Element} */
|
|
1883
|
-
event.target.closest(".".concat(_this.
|
|
1884
|
-
if (!_this.
|
|
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;
|
|
1885
1907
|
|
|
1886
|
-
if (_this.
|
|
1908
|
+
if (_this.DS.stores.SettingsStore.s.immediateDrag) {
|
|
1887
1909
|
if (!_this.DS.SelectedSet.size) _this.DS.SelectedSet.add(
|
|
1888
1910
|
/** @type {DSElement} */
|
|
1889
1911
|
clickedElement);else if (!_this.DS.SelectedSet.has(clickedElement)) {
|
|
@@ -1926,9 +1948,9 @@ var Interaction = /*#__PURE__*/function () {
|
|
|
1926
1948
|
_this.isInteracting = false;
|
|
1927
1949
|
_this.isDragging = false;
|
|
1928
1950
|
|
|
1929
|
-
_this.
|
|
1951
|
+
_this.DS.Area.HTMLNode.removeEventListener('mousedown', _this.start);
|
|
1930
1952
|
|
|
1931
|
-
_this.
|
|
1953
|
+
_this.DS.Area.HTMLNode.removeEventListener('touchstart', _this.start, {
|
|
1932
1954
|
// @ts-ignore
|
|
1933
1955
|
passive: false
|
|
1934
1956
|
});
|
|
@@ -1969,11 +1991,9 @@ var Interaction = /*#__PURE__*/function () {
|
|
|
1969
1991
|
});
|
|
1970
1992
|
});
|
|
1971
1993
|
|
|
1972
|
-
this.
|
|
1973
|
-
|
|
1974
|
-
this.
|
|
1975
|
-
this._selectableClass = selectableClass;
|
|
1976
|
-
this.DS = DS;
|
|
1994
|
+
this.DS = DS; // @ts-ignore: @todo: update to typescript
|
|
1995
|
+
|
|
1996
|
+
this.DS.subscribe('Settings:updated:area', this.init);
|
|
1977
1997
|
this.DS.subscribe('PointerStore:updated', this.update);
|
|
1978
1998
|
this.DS.subscribe('Selectable:click', this.onClick);
|
|
1979
1999
|
this.DS.subscribe('Selectable:pointer', function (_ref4) {
|
|
@@ -2094,68 +2114,22 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
|
|
|
2094
2114
|
|
|
2095
2115
|
var _super = _createSuper(SelectableSet);
|
|
2096
2116
|
|
|
2097
|
-
/**
|
|
2098
|
-
* @type {DSElements}
|
|
2099
|
-
* @private
|
|
2100
|
-
* */
|
|
2101
|
-
|
|
2102
|
-
/**
|
|
2103
|
-
* @type {string}
|
|
2104
|
-
* @private
|
|
2105
|
-
* */
|
|
2106
|
-
|
|
2107
|
-
/**
|
|
2108
|
-
* @type {string}
|
|
2109
|
-
* @private
|
|
2110
|
-
* */
|
|
2111
|
-
|
|
2112
|
-
/**
|
|
2113
|
-
* @type {boolean}
|
|
2114
|
-
* @private
|
|
2115
|
-
* */
|
|
2116
|
-
|
|
2117
|
-
/**
|
|
2118
|
-
* @type {boolean}
|
|
2119
|
-
* @private
|
|
2120
|
-
* */
|
|
2121
|
-
|
|
2122
2117
|
/**
|
|
2123
2118
|
* @constructor SelectableSet
|
|
2124
|
-
* @param {
|
|
2125
|
-
* @param {DSInputElements} p.elements
|
|
2126
|
-
* @param {DragSelect} p.DS
|
|
2127
|
-
* @param {string} p.className
|
|
2128
|
-
* @param {string} p.hoverClassName
|
|
2129
|
-
* @param {boolean} p.useTransform
|
|
2130
|
-
* @param {boolean} p.draggability
|
|
2119
|
+
* @param {{DS:DragSelect}} obj
|
|
2131
2120
|
* @ignore
|
|
2132
2121
|
*/
|
|
2133
2122
|
function SelectableSet(_ref) {
|
|
2134
2123
|
var _this;
|
|
2135
2124
|
|
|
2136
|
-
var
|
|
2137
|
-
className = _ref.className,
|
|
2138
|
-
hoverClassName = _ref.hoverClassName,
|
|
2139
|
-
draggability = _ref.draggability,
|
|
2140
|
-
useTransform = _ref.useTransform,
|
|
2141
|
-
DS = _ref.DS;
|
|
2125
|
+
var DS = _ref.DS;
|
|
2142
2126
|
|
|
2143
2127
|
_classCallCheck(this, SelectableSet);
|
|
2144
2128
|
|
|
2145
2129
|
_this = _super.call(this);
|
|
2146
2130
|
|
|
2147
|
-
_defineProperty(_assertThisInitialized(_this), "_initElements", void 0);
|
|
2148
|
-
|
|
2149
|
-
_defineProperty(_assertThisInitialized(_this), "_className", void 0);
|
|
2150
|
-
|
|
2151
|
-
_defineProperty(_assertThisInitialized(_this), "_hoverClassName", void 0);
|
|
2152
|
-
|
|
2153
|
-
_defineProperty(_assertThisInitialized(_this), "_useTransform", void 0);
|
|
2154
|
-
|
|
2155
|
-
_defineProperty(_assertThisInitialized(_this), "_draggability", void 0);
|
|
2156
|
-
|
|
2157
2131
|
_defineProperty(_assertThisInitialized(_this), "init", function () {
|
|
2158
|
-
return _this.
|
|
2132
|
+
return toArray(_this.DS.stores.SettingsStore.s.selectables).forEach(function (el) {
|
|
2159
2133
|
return _this.add(el);
|
|
2160
2134
|
});
|
|
2161
2135
|
});
|
|
@@ -2191,13 +2165,25 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
|
|
|
2191
2165
|
});
|
|
2192
2166
|
|
|
2193
2167
|
_this.DS = DS;
|
|
2194
|
-
_this._initElements = toArray(_elements);
|
|
2195
|
-
_this._className = className;
|
|
2196
|
-
_this._hoverClassName = hoverClassName;
|
|
2197
|
-
_this._useTransform = useTransform;
|
|
2198
|
-
_this._draggability = draggability;
|
|
2199
2168
|
|
|
2200
|
-
_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
|
+
});
|
|
2201
2187
|
|
|
2202
2188
|
return _this;
|
|
2203
2189
|
}
|
|
@@ -2207,14 +2193,14 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
|
|
|
2207
2193
|
|
|
2208
2194
|
/** @param {DSElement} element */
|
|
2209
2195
|
value: function add(element) {
|
|
2210
|
-
element.classList.add(this.
|
|
2196
|
+
element.classList.add(this.DS.stores.SettingsStore.s.selectableClass);
|
|
2211
2197
|
element.addEventListener('click', this._onClick);
|
|
2212
2198
|
element.addEventListener('mousedown', this._onPointer);
|
|
2213
2199
|
element.addEventListener('touchstart', this._onPointer, {
|
|
2214
2200
|
// @ts-ignore
|
|
2215
2201
|
passive: false
|
|
2216
2202
|
});
|
|
2217
|
-
if (this.
|
|
2203
|
+
if (this.DS.stores.SettingsStore.s.draggability && !this.DS.stores.SettingsStore.s.useTransform) handleElementPositionAttribute({
|
|
2218
2204
|
computedStyle: window.getComputedStyle(element),
|
|
2219
2205
|
node: element
|
|
2220
2206
|
});
|
|
@@ -2225,8 +2211,8 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
|
|
|
2225
2211
|
}, {
|
|
2226
2212
|
key: "delete",
|
|
2227
2213
|
value: function _delete(element) {
|
|
2228
|
-
element.classList.remove(this.
|
|
2229
|
-
element.classList.remove(this.
|
|
2214
|
+
element.classList.remove(this.DS.stores.SettingsStore.s.selectableClass);
|
|
2215
|
+
element.classList.remove(this.DS.stores.SettingsStore.s.hoverClass);
|
|
2230
2216
|
element.removeEventListener('click', this._onClick);
|
|
2231
2217
|
element.removeEventListener('mousedown', this._onPointer);
|
|
2232
2218
|
element.removeEventListener('touchstart', this._onPointer, {
|
|
@@ -2252,30 +2238,20 @@ var SelectedSet = /*#__PURE__*/function (_Set) {
|
|
|
2252
2238
|
|
|
2253
2239
|
var _super = _createSuper(SelectedSet);
|
|
2254
2240
|
|
|
2255
|
-
/**
|
|
2256
|
-
* @type {string}
|
|
2257
|
-
* @private
|
|
2258
|
-
* */
|
|
2259
|
-
|
|
2260
2241
|
/**
|
|
2261
2242
|
* @constructor SelectableSet
|
|
2262
|
-
* @param {
|
|
2263
|
-
* @param {DragSelect} p.DS
|
|
2264
|
-
* @param {string} p.className
|
|
2243
|
+
* @param {{DS:DragSelect}} obj
|
|
2265
2244
|
* @ignore
|
|
2266
2245
|
*/
|
|
2267
2246
|
function SelectedSet(_ref) {
|
|
2268
2247
|
var _this;
|
|
2269
2248
|
|
|
2270
|
-
var
|
|
2271
|
-
DS = _ref.DS;
|
|
2249
|
+
var DS = _ref.DS;
|
|
2272
2250
|
|
|
2273
2251
|
_classCallCheck(this, SelectedSet);
|
|
2274
2252
|
|
|
2275
2253
|
_this = _super.call(this);
|
|
2276
2254
|
|
|
2277
|
-
_defineProperty(_assertThisInitialized(_this), "_className", void 0);
|
|
2278
|
-
|
|
2279
2255
|
_defineProperty(_assertThisInitialized(_this), "clear", function () {
|
|
2280
2256
|
return _this.forEach(function (el) {
|
|
2281
2257
|
return _this["delete"](el);
|
|
@@ -2295,7 +2271,6 @@ var SelectedSet = /*#__PURE__*/function (_Set) {
|
|
|
2295
2271
|
});
|
|
2296
2272
|
|
|
2297
2273
|
_this.DS = DS;
|
|
2298
|
-
_this._className = className;
|
|
2299
2274
|
return _this;
|
|
2300
2275
|
}
|
|
2301
2276
|
/** @param {DSElement} element */
|
|
@@ -2313,7 +2288,7 @@ var SelectedSet = /*#__PURE__*/function (_Set) {
|
|
|
2313
2288
|
|
|
2314
2289
|
_get(_getPrototypeOf(SelectedSet.prototype), "add", this).call(this, element);
|
|
2315
2290
|
|
|
2316
|
-
element.classList.add(this.
|
|
2291
|
+
element.classList.add(this.DS.stores.SettingsStore.s.selectedClass);
|
|
2317
2292
|
element.style.zIndex = "".concat((parseInt(element.style.zIndex) || 0) + 1);
|
|
2318
2293
|
this.DS.publish('Selected:added', publishData);
|
|
2319
2294
|
return this;
|
|
@@ -2332,7 +2307,7 @@ var SelectedSet = /*#__PURE__*/function (_Set) {
|
|
|
2332
2307
|
|
|
2333
2308
|
var deleted = _get(_getPrototypeOf(SelectedSet.prototype), "delete", this).call(this, element);
|
|
2334
2309
|
|
|
2335
|
-
element.classList.remove(this.
|
|
2310
|
+
element.classList.remove(this.DS.stores.SettingsStore.s.selectedClass);
|
|
2336
2311
|
element.style.zIndex = "".concat((parseInt(element.style.zIndex) || 0) - 1);
|
|
2337
2312
|
this.DS.publish('Selected:removed', publishData);
|
|
2338
2313
|
return deleted;
|
|
@@ -2369,36 +2344,20 @@ var Selection = /*#__PURE__*/function () {
|
|
|
2369
2344
|
* @private
|
|
2370
2345
|
* */
|
|
2371
2346
|
|
|
2372
|
-
/**
|
|
2373
|
-
* @type {string}
|
|
2374
|
-
* @private
|
|
2375
|
-
* */
|
|
2376
|
-
|
|
2377
|
-
/**
|
|
2378
|
-
* @type {boolean}
|
|
2379
|
-
* @private
|
|
2380
|
-
* */
|
|
2381
|
-
|
|
2382
2347
|
/**
|
|
2383
2348
|
* @constructor Selection
|
|
2384
|
-
* @param {{ DS:DragSelect
|
|
2349
|
+
* @param {{ DS:DragSelect }} p
|
|
2385
2350
|
* @ignore
|
|
2386
2351
|
*/
|
|
2387
2352
|
function Selection(_ref) {
|
|
2388
2353
|
var _this = this;
|
|
2389
2354
|
|
|
2390
|
-
var DS = _ref.DS
|
|
2391
|
-
hoverClassName = _ref.hoverClassName,
|
|
2392
|
-
multiSelectToggling = _ref.multiSelectToggling;
|
|
2355
|
+
var DS = _ref.DS;
|
|
2393
2356
|
|
|
2394
2357
|
_classCallCheck(this, Selection);
|
|
2395
2358
|
|
|
2396
2359
|
_defineProperty(this, "_prevSelectedSet", void 0);
|
|
2397
2360
|
|
|
2398
|
-
_defineProperty(this, "_hoverClassName", void 0);
|
|
2399
|
-
|
|
2400
|
-
_defineProperty(this, "_multiSelectToggling", void 0);
|
|
2401
|
-
|
|
2402
2361
|
_defineProperty(this, "start", function (_ref2) {
|
|
2403
2362
|
var event = _ref2.event,
|
|
2404
2363
|
isDragging = _ref2.isDragging;
|
|
@@ -2434,7 +2393,7 @@ var Selection = /*#__PURE__*/function () {
|
|
|
2434
2393
|
if (isCollision(elPosCombo[i][1], Selector.rect)) select.push(elPosCombo[i][0]);else unselect.push(elPosCombo[i][0]);
|
|
2435
2394
|
}
|
|
2436
2395
|
|
|
2437
|
-
var multiSelectionToggle = _this.DS.stores.KeyStore.isMultiSelectKeyPressed(event) && _this.
|
|
2396
|
+
var multiSelectionToggle = _this.DS.stores.KeyStore.isMultiSelectKeyPressed(event) && _this.DS.stores.SettingsStore.s.multiSelectToggling;
|
|
2438
2397
|
|
|
2439
2398
|
if (_this.DS["continue"]) return;
|
|
2440
2399
|
select.forEach(function (element) {
|
|
@@ -2443,7 +2402,7 @@ var Selection = /*#__PURE__*/function () {
|
|
|
2443
2402
|
force: force,
|
|
2444
2403
|
multiSelectionToggle: multiSelectionToggle,
|
|
2445
2404
|
SelectedSet: _this.DS.SelectedSet,
|
|
2446
|
-
hoverClassName: _this.
|
|
2405
|
+
hoverClassName: _this.DS.stores.SettingsStore.s.hoverClass
|
|
2447
2406
|
});
|
|
2448
2407
|
});
|
|
2449
2408
|
unselect.forEach(function (element) {
|
|
@@ -2451,14 +2410,12 @@ var Selection = /*#__PURE__*/function () {
|
|
|
2451
2410
|
element: element,
|
|
2452
2411
|
force: force,
|
|
2453
2412
|
SelectedSet: _this.DS.SelectedSet,
|
|
2454
|
-
hoverClassName: _this.
|
|
2413
|
+
hoverClassName: _this.DS.stores.SettingsStore.s.hoverClass,
|
|
2455
2414
|
PrevSelectedSet: _this._prevSelectedSet
|
|
2456
2415
|
});
|
|
2457
2416
|
});
|
|
2458
2417
|
});
|
|
2459
2418
|
|
|
2460
|
-
this._hoverClassName = hoverClassName;
|
|
2461
|
-
this._multiSelectToggling = multiSelectToggling;
|
|
2462
2419
|
this.DS = DS;
|
|
2463
2420
|
this.DS.subscribe('Interaction:start', this.start);
|
|
2464
2421
|
this.DS.subscribe('Interaction:update', this.update);
|
|
@@ -2493,25 +2450,29 @@ var Selector = /*#__PURE__*/function () {
|
|
|
2493
2450
|
|
|
2494
2451
|
/**
|
|
2495
2452
|
* @constructor Selector
|
|
2496
|
-
* @param {
|
|
2497
|
-
* @param {DragSelect} p.DS
|
|
2498
|
-
* @param {HTMLElement} p.selector
|
|
2499
|
-
* @param {string} p.selectorClass
|
|
2500
|
-
* @param {boolean} p.customStyles
|
|
2453
|
+
* @param {{ DS:DragSelect }} p
|
|
2501
2454
|
* @ignore
|
|
2502
2455
|
*/
|
|
2503
2456
|
function Selector(_ref) {
|
|
2504
2457
|
var _this = this;
|
|
2505
2458
|
|
|
2506
|
-
var DS = _ref.DS
|
|
2507
|
-
selector = _ref.selector,
|
|
2508
|
-
selectorClass = _ref.selectorClass,
|
|
2509
|
-
customStyles = _ref.customStyles;
|
|
2459
|
+
var DS = _ref.DS;
|
|
2510
2460
|
|
|
2511
2461
|
_classCallCheck(this, Selector);
|
|
2512
2462
|
|
|
2513
2463
|
_defineProperty(this, "_rect", void 0);
|
|
2514
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
|
+
|
|
2515
2476
|
_defineProperty(this, "start", function (_ref2) {
|
|
2516
2477
|
var isDragging = _ref2.isDragging;
|
|
2517
2478
|
if (isDragging) return;
|
|
@@ -2543,9 +2504,18 @@ var Selector = /*#__PURE__*/function () {
|
|
|
2543
2504
|
_this._rect = null;
|
|
2544
2505
|
});
|
|
2545
2506
|
|
|
2546
|
-
this.DS = DS;
|
|
2547
|
-
|
|
2548
|
-
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();
|
|
2549
2519
|
this.DS.subscribe('Interaction:start', this.start);
|
|
2550
2520
|
this.DS.subscribe('Interaction:update', this.update);
|
|
2551
2521
|
this.DS.subscribe('Interaction:end', this.stop);
|
|
@@ -2563,11 +2533,6 @@ var Selector = /*#__PURE__*/function () {
|
|
|
2563
2533
|
}();
|
|
2564
2534
|
|
|
2565
2535
|
var SelectorArea = /*#__PURE__*/function () {
|
|
2566
|
-
/**
|
|
2567
|
-
* @type {number}
|
|
2568
|
-
* @private
|
|
2569
|
-
* */
|
|
2570
|
-
|
|
2571
2536
|
/**
|
|
2572
2537
|
* @type {*}
|
|
2573
2538
|
* @private
|
|
@@ -2583,37 +2548,25 @@ var SelectorArea = /*#__PURE__*/function () {
|
|
|
2583
2548
|
* @private
|
|
2584
2549
|
*/
|
|
2585
2550
|
|
|
2586
|
-
/**
|
|
2587
|
-
* @type {Vect2}
|
|
2588
|
-
* @private
|
|
2589
|
-
*/
|
|
2590
|
-
|
|
2591
2551
|
/**
|
|
2592
2552
|
* @class SelectorArea
|
|
2593
2553
|
* @constructor SelectorArea
|
|
2594
|
-
* @param {{ DS:DragSelect
|
|
2554
|
+
* @param {{ DS:DragSelect }} obj
|
|
2595
2555
|
* @ignore
|
|
2596
2556
|
*/
|
|
2597
2557
|
function SelectorArea(_ref) {
|
|
2598
2558
|
var _this = this;
|
|
2599
2559
|
|
|
2600
|
-
var DS = _ref.DS
|
|
2601
|
-
selectorAreaClass = _ref.selectorAreaClass,
|
|
2602
|
-
autoScrollSpeed = _ref.autoScrollSpeed,
|
|
2603
|
-
overflowTolerance = _ref.overflowTolerance;
|
|
2560
|
+
var DS = _ref.DS;
|
|
2604
2561
|
|
|
2605
2562
|
_classCallCheck(this, SelectorArea);
|
|
2606
2563
|
|
|
2607
|
-
_defineProperty(this, "_autoScrollSpeed", void 0);
|
|
2608
|
-
|
|
2609
2564
|
_defineProperty(this, "_scrollInterval", void 0);
|
|
2610
2565
|
|
|
2611
2566
|
_defineProperty(this, "_rect", void 0);
|
|
2612
2567
|
|
|
2613
2568
|
_defineProperty(this, "currentEdges", []);
|
|
2614
2569
|
|
|
2615
|
-
_defineProperty(this, "_overflowTolerance", void 0);
|
|
2616
|
-
|
|
2617
2570
|
_defineProperty(this, "start", function () {
|
|
2618
2571
|
return _this.applyElements('append');
|
|
2619
2572
|
});
|
|
@@ -2664,9 +2617,9 @@ var SelectorArea = /*#__PURE__*/function () {
|
|
|
2664
2617
|
_this.currentEdges = getOverflowEdges({
|
|
2665
2618
|
elementRect: vect2rect(PointerStore.currentVal),
|
|
2666
2619
|
containerRect: _this.rect,
|
|
2667
|
-
tolerance: _this.
|
|
2620
|
+
tolerance: _this.DS.stores.SettingsStore.s.overflowTolerance
|
|
2668
2621
|
});
|
|
2669
|
-
if (_this.currentEdges.length) Area.scroll(_this.currentEdges, _this.
|
|
2622
|
+
if (_this.currentEdges.length) Area.scroll(_this.currentEdges, _this.DS.stores.SettingsStore.s.autoScrollSpeed);
|
|
2670
2623
|
});
|
|
2671
2624
|
|
|
2672
2625
|
_defineProperty(this, "stopAutoScroll", function () {
|
|
@@ -2679,10 +2632,18 @@ var SelectorArea = /*#__PURE__*/function () {
|
|
|
2679
2632
|
return isCollision(_this.rect, elementRect || element.getBoundingClientRect());
|
|
2680
2633
|
});
|
|
2681
2634
|
|
|
2682
|
-
this._autoScrollSpeed = autoScrollSpeed;
|
|
2683
|
-
this._overflowTolerance = overflowTolerance;
|
|
2684
2635
|
this.DS = DS;
|
|
2685
|
-
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);
|
|
2686
2647
|
this.DS.subscribe('Area:modified', this.updatePos);
|
|
2687
2648
|
this.DS.subscribe('Interaction:init', this.start);
|
|
2688
2649
|
this.DS.subscribe('Interaction:start', this.startAutoScroll);
|
|
@@ -2723,16 +2684,6 @@ var SelectorArea = /*#__PURE__*/function () {
|
|
|
2723
2684
|
}();
|
|
2724
2685
|
|
|
2725
2686
|
var KeyStore = /*#__PURE__*/function () {
|
|
2726
|
-
/**
|
|
2727
|
-
* @type {boolean}
|
|
2728
|
-
* @private
|
|
2729
|
-
* */
|
|
2730
|
-
|
|
2731
|
-
/**
|
|
2732
|
-
* @type {DSMultiSelectKeys}
|
|
2733
|
-
* @private
|
|
2734
|
-
* */
|
|
2735
|
-
|
|
2736
2687
|
/**
|
|
2737
2688
|
* @type {Set<string>}
|
|
2738
2689
|
* @private
|
|
@@ -2746,22 +2697,16 @@ var KeyStore = /*#__PURE__*/function () {
|
|
|
2746
2697
|
/**
|
|
2747
2698
|
* @class KeyStore
|
|
2748
2699
|
* @constructor KeyStore
|
|
2749
|
-
* @param {{DS:DragSelect
|
|
2700
|
+
* @param {{DS:DragSelect}} p
|
|
2750
2701
|
* @ignore
|
|
2751
2702
|
*/
|
|
2752
2703
|
function KeyStore(_ref) {
|
|
2753
2704
|
var _this = this;
|
|
2754
2705
|
|
|
2755
|
-
var DS = _ref.DS
|
|
2756
|
-
multiSelectKeys = _ref.multiSelectKeys,
|
|
2757
|
-
multiSelectMode = _ref.multiSelectMode;
|
|
2706
|
+
var DS = _ref.DS;
|
|
2758
2707
|
|
|
2759
2708
|
_classCallCheck(this, KeyStore);
|
|
2760
2709
|
|
|
2761
|
-
_defineProperty(this, "_multiSelectMode", void 0);
|
|
2762
|
-
|
|
2763
|
-
_defineProperty(this, "_multiSelectKeys", void 0);
|
|
2764
|
-
|
|
2765
2710
|
_defineProperty(this, "_currentValues", new Set());
|
|
2766
2711
|
|
|
2767
2712
|
_defineProperty(this, "_keyMapping", {
|
|
@@ -2821,25 +2766,6 @@ var KeyStore = /*#__PURE__*/function () {
|
|
|
2821
2766
|
});
|
|
2822
2767
|
|
|
2823
2768
|
this.DS = DS;
|
|
2824
|
-
this._multiSelectMode = multiSelectMode; // @TODO: remove after deprecation
|
|
2825
|
-
|
|
2826
|
-
this._multiSelectKeys = multiSelectKeys.map(function (key) {
|
|
2827
|
-
var deprecatedKeys = {
|
|
2828
|
-
ctrlKey: 'Control',
|
|
2829
|
-
shiftKey: 'Shift',
|
|
2830
|
-
metaKey: 'Meta'
|
|
2831
|
-
};
|
|
2832
|
-
/** @type {string} */
|
|
2833
|
-
|
|
2834
|
-
var newName = deprecatedKeys[key];
|
|
2835
|
-
|
|
2836
|
-
if (newName) {
|
|
2837
|
-
console.warn("[DragSelect] ".concat(key, " is deprecated. Use \"").concat(newName, "\" instead. Act Now!. See docs for more info"));
|
|
2838
|
-
return newName.toLowerCase();
|
|
2839
|
-
}
|
|
2840
|
-
|
|
2841
|
-
return key.toLowerCase();
|
|
2842
|
-
});
|
|
2843
2769
|
this.DS.subscribe('Interaction:init', this.init);
|
|
2844
2770
|
}
|
|
2845
2771
|
|
|
@@ -2850,11 +2776,14 @@ var KeyStore = /*#__PURE__*/function () {
|
|
|
2850
2776
|
value: function isMultiSelectKeyPressed(event) {
|
|
2851
2777
|
var _this2 = this;
|
|
2852
2778
|
|
|
2853
|
-
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
|
+
});
|
|
2854
2783
|
if (this.currentValues.some(function (key) {
|
|
2855
|
-
return
|
|
2784
|
+
return multiSelectKeys.includes(key.toLocaleLowerCase());
|
|
2856
2785
|
})) return true;
|
|
2857
|
-
if (event &&
|
|
2786
|
+
if (event && multiSelectKeys.some(function (key) {
|
|
2858
2787
|
return event[_this2._keyMapping[key]];
|
|
2859
2788
|
})) return true;
|
|
2860
2789
|
return false;
|
|
@@ -3118,10 +3047,6 @@ var ScrollStore = /*#__PURE__*/function () {
|
|
|
3118
3047
|
* @type {Vect2}
|
|
3119
3048
|
* @private */
|
|
3120
3049
|
|
|
3121
|
-
/**
|
|
3122
|
-
* @type {DSArea}
|
|
3123
|
-
* @private */
|
|
3124
|
-
|
|
3125
3050
|
/**
|
|
3126
3051
|
* @type {boolean}
|
|
3127
3052
|
* @private */
|
|
@@ -3129,15 +3054,13 @@ var ScrollStore = /*#__PURE__*/function () {
|
|
|
3129
3054
|
/**
|
|
3130
3055
|
* @class ScrollStore
|
|
3131
3056
|
* @constructor ScrollStore
|
|
3132
|
-
* @param {{ DS:DragSelect
|
|
3057
|
+
* @param {{ DS:DragSelect }} p
|
|
3133
3058
|
* @ignore
|
|
3134
3059
|
*/
|
|
3135
3060
|
function ScrollStore(_ref) {
|
|
3136
3061
|
var _this = this;
|
|
3137
3062
|
|
|
3138
|
-
var DS = _ref.DS
|
|
3139
|
-
areaElement = _ref.areaElement,
|
|
3140
|
-
zoom = _ref.zoom;
|
|
3063
|
+
var DS = _ref.DS;
|
|
3141
3064
|
|
|
3142
3065
|
_classCallCheck(this, ScrollStore);
|
|
3143
3066
|
|
|
@@ -3145,26 +3068,24 @@ var ScrollStore = /*#__PURE__*/function () {
|
|
|
3145
3068
|
|
|
3146
3069
|
_defineProperty(this, "_currentVal", void 0);
|
|
3147
3070
|
|
|
3148
|
-
_defineProperty(this, "_areaElement", void 0);
|
|
3149
|
-
|
|
3150
3071
|
_defineProperty(this, "_canScroll", void 0);
|
|
3151
3072
|
|
|
3152
3073
|
_defineProperty(this, "init", function () {
|
|
3153
|
-
return _this.
|
|
3074
|
+
return _this.DS.stores.SettingsStore.s.area.addEventListener('scroll', _this.update);
|
|
3154
3075
|
});
|
|
3155
3076
|
|
|
3156
3077
|
_defineProperty(this, "start", function () {
|
|
3157
|
-
_this._currentVal = _this._initialVal = getCurrentScroll(_this.
|
|
3078
|
+
_this._currentVal = _this._initialVal = getCurrentScroll(_this.DS.stores.SettingsStore.s.area);
|
|
3158
3079
|
|
|
3159
|
-
_this.
|
|
3080
|
+
_this.DS.stores.SettingsStore.s.area.addEventListener('scroll', _this.update);
|
|
3160
3081
|
});
|
|
3161
3082
|
|
|
3162
3083
|
_defineProperty(this, "update", function () {
|
|
3163
|
-
return _this._currentVal = getCurrentScroll(_this.
|
|
3084
|
+
return _this._currentVal = getCurrentScroll(_this.DS.stores.SettingsStore.s.area);
|
|
3164
3085
|
});
|
|
3165
3086
|
|
|
3166
3087
|
_defineProperty(this, "stop", function () {
|
|
3167
|
-
_this.
|
|
3088
|
+
_this.DS.stores.SettingsStore.s.area.removeEventListener('scroll', _this.update);
|
|
3168
3089
|
|
|
3169
3090
|
_this._initialVal = {
|
|
3170
3091
|
x: 0,
|
|
@@ -3179,9 +3100,7 @@ var ScrollStore = /*#__PURE__*/function () {
|
|
|
3179
3100
|
_this.start();
|
|
3180
3101
|
});
|
|
3181
3102
|
|
|
3182
|
-
this._areaElement = areaElement;
|
|
3183
3103
|
this.DS = DS;
|
|
3184
|
-
this.zoom = zoom;
|
|
3185
3104
|
this.DS.subscribe('Interaction:init', this.init);
|
|
3186
3105
|
this.DS.subscribe('Interaction:start', function () {
|
|
3187
3106
|
return _this.start();
|
|
@@ -3195,14 +3114,14 @@ var ScrollStore = /*#__PURE__*/function () {
|
|
|
3195
3114
|
key: "canScroll",
|
|
3196
3115
|
get: function get() {
|
|
3197
3116
|
if (typeof this._canScroll === 'boolean') return this._canScroll;
|
|
3198
|
-
return this._canScroll = canScroll(this.
|
|
3117
|
+
return this._canScroll = canScroll(this.DS.stores.SettingsStore.s.area);
|
|
3199
3118
|
}
|
|
3200
3119
|
}, {
|
|
3201
3120
|
key: "scrollAmount",
|
|
3202
3121
|
get: function get() {
|
|
3203
3122
|
var scrollDiff = calc(this.currentVal, '-', this.initialVal); // if area is zoomed, the scroll values are skewed, we need to fix that manually :(
|
|
3204
3123
|
|
|
3205
|
-
var zoom = num2vect(this.zoom);
|
|
3124
|
+
var zoom = num2vect(this.DS.stores.SettingsStore.s.zoom);
|
|
3206
3125
|
var zoomScroll = calc(calc(scrollDiff, '*', zoom), '-', scrollDiff);
|
|
3207
3126
|
return {
|
|
3208
3127
|
x: scrollDiff.x + zoomScroll.x,
|
|
@@ -3221,7 +3140,7 @@ var ScrollStore = /*#__PURE__*/function () {
|
|
|
3221
3140
|
}, {
|
|
3222
3141
|
key: "currentVal",
|
|
3223
3142
|
get: function get() {
|
|
3224
|
-
if (!this._currentVal) this._currentVal = getCurrentScroll(this.
|
|
3143
|
+
if (!this._currentVal) this._currentVal = getCurrentScroll(this.DS.stores.SettingsStore.s.area);
|
|
3225
3144
|
return this._currentVal;
|
|
3226
3145
|
}
|
|
3227
3146
|
}]);
|
|
@@ -3229,6 +3148,102 @@ var ScrollStore = /*#__PURE__*/function () {
|
|
|
3229
3148
|
return ScrollStore;
|
|
3230
3149
|
}();
|
|
3231
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
|
+
|
|
3232
3247
|
//////////////////////////////////////////////////////////////////////////////////////
|
|
3233
3248
|
|
|
3234
3249
|
var DragSelect = /*#__PURE__*/function () {
|
|
@@ -3242,60 +3257,9 @@ var DragSelect = /*#__PURE__*/function () {
|
|
|
3242
3257
|
* @constructor DragSelect
|
|
3243
3258
|
* @param {Settings} settings
|
|
3244
3259
|
*/
|
|
3245
|
-
function DragSelect(
|
|
3260
|
+
function DragSelect(_settings) {
|
|
3246
3261
|
var _this = this;
|
|
3247
3262
|
|
|
3248
|
-
var _ref$area = _ref.area,
|
|
3249
|
-
area = _ref$area === void 0 ? document : _ref$area,
|
|
3250
|
-
_ref$selectables = _ref.selectables,
|
|
3251
|
-
selectables = _ref$selectables === void 0 ? [] : _ref$selectables,
|
|
3252
|
-
_ref$autoScrollSpeed = _ref.autoScrollSpeed,
|
|
3253
|
-
autoScrollSpeed = _ref$autoScrollSpeed === void 0 ? 5 : _ref$autoScrollSpeed,
|
|
3254
|
-
_ref$overflowToleranc = _ref.overflowTolerance,
|
|
3255
|
-
overflowTolerance = _ref$overflowToleranc === void 0 ? {
|
|
3256
|
-
x: 25,
|
|
3257
|
-
y: 25
|
|
3258
|
-
} : _ref$overflowToleranc,
|
|
3259
|
-
_ref$zoom = _ref.zoom,
|
|
3260
|
-
zoom = _ref$zoom === void 0 ? 1 : _ref$zoom,
|
|
3261
|
-
_ref$customStyles = _ref.customStyles,
|
|
3262
|
-
customStyles = _ref$customStyles === void 0 ? false : _ref$customStyles,
|
|
3263
|
-
_ref$multiSelectMode = _ref.multiSelectMode,
|
|
3264
|
-
multiSelectMode = _ref$multiSelectMode === void 0 ? false : _ref$multiSelectMode,
|
|
3265
|
-
_ref$multiSelectToggl = _ref.multiSelectToggling,
|
|
3266
|
-
multiSelectToggling = _ref$multiSelectToggl === void 0 ? true : _ref$multiSelectToggl,
|
|
3267
|
-
_ref$multiSelectKeys = _ref.multiSelectKeys,
|
|
3268
|
-
multiSelectKeys = _ref$multiSelectKeys === void 0 ? ['Control', 'Shift', 'Meta'] : _ref$multiSelectKeys,
|
|
3269
|
-
_ref$selector = _ref.selector,
|
|
3270
|
-
selector = _ref$selector === void 0 ? undefined : _ref$selector,
|
|
3271
|
-
_ref$draggability = _ref.draggability,
|
|
3272
|
-
draggability = _ref$draggability === void 0 ? true : _ref$draggability,
|
|
3273
|
-
_ref$immediateDrag = _ref.immediateDrag,
|
|
3274
|
-
immediateDrag = _ref$immediateDrag === void 0 ? true : _ref$immediateDrag,
|
|
3275
|
-
_ref$keyboardDrag = _ref.keyboardDrag,
|
|
3276
|
-
keyboardDrag = _ref$keyboardDrag === void 0 ? true : _ref$keyboardDrag,
|
|
3277
|
-
dragKeys = _ref.dragKeys,
|
|
3278
|
-
_ref$keyboardDragSpee = _ref.keyboardDragSpeed,
|
|
3279
|
-
keyboardDragSpeed = _ref$keyboardDragSpee === void 0 ? 10 : _ref$keyboardDragSpee,
|
|
3280
|
-
_ref$useTransform = _ref.useTransform,
|
|
3281
|
-
useTransform = _ref$useTransform === void 0 ? true : _ref$useTransform,
|
|
3282
|
-
_ref$hoverClass = _ref.hoverClass,
|
|
3283
|
-
hoverClass = _ref$hoverClass === void 0 ? 'ds-hover' : _ref$hoverClass,
|
|
3284
|
-
_ref$selectableClass = _ref.selectableClass,
|
|
3285
|
-
selectableClass = _ref$selectableClass === void 0 ? 'ds-selectable' : _ref$selectableClass,
|
|
3286
|
-
_ref$selectedClass = _ref.selectedClass,
|
|
3287
|
-
selectedClass = _ref$selectedClass === void 0 ? 'ds-selected' : _ref$selectedClass,
|
|
3288
|
-
_ref$selectorClass = _ref.selectorClass,
|
|
3289
|
-
selectorClass = _ref$selectorClass === void 0 ? 'ds-selector' : _ref$selectorClass,
|
|
3290
|
-
_ref$selectorAreaClas = _ref.selectorAreaClass,
|
|
3291
|
-
selectorAreaClass = _ref$selectorAreaClas === void 0 ? 'ds-selector-area' : _ref$selectorAreaClas,
|
|
3292
|
-
callback = _ref.callback,
|
|
3293
|
-
onDragMove = _ref.onDragMove,
|
|
3294
|
-
onDragStartBegin = _ref.onDragStartBegin,
|
|
3295
|
-
onDragStart = _ref.onDragStart,
|
|
3296
|
-
onElementSelect = _ref.onElementSelect,
|
|
3297
|
-
onElementUnselect = _ref.onElementUnselect;
|
|
3298
|
-
|
|
3299
3263
|
_classCallCheck(this, DragSelect);
|
|
3300
3264
|
|
|
3301
3265
|
_defineProperty(this, "continue", false);
|
|
@@ -3350,91 +3314,57 @@ var DragSelect = /*#__PURE__*/function () {
|
|
|
3350
3314
|
return _this.Interaction.isDragging;
|
|
3351
3315
|
});
|
|
3352
3316
|
|
|
3317
|
+
_defineProperty(this, "setSettings", function (settings) {
|
|
3318
|
+
return _this.stores.SettingsStore.update({
|
|
3319
|
+
settings: settings
|
|
3320
|
+
});
|
|
3321
|
+
});
|
|
3322
|
+
|
|
3353
3323
|
this.PubSub = new PubSub({
|
|
3354
3324
|
DS: this
|
|
3355
3325
|
});
|
|
3356
3326
|
this.subscribe = this.PubSub.subscribe;
|
|
3357
3327
|
this.unsubscribe = this.PubSub.unsubscribe;
|
|
3358
3328
|
this.publish = this.PubSub.publish;
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
this.stores = {
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
areaElement: area,
|
|
3376
|
-
zoom: zoom
|
|
3377
|
-
}),
|
|
3378
|
-
KeyStore: new KeyStore({
|
|
3379
|
-
DS: this,
|
|
3380
|
-
multiSelectKeys: multiSelectKeys,
|
|
3381
|
-
multiSelectMode: multiSelectMode
|
|
3382
|
-
})
|
|
3383
|
-
};
|
|
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
|
+
});
|
|
3384
3345
|
this.Area = new Area({
|
|
3385
|
-
|
|
3386
|
-
PS: this.PubSub,
|
|
3387
|
-
zoom: zoom
|
|
3346
|
+
DS: this
|
|
3388
3347
|
});
|
|
3389
3348
|
this.Selector = new Selector({
|
|
3390
|
-
DS: this
|
|
3391
|
-
selector: selector,
|
|
3392
|
-
selectorClass: selectorClass,
|
|
3393
|
-
customStyles: customStyles
|
|
3349
|
+
DS: this
|
|
3394
3350
|
});
|
|
3395
3351
|
this.SelectorArea = new SelectorArea({
|
|
3396
|
-
DS: this
|
|
3397
|
-
selectorAreaClass: selectorAreaClass,
|
|
3398
|
-
autoScrollSpeed: autoScrollSpeed,
|
|
3399
|
-
overflowTolerance: overflowTolerance
|
|
3352
|
+
DS: this
|
|
3400
3353
|
});
|
|
3401
3354
|
this.SelectableSet = new SelectableSet({
|
|
3402
|
-
|
|
3403
|
-
DS: this,
|
|
3404
|
-
className: selectableClass,
|
|
3405
|
-
hoverClassName: hoverClass,
|
|
3406
|
-
useTransform: useTransform,
|
|
3407
|
-
draggability: draggability
|
|
3355
|
+
DS: this
|
|
3408
3356
|
});
|
|
3409
3357
|
this.SelectedSet = new SelectedSet({
|
|
3410
|
-
DS: this
|
|
3411
|
-
className: selectedClass
|
|
3358
|
+
DS: this
|
|
3412
3359
|
});
|
|
3413
3360
|
this.Selection = new Selection({
|
|
3414
|
-
DS: this
|
|
3415
|
-
hoverClassName: hoverClass,
|
|
3416
|
-
multiSelectToggling: multiSelectToggling
|
|
3361
|
+
DS: this
|
|
3417
3362
|
});
|
|
3418
3363
|
this.Drag = new Drag({
|
|
3419
|
-
DS: this
|
|
3420
|
-
draggability: draggability,
|
|
3421
|
-
useTransform: useTransform,
|
|
3422
|
-
keyboardDrag: keyboardDrag,
|
|
3423
|
-
dragKeys: Object.assign({
|
|
3424
|
-
up: ['ArrowUp'],
|
|
3425
|
-
down: ['ArrowDown'],
|
|
3426
|
-
left: ['ArrowLeft'],
|
|
3427
|
-
right: ['ArrowRight']
|
|
3428
|
-
}, dragKeys),
|
|
3429
|
-
zoom: zoom,
|
|
3430
|
-
keyboardDragSpeed: keyboardDragSpeed
|
|
3364
|
+
DS: this
|
|
3431
3365
|
});
|
|
3432
3366
|
this.Interaction = new Interaction({
|
|
3433
|
-
|
|
3434
|
-
DS: this,
|
|
3435
|
-
draggability: draggability,
|
|
3436
|
-
immediateDrag: immediateDrag,
|
|
3437
|
-
selectableClass: selectableClass
|
|
3367
|
+
DS: this
|
|
3438
3368
|
}); // Subscriber Aliases
|
|
3439
3369
|
|
|
3440
3370
|
subscriberAliases({
|
|
@@ -3447,91 +3377,16 @@ var DragSelect = /*#__PURE__*/function () {
|
|
|
3447
3377
|
return _this["continue"] = false;
|
|
3448
3378
|
});
|
|
3449
3379
|
this.start();
|
|
3450
|
-
} //
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
_createClass(DragSelect, [{
|
|
3454
|
-
key: "_callbacksTemp",
|
|
3455
|
-
value: function _callbacksTemp(_ref2) {
|
|
3456
|
-
var callback = _ref2.callback,
|
|
3457
|
-
onDragMove = _ref2.onDragMove,
|
|
3458
|
-
onDragStart = _ref2.onDragStart,
|
|
3459
|
-
onDragStartBegin = _ref2.onDragStartBegin,
|
|
3460
|
-
onElementSelect = _ref2.onElementSelect,
|
|
3461
|
-
onElementUnselect = _ref2.onElementUnselect;
|
|
3462
|
-
|
|
3463
|
-
var warnMessage = function warnMessage(name, newName) {
|
|
3464
|
-
return console.warn("[DragSelect] ".concat(name, " is deprecated. Use DragSelect.subscribe(\"").concat(newName, "\", (callbackObject) => {}) instead. Act Now! See docs for more info"));
|
|
3465
|
-
};
|
|
3466
|
-
|
|
3467
|
-
if (callback) {
|
|
3468
|
-
warnMessage('callback', 'callback');
|
|
3469
|
-
this.subscribe('callback', function (_ref3) {
|
|
3470
|
-
var items = _ref3.items,
|
|
3471
|
-
item = _ref3.item,
|
|
3472
|
-
event = _ref3.event;
|
|
3473
|
-
return callback(items, event);
|
|
3474
|
-
});
|
|
3475
|
-
}
|
|
3476
|
-
|
|
3477
|
-
if (onDragMove) {
|
|
3478
|
-
warnMessage('onDragMove', 'dragmove');
|
|
3479
|
-
this.subscribe('dragmove', function (_ref4) {
|
|
3480
|
-
var items = _ref4.items,
|
|
3481
|
-
item = _ref4.item,
|
|
3482
|
-
event = _ref4.event;
|
|
3483
|
-
return onDragMove(event);
|
|
3484
|
-
});
|
|
3485
|
-
}
|
|
3486
|
-
|
|
3487
|
-
if (onDragStart) {
|
|
3488
|
-
warnMessage('onDragStart', 'dragstart');
|
|
3489
|
-
this.subscribe('dragstart', function (_ref5) {
|
|
3490
|
-
var items = _ref5.items,
|
|
3491
|
-
item = _ref5.item,
|
|
3492
|
-
event = _ref5.event;
|
|
3493
|
-
return onDragStart(event);
|
|
3494
|
-
});
|
|
3495
|
-
}
|
|
3496
|
-
|
|
3497
|
-
if (onDragStartBegin) {
|
|
3498
|
-
warnMessage('onDragStartBegin', 'dragstart');
|
|
3499
|
-
this.subscribe('dragstart', function (_ref6) {
|
|
3500
|
-
var items = _ref6.items,
|
|
3501
|
-
item = _ref6.item,
|
|
3502
|
-
event = _ref6.event;
|
|
3503
|
-
return onDragStartBegin(event);
|
|
3504
|
-
});
|
|
3505
|
-
}
|
|
3380
|
+
} // Useful methods for the user
|
|
3381
|
+
//////////////////////////////////////////////////////////////////////////////////////
|
|
3506
3382
|
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
item = _ref7.item,
|
|
3512
|
-
event = _ref7.event;
|
|
3513
|
-
return onElementSelect(item, event);
|
|
3514
|
-
});
|
|
3515
|
-
}
|
|
3516
|
-
|
|
3517
|
-
if (onElementUnselect) {
|
|
3518
|
-
warnMessage('onElementUnselect', 'elementunselect');
|
|
3519
|
-
this.subscribe('elementunselect', function (_ref8) {
|
|
3520
|
-
var items = _ref8.items,
|
|
3521
|
-
item = _ref8.item,
|
|
3522
|
-
event = _ref8.event;
|
|
3523
|
-
return onElementUnselect(item, event);
|
|
3524
|
-
});
|
|
3525
|
-
}
|
|
3526
|
-
} // Useful methods for the user
|
|
3527
|
-
//////////////////////////////////////////////////////////////////////////////////////
|
|
3383
|
+
/**
|
|
3384
|
+
* Initializes the functionality. Automatically triggered when created.
|
|
3385
|
+
* Also, reset the functionality after a teardown
|
|
3386
|
+
*/
|
|
3528
3387
|
|
|
3529
|
-
/**
|
|
3530
|
-
* Initializes the functionality. Automatically triggered when created.
|
|
3531
|
-
* Also, reset the functionality after a teardown
|
|
3532
|
-
*/
|
|
3533
3388
|
|
|
3534
|
-
|
|
3389
|
+
_createClass(DragSelect, [{
|
|
3535
3390
|
key: "stop",
|
|
3536
3391
|
|
|
3537
3392
|
/**
|
|
@@ -3703,6 +3558,7 @@ var DragSelect = /*#__PURE__*/function () {
|
|
|
3703
3558
|
value: function setSelectables(elements) {
|
|
3704
3559
|
var removeFromSelection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3705
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)');
|
|
3706
3562
|
this.removeSelectables(elements, removeFromSelection);
|
|
3707
3563
|
return this.addSelectables(elements, addToSelection);
|
|
3708
3564
|
}
|
|
@@ -3723,29 +3579,6 @@ var DragSelect = /*#__PURE__*/function () {
|
|
|
3723
3579
|
}
|
|
3724
3580
|
/** The starting/initial position of the cursor/selector @return {Vect2} */
|
|
3725
3581
|
|
|
3726
|
-
}, {
|
|
3727
|
-
key: "getCursorPositionDifference",
|
|
3728
|
-
|
|
3729
|
-
/**
|
|
3730
|
-
* Utility method that returns the cursor position difference between start and now
|
|
3731
|
-
* @param {boolean} [usePreviousCursorDifference] if true, it will output the cursor position difference between the previous selection and now
|
|
3732
|
-
* @param {boolean} [useAreaPositions] if true, it will use cursor positions relative to the area
|
|
3733
|
-
* @return {Vect2}
|
|
3734
|
-
* @deprecated
|
|
3735
|
-
*/
|
|
3736
|
-
value: function getCursorPositionDifference() {
|
|
3737
|
-
var usePreviousCursorDifference = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
3738
|
-
var useAreaPositions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3739
|
-
console.warn('[DragSelect] Using .getCursorPositionDifference is deprecated. Calculate yourself instead. i.e. `.getCurrentCursorPosition().x - .getInitialCursorPosition().x`');
|
|
3740
|
-
var posA = useAreaPositions ? this.getCurrentCursorPositionArea() : this.getCurrentCursorPosition();
|
|
3741
|
-
var posB = usePreviousCursorDifference ? useAreaPositions ? this.getPreviousCursorPositionArea() : this.getPreviousCursorPosition() : useAreaPositions ? this.getInitialCursorPositionArea() : this.getInitialCursorPosition();
|
|
3742
|
-
return calc(posA, '-', posB);
|
|
3743
|
-
}
|
|
3744
|
-
/**
|
|
3745
|
-
* Whether the user is currently drag n dropping elements (instead of selection)
|
|
3746
|
-
* @return {boolean}
|
|
3747
|
-
*/
|
|
3748
|
-
|
|
3749
3582
|
}]);
|
|
3750
3583
|
|
|
3751
3584
|
return DragSelect;
|