dragselect 2.2.1 → 2.3.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.
@@ -1,6 +1,6 @@
1
1
  /***
2
2
 
3
- ~~~ Version 2.2.1 ~~~
3
+ ~~~ Version 2.3.1 ~~~
4
4
 
5
5
  ******************************************
6
6
 
@@ -410,9 +410,9 @@ function _nonIterableRest() {
410
410
 
411
411
  /** @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
412
 
413
- /** @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'|'Drag:keyboardDrag:pre'} DSInternalEventNamesPre */
413
+ /** @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 */
414
414
 
415
- /** @typedef {DSEventNames|DSInternalEventNames} DSCallbackNames the name of the callback */
415
+ /** @typedef {DSEventNames|DSInternalEventNames|DSInternalEventNamesPre} DSCallbackNames the name of the callback */
416
416
 
417
417
  /** @typedef {{top:number,left:number,bottom:number,right:number,width:number,height:number}} DSBoundingRect */
418
418
 
@@ -1255,12 +1255,6 @@ var subscriberAliases = (function (_ref) {
1255
1255
  // event, isDraggingKeyboard
1256
1256
  'Interaction:end': [{
1257
1257
  name: 'callback'
1258
- }],
1259
- // event, isDraggingKeyboard
1260
- 'Drag:keyboardDrag': [{
1261
- name: 'dragstart'
1262
- }, {
1263
- name: 'dragmove'
1264
1258
  }] // event, isDraggingKeyboard
1265
1259
 
1266
1260
  };
@@ -1314,6 +1308,13 @@ var updateElementStylePos = (function (element, pos) {
1314
1308
  element.style.height = "".concat(pos.height, "px");
1315
1309
  });
1316
1310
 
1311
+ /**
1312
+ * @typedef {Object} AreaProps
1313
+ * @property {DSArea} area
1314
+ * @property {PubSub} PS
1315
+ * @property {number} zoom
1316
+ */
1317
+
1317
1318
  var Area = /*#__PURE__*/function () {
1318
1319
  /**
1319
1320
  * @type {DSModificationCallback}
@@ -1357,16 +1358,13 @@ var Area = /*#__PURE__*/function () {
1357
1358
 
1358
1359
  /**
1359
1360
  * @constructor Area
1360
- * @param {Object} obj
1361
- * @param {DSArea} obj.area
1362
- * @param {PubSub} obj.PS
1363
- * @param {number} obj.zoom
1361
+ * @param {AreaProps} settings
1364
1362
  * @ignore
1365
1363
  */
1366
1364
  function Area(_ref) {
1367
1365
  var _this = this;
1368
1366
 
1369
- var area = _ref.area,
1367
+ var _area = _ref.area,
1370
1368
  PS = _ref.PS,
1371
1369
  zoom = _ref.zoom;
1372
1370
 
@@ -1388,6 +1386,26 @@ var Area = /*#__PURE__*/function () {
1388
1386
 
1389
1387
  _defineProperty(this, "_rect", void 0);
1390
1388
 
1389
+ _defineProperty(this, "setArea", function (area) {
1390
+ _this._node = area;
1391
+ handleElementPositionAttribute({
1392
+ computedStyle: _this.computedStyle,
1393
+ node: _this._node
1394
+ }); // first immediate debounce to update values after dom-update
1395
+
1396
+ setTimeout(function () {
1397
+ _this.PubSub.publish('Area:modified:pre', {
1398
+ item: _this
1399
+ });
1400
+
1401
+ _this.reset();
1402
+
1403
+ _this.PubSub.publish('Area:modified', {
1404
+ item: _this
1405
+ });
1406
+ });
1407
+ });
1408
+
1391
1409
  _defineProperty(this, "start", function () {
1392
1410
  addModificationObservers(_this.parentNodes, _this._modificationCallback, _this._modificationObserver);
1393
1411
  });
@@ -1406,42 +1424,40 @@ var Area = /*#__PURE__*/function () {
1406
1424
  });
1407
1425
 
1408
1426
  _defineProperty(this, "scroll", function (directions, multiplier) {
1409
- scrollElement(_this._node, directions, multiplier);
1410
-
1411
- _this.PubSub.publish('Area:scroll', {
1427
+ var data = {
1412
1428
  scroll_directions: directions,
1413
1429
  scroll_multiplier: multiplier
1414
- });
1430
+ };
1431
+
1432
+ _this.PubSub.publish('Area:scroll:pre', data);
1433
+
1434
+ scrollElement(_this._node, directions, multiplier);
1435
+
1436
+ _this.PubSub.publish('Area:scroll', data);
1415
1437
  });
1416
1438
 
1417
- this._node = area;
1418
1439
  this._zoom = zoom;
1419
1440
  this.PubSub = PS;
1420
- handleElementPositionAttribute({
1421
- computedStyle: this.computedStyle,
1422
- node: this._node
1423
- });
1441
+ this.setArea(_area);
1424
1442
  this._modificationCallback = debounce(function (event) {
1425
- _this.reset();
1426
-
1427
- _this.PubSub.publish('Area:modified', {
1443
+ _this.PubSub.publish('Area:modified:pre', {
1428
1444
  event: event,
1429
1445
  item: _this
1430
1446
  });
1431
- }, 60);
1432
- this._modificationObserver = new MutationObserver(this._modificationCallback); // first immediate debounce to update values after dom-update
1433
1447
 
1434
- setTimeout(function () {
1435
1448
  _this.reset();
1436
1449
 
1437
1450
  _this.PubSub.publish('Area:modified', {
1438
1451
  event: event,
1439
1452
  item: _this
1440
1453
  });
1441
- });
1454
+ }, 60);
1455
+ this._modificationObserver = new MutationObserver(this._modificationCallback);
1442
1456
  this.PubSub.subscribe('Interaction:init', this.start);
1443
1457
  this.PubSub.subscribe('Interaction:end', this.reset);
1444
1458
  }
1459
+ /** @param {DSArea} area */
1460
+
1445
1461
 
1446
1462
  _createClass(Area, [{
1447
1463
  key: "HTMLNode",
@@ -1618,12 +1634,13 @@ var Drag = /*#__PURE__*/function () {
1618
1634
  var event = _ref2.event,
1619
1635
  key = _ref2.key;
1620
1636
  if (!_this._keyboardDrag || !_this._dragKeysFlat.includes(key) || !_this.DS.SelectedSet.size || !_this._draggability || _this.DS["continue"]) return;
1621
-
1622
- _this.DS.publish('Interaction:start', {
1637
+ var publishData = {
1623
1638
  event: event,
1624
1639
  isDragging: true,
1625
1640
  isDraggingKeyboard: true
1626
- });
1641
+ };
1642
+
1643
+ _this.DS.publish(['Interaction:start:pre', 'Interaction:start'], publishData);
1627
1644
 
1628
1645
  _this._elements = _this.DS.getSelection();
1629
1646
 
@@ -1649,23 +1666,20 @@ var Drag = /*#__PURE__*/function () {
1649
1666
  });
1650
1667
  });
1651
1668
 
1652
- _this.DS.publish('Interaction:update', {
1653
- event: event,
1654
- isDragging: true,
1655
- isDraggingKeyboard: true
1656
- });
1669
+ _this.DS.publish(['Interaction:update:pre', 'Interaction:update'], publishData);
1657
1670
  });
1658
1671
 
1659
1672
  _defineProperty(this, "keyboardEnd", function (_ref3) {
1660
1673
  var event = _ref3.event,
1661
1674
  key = _ref3.key;
1662
1675
  if (!_this._keyboardDrag || !_this._dragKeysFlat.includes(key) || !_this.DS.SelectedSet.size || !_this._draggability) return;
1663
-
1664
- _this.DS.publish('Interaction:end', {
1676
+ var publishData = {
1665
1677
  event: event,
1666
1678
  isDragging: _this._draggability,
1667
1679
  isDraggingKeyboard: true
1668
- });
1680
+ };
1681
+
1682
+ _this.DS.publish(['Interaction:end:pre', 'Interaction:end'], publishData);
1669
1683
  });
1670
1684
 
1671
1685
  _defineProperty(this, "start", function (_ref4) {
@@ -1782,6 +1796,11 @@ var Interaction = /*#__PURE__*/function () {
1782
1796
  * @private
1783
1797
  * */
1784
1798
 
1799
+ /**
1800
+ * @type {string}
1801
+ * @private
1802
+ * */
1803
+
1785
1804
  /** @type {boolean} */
1786
1805
 
1787
1806
  /** @type {boolean} */
@@ -1789,19 +1808,21 @@ var Interaction = /*#__PURE__*/function () {
1789
1808
  /**
1790
1809
  * @constructor Interaction
1791
1810
  * @param {Object} obj
1811
+ * @param {DragSelect} obj.DS
1792
1812
  * @param {DSArea} obj.areaElement
1793
1813
  * @param {boolean} obj.draggability
1794
1814
  * @param {boolean} obj.immediateDrag
1795
- * @param {DragSelect} obj.DS
1815
+ * @param {string} obj.selectableClass
1796
1816
  * @ignore
1797
1817
  */
1798
1818
  function Interaction(_ref) {
1799
1819
  var _this = this;
1800
1820
 
1801
- var areaElement = _ref.areaElement,
1802
- DS = _ref.DS,
1821
+ var DS = _ref.DS,
1822
+ areaElement = _ref.areaElement,
1803
1823
  draggability = _ref.draggability,
1804
- immediateDrag = _ref.immediateDrag;
1824
+ immediateDrag = _ref.immediateDrag,
1825
+ selectableClass = _ref.selectableClass;
1805
1826
 
1806
1827
  _classCallCheck(this, Interaction);
1807
1828
 
@@ -1811,11 +1832,17 @@ var Interaction = /*#__PURE__*/function () {
1811
1832
 
1812
1833
  _defineProperty(this, "_immediateDrag", void 0);
1813
1834
 
1835
+ _defineProperty(this, "_selectableClass", void 0);
1836
+
1814
1837
  _defineProperty(this, "isInteracting", void 0);
1815
1838
 
1816
1839
  _defineProperty(this, "isDragging", void 0);
1817
1840
 
1818
1841
  _defineProperty(this, "init", function () {
1842
+ return _this.DS.publish('Interaction:init:pre', {});
1843
+ });
1844
+
1845
+ _defineProperty(this, "_init", function () {
1819
1846
  _this.stop();
1820
1847
 
1821
1848
  _this._areaElement.addEventListener('mousedown', _this.start);
@@ -1828,6 +1855,13 @@ var Interaction = /*#__PURE__*/function () {
1828
1855
  });
1829
1856
 
1830
1857
  _defineProperty(this, "start", function (event) {
1858
+ return _this.DS.publish('Interaction:start:pre', {
1859
+ event: event,
1860
+ isDragging: _this.isDragging
1861
+ });
1862
+ });
1863
+
1864
+ _defineProperty(this, "_start", function (event) {
1831
1865
  if (event.type === 'touchstart') event.preventDefault(); // Call preventDefault() to prevent double click issue, see https://github.com/ThibaultJanBeyer/DragSelect/pull/29 & https://developer.mozilla.org/vi/docs/Web/API/Touch_events/Supporting_both_TouchEvent_and_MouseEvent
1832
1866
 
1833
1867
  if (!_this._canInteract(event)) return;
@@ -1844,21 +1878,24 @@ var Interaction = /*#__PURE__*/function () {
1844
1878
  });
1845
1879
 
1846
1880
  _defineProperty(this, "isDragEvent", function (event) {
1847
- if (!_this._draggability || _this.DS.stores.KeyStore.isMultiSelectKeyPressed(event) || !_this.DS.SelectableSet.has(event.target)) return false;
1881
+ var clickedElement =
1882
+ /** @type {Element} */
1883
+ event.target.closest(".".concat(_this._selectableClass));
1884
+ if (!_this._draggability || _this.DS.stores.KeyStore.isMultiSelectKeyPressed(event) || !clickedElement) return false;
1848
1885
 
1849
1886
  if (_this._immediateDrag) {
1850
1887
  if (!_this.DS.SelectedSet.size) _this.DS.SelectedSet.add(
1851
1888
  /** @type {DSElement} */
1852
- event.target);else if (!_this.DS.SelectedSet.has(event.target)) {
1889
+ clickedElement);else if (!_this.DS.SelectedSet.has(clickedElement)) {
1853
1890
  _this.DS.SelectedSet.clear();
1854
1891
 
1855
1892
  _this.DS.SelectedSet.add(
1856
1893
  /** @type {DSElement} */
1857
- event.target);
1894
+ clickedElement);
1858
1895
  }
1859
1896
  }
1860
1897
 
1861
- if (_this.DS.SelectedSet.has(event.target)) return true;
1898
+ if (_this.DS.SelectedSet.has(clickedElement)) return true;
1862
1899
  return false;
1863
1900
  });
1864
1901
 
@@ -1872,8 +1909,7 @@ var Interaction = /*#__PURE__*/function () {
1872
1909
  PointerStore = _this$DS$stores.PointerStore,
1873
1910
  KeyStore = _this$DS$stores.KeyStore,
1874
1911
  SelectableSet = _this$DS.SelectableSet,
1875
- SelectedSet = _this$DS.SelectedSet,
1876
- publish = _this$DS.publish;
1912
+ SelectedSet = _this$DS.SelectedSet;
1877
1913
  PointerStore.start(event);
1878
1914
  var node =
1879
1915
  /** @type {any} */
@@ -1881,10 +1917,9 @@ var Interaction = /*#__PURE__*/function () {
1881
1917
  if (!SelectableSet.has(node)) return;
1882
1918
  if (!KeyStore.isMultiSelectKeyPressed(event)) SelectedSet.clear();
1883
1919
  SelectedSet.toggle(node);
1884
- publish('Interaction:end', {
1885
- event: event,
1886
- isDragging: _this.isDragging
1887
- }); // simulate mouse-up (that does not exist on keyboard)
1920
+
1921
+ _this.reset(); // simulate mouse-up (that does not exist on keyboard)
1922
+
1888
1923
  });
1889
1924
 
1890
1925
  _defineProperty(this, "stop", function () {
@@ -1906,7 +1941,7 @@ var Interaction = /*#__PURE__*/function () {
1906
1941
  var event = _ref3.event,
1907
1942
  scroll_directions = _ref3.scroll_directions,
1908
1943
  scroll_multiplier = _ref3.scroll_multiplier;
1909
- if (_this.isInteracting) _this.DS.publish('Interaction:update', {
1944
+ if (_this.isInteracting) _this.DS.publish(['Interaction:update:pre', 'Interaction:update'], {
1910
1945
  event: event,
1911
1946
  scroll_directions: scroll_directions,
1912
1947
  scroll_multiplier: scroll_multiplier,
@@ -1915,6 +1950,13 @@ var Interaction = /*#__PURE__*/function () {
1915
1950
  });
1916
1951
 
1917
1952
  _defineProperty(this, "reset", function (event) {
1953
+ return _this.DS.publish('Interaction:end:pre', {
1954
+ event: event,
1955
+ isDragging: _this.isDragging
1956
+ });
1957
+ });
1958
+
1959
+ _defineProperty(this, "_reset", function (event) {
1918
1960
  var isDragging = _this.isDragging;
1919
1961
 
1920
1962
  _this.stop();
@@ -1930,6 +1972,7 @@ var Interaction = /*#__PURE__*/function () {
1930
1972
  this._areaElement = areaElement;
1931
1973
  this._draggability = draggability;
1932
1974
  this._immediateDrag = immediateDrag;
1975
+ this._selectableClass = selectableClass;
1933
1976
  this.DS = DS;
1934
1977
  this.DS.subscribe('PointerStore:updated', this.update);
1935
1978
  this.DS.subscribe('Selectable:click', this.onClick);
@@ -1937,19 +1980,41 @@ var Interaction = /*#__PURE__*/function () {
1937
1980
  var event = _ref4.event;
1938
1981
  return _this.start(event);
1939
1982
  });
1983
+ this.DS.subscribe('Interaction:start:pre', function (_ref5) {
1984
+ var event = _ref5.event;
1985
+ return _this._start(event);
1986
+ });
1987
+ this.DS.subscribe('Interaction:init:pre', this._init);
1988
+ this.DS.subscribe('Interaction:end:pre', function (_ref6) {
1989
+ var event = _ref6.event;
1990
+ return _this._reset(event);
1991
+ });
1940
1992
  this.DS.subscribe('Area:scroll', this.update);
1941
1993
  }
1942
1994
 
1943
1995
  _createClass(Interaction, [{
1944
1996
  key: "_canInteract",
1997
+
1998
+ /**
1999
+ * @param {DSEvent} event
2000
+ */
1945
2001
  value: function _canInteract(event) {
2002
+ var isKeyboardClick =
2003
+ /** @type {MouseEvent} */
2004
+ event.clientX === 0 &&
2005
+ /** @type {MouseEvent} */
2006
+ event.clientY === 0 &&
2007
+ /** @type {MouseEvent} */
2008
+ event.detail === 0 && event.target;
1946
2009
  if (
1947
- /* right-clicks */
1948
- event.button === 2 ||
1949
- /* fix double-click issues */
1950
- this.isInteracting ||
1951
- /* fix outside elements issue */
1952
- event.target && !this.DS.SelectorArea.isInside(event.target)) return false;
2010
+ /** @type {MouseEvent} */
2011
+ event.button === 2 || // right-clicks
2012
+ this.isInteracting || // fix double-click issues
2013
+ event.target && !this.DS.SelectorArea.isInside(
2014
+ /** @type {DSElement} */
2015
+ event.target) || //fix outside elements issue
2016
+ !isKeyboardClick && !this.DS.SelectorArea.isClicked(event) // make sure the mouse click is inside the area
2017
+ ) return false;
1953
2018
  return true;
1954
2019
  }
1955
2020
  /**
@@ -1961,9 +2026,11 @@ var Interaction = /*#__PURE__*/function () {
1961
2026
  return Interaction;
1962
2027
  }();
1963
2028
 
1964
- var PubSub = function PubSub() {
2029
+ var PubSub = function PubSub(_ref) {
1965
2030
  var _this = this;
1966
2031
 
2032
+ var DS = _ref.DS;
2033
+
1967
2034
  _classCallCheck(this, PubSub);
1968
2035
 
1969
2036
  _defineProperty(this, "subscribers", {});
@@ -1983,17 +2050,44 @@ var PubSub = function PubSub() {
1983
2050
  });
1984
2051
 
1985
2052
  _defineProperty(this, "publish", function (eventName, data) {
1986
- var _this$subscribers$, _this$subscribers$eve;
2053
+ if (Array.isArray(eventName)) eventName.forEach(function (name) {
2054
+ return _this._publish(name, data);
2055
+ });else _this._publish(eventName, data);
2056
+ });
1987
2057
 
1988
- if (!Array.isArray(_this.subscribers[eventName])) return;
1989
- (_this$subscribers$ = _this.subscribers["".concat(eventName, ":pre")]) === null || _this$subscribers$ === void 0 ? void 0 : _this$subscribers$.forEach(function (callback) {
1990
- return callback(data);
1991
- });
1992
- (_this$subscribers$eve = _this.subscribers[eventName]) === null || _this$subscribers$eve === void 0 ? void 0 : _this$subscribers$eve.forEach(function (callback) {
1993
- return callback(data);
1994
- });
2058
+ _defineProperty(this, "_publish", function (eventName, data) {
2059
+ var subscribers = _this.subscribers[eventName];
2060
+ if (!Array.isArray(subscribers)) return;
2061
+ if (eventName.includes(":pre")) _this._handlePrePublish(subscribers, data);else _this._handlePublish(subscribers, data);
1995
2062
  });
1996
- };
2063
+
2064
+ _defineProperty(this, "_handlePublish", function (subscribers, data) {
2065
+ for (var i = 0, il = subscribers.length; i < il; i++) {
2066
+ if (_this.DS.stopped) return;
2067
+ subscribers[i](data);
2068
+ }
2069
+ });
2070
+
2071
+ _defineProperty(this, "_handlePrePublish", function (subscribers, data) {
2072
+ var i = subscribers.length;
2073
+
2074
+ while (i--) {
2075
+ if (_this.DS.stopped) return;
2076
+ subscribers[i](data);
2077
+ }
2078
+ });
2079
+
2080
+ this.DS = DS;
2081
+ }
2082
+ /**
2083
+ * Subscribe to an event
2084
+ * @memberof DragSelect#
2085
+ * @function subscribe
2086
+ * @param {DSCallbackNames} eventName
2087
+ * @param {DSCallback} callback
2088
+ * @returns {number} event id, can be used to unsubscribe more efficiently
2089
+ */
2090
+ ;
1997
2091
 
1998
2092
  var SelectableSet = /*#__PURE__*/function (_Set) {
1999
2093
  _inherits(SelectableSet, _Set);
@@ -2073,13 +2167,13 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
2073
2167
  });
2074
2168
 
2075
2169
  _defineProperty(_assertThisInitialized(_this), "_onClick", function (event) {
2076
- return _this.DS.publish('Selectable:click', {
2170
+ return _this.DS.publish(['Selectable:click:pre', 'Selectable:click'], {
2077
2171
  event: event
2078
2172
  });
2079
2173
  });
2080
2174
 
2081
2175
  _defineProperty(_assertThisInitialized(_this), "_onPointer", function (event) {
2082
- return _this.DS.publish('Selectable:pointer', {
2176
+ return _this.DS.publish(['Selectable:pointer:pre', 'Selectable:pointer'], {
2083
2177
  event: event
2084
2178
  });
2085
2179
  });
@@ -2211,15 +2305,17 @@ var SelectedSet = /*#__PURE__*/function (_Set) {
2211
2305
  key: "add",
2212
2306
  value: function add(element) {
2213
2307
  if (_get(_getPrototypeOf(SelectedSet.prototype), "has", this).call(this, element)) return;
2308
+ var publishData = {
2309
+ items: this.elements,
2310
+ item: element
2311
+ };
2312
+ this.DS.publish('Selected:added:pre', publishData);
2214
2313
 
2215
2314
  _get(_getPrototypeOf(SelectedSet.prototype), "add", this).call(this, element);
2216
2315
 
2217
2316
  element.classList.add(this._className);
2218
- this.DS.publish('Selected:added', {
2219
- items: this.elements,
2220
- item: element
2221
- });
2222
2317
  element.style.zIndex = "".concat((parseInt(element.style.zIndex) || 0) + 1);
2318
+ this.DS.publish('Selected:added', publishData);
2223
2319
  return this;
2224
2320
  }
2225
2321
  /** @param {DSElement} element */
@@ -2228,15 +2324,17 @@ var SelectedSet = /*#__PURE__*/function (_Set) {
2228
2324
  key: "delete",
2229
2325
  value: function _delete(element) {
2230
2326
  if (!_get(_getPrototypeOf(SelectedSet.prototype), "has", this).call(this, element)) return;
2327
+ var publishData = {
2328
+ items: this.elements,
2329
+ item: element
2330
+ };
2331
+ this.DS.publish('Selected:removed:pre', publishData);
2231
2332
 
2232
2333
  var deleted = _get(_getPrototypeOf(SelectedSet.prototype), "delete", this).call(this, element);
2233
2334
 
2234
2335
  element.classList.remove(this._className);
2235
- this.DS.publish('Selected:removed', {
2236
- items: this.elements,
2237
- item: element
2238
- });
2239
2336
  element.style.zIndex = "".concat((parseInt(element.style.zIndex) || 0) - 1);
2337
+ this.DS.publish('Selected:removed', publishData);
2240
2338
  return deleted;
2241
2339
  }
2242
2340
  }, {
@@ -2338,6 +2436,7 @@ var Selection = /*#__PURE__*/function () {
2338
2436
 
2339
2437
  var multiSelectionToggle = _this.DS.stores.KeyStore.isMultiSelectKeyPressed(event) && _this._multiSelectToggling;
2340
2438
 
2439
+ if (_this.DS["continue"]) return;
2341
2440
  select.forEach(function (element) {
2342
2441
  return handleSelection({
2343
2442
  element: element,
@@ -2599,15 +2698,17 @@ var SelectorArea = /*#__PURE__*/function () {
2599
2698
 
2600
2699
  /**
2601
2700
  * checks if the click was triggered on the area.
2701
+ * @param {DSEvent} [event]
2602
2702
  * @returns {boolean}
2603
2703
  */
2604
- value: function isClicked() {
2704
+ value: function isClicked(event) {
2605
2705
  var PointerStore = this.DS.stores.PointerStore;
2706
+ var initialVal = event ? PointerStore.getPointerPosition(event) : PointerStore.initialVal;
2606
2707
  return isCollision({
2607
- left: PointerStore.initialVal.x,
2608
- top: PointerStore.initialVal.y,
2609
- right: PointerStore.initialVal.x,
2610
- bottom: PointerStore.initialVal.y
2708
+ left: initialVal.x,
2709
+ top: initialVal.y,
2710
+ right: initialVal.x,
2711
+ bottom: initialVal.y
2611
2712
  }, this.rect);
2612
2713
  }
2613
2714
  }, {
@@ -2678,6 +2779,11 @@ var KeyStore = /*#__PURE__*/function () {
2678
2779
  _defineProperty(this, "keydown", function (event) {
2679
2780
  var key = event.key.toLowerCase();
2680
2781
 
2782
+ _this.DS.publish('KeyStore:down:pre', {
2783
+ event: event,
2784
+ key: key
2785
+ });
2786
+
2681
2787
  _this._currentValues.add(key);
2682
2788
 
2683
2789
  _this.DS.publish('KeyStore:down', {
@@ -2689,6 +2795,11 @@ var KeyStore = /*#__PURE__*/function () {
2689
2795
  _defineProperty(this, "keyup", function (event) {
2690
2796
  var key = event.key.toLowerCase();
2691
2797
 
2798
+ _this.DS.publish('KeyStore:up:pre', {
2799
+ event: event,
2800
+ key: key
2801
+ });
2802
+
2692
2803
  _this._currentValues["delete"](key);
2693
2804
 
2694
2805
  _this.DS.publish('KeyStore:up', {
@@ -2835,11 +2946,20 @@ var PointerStore = /*#__PURE__*/function () {
2835
2946
  });
2836
2947
  });
2837
2948
 
2949
+ _defineProperty(this, "getPointerPosition", function (event) {
2950
+ return getPointerPos({
2951
+ event: _this._normalizedEvent(event)
2952
+ });
2953
+ });
2954
+
2838
2955
  _defineProperty(this, "update", function (event) {
2839
2956
  if (!event) return;
2840
- _this.currentVal = getPointerPos({
2841
- event: _this._normalizedEvent(event)
2957
+
2958
+ _this.DS.publish('PointerStore:updated:pre', {
2959
+ event: event
2842
2960
  });
2961
+
2962
+ _this.currentVal = _this.getPointerPosition(event);
2843
2963
  if (!_this._isMouseInteraction) return;
2844
2964
 
2845
2965
  _this.DS.publish('PointerStore:updated', {
@@ -2861,9 +2981,7 @@ var PointerStore = /*#__PURE__*/function () {
2861
2981
 
2862
2982
  _defineProperty(this, "reset", function (event) {
2863
2983
  if (!event) return;
2864
- _this.currentVal = _this.lastVal = getPointerPos({
2865
- event: _this._normalizedEvent(event)
2866
- });
2984
+ _this.currentVal = _this.lastVal = _this.getPointerPosition(event);
2867
2985
 
2868
2986
  _this.stop();
2869
2987
 
@@ -2889,11 +3007,9 @@ var PointerStore = /*#__PURE__*/function () {
2889
3007
  value: function start(event) {
2890
3008
  if (!event) return;
2891
3009
  this._isMouseInteraction = true;
2892
- this.currentVal = this.initialVal = getPointerPos({
2893
- event: this._normalizedEvent(event)
2894
- });
3010
+ this.currentVal = this.initialVal = this.getPointerPosition(event);
2895
3011
  }
2896
- /** @param {DSEvent} [event] */
3012
+ /** @param {DSEvent} event */
2897
3013
 
2898
3014
  }, {
2899
3015
  key: "_normalizedEvent",
@@ -3185,7 +3301,9 @@ var DragSelect = /*#__PURE__*/function () {
3185
3301
  _defineProperty(this, "continue", false);
3186
3302
 
3187
3303
  _defineProperty(this, "start", function () {
3188
- return _this.Interaction.init();
3304
+ _this.stopped = false;
3305
+
3306
+ _this.Interaction.init();
3189
3307
  });
3190
3308
 
3191
3309
  _defineProperty(this, "break", function () {
@@ -3232,7 +3350,9 @@ var DragSelect = /*#__PURE__*/function () {
3232
3350
  return _this.Interaction.isDragging;
3233
3351
  });
3234
3352
 
3235
- this.PubSub = new PubSub();
3353
+ this.PubSub = new PubSub({
3354
+ DS: this
3355
+ });
3236
3356
  this.subscribe = this.PubSub.subscribe;
3237
3357
  this.unsubscribe = this.PubSub.unsubscribe;
3238
3358
  this.publish = this.PubSub.publish;
@@ -3313,7 +3433,8 @@ var DragSelect = /*#__PURE__*/function () {
3313
3433
  areaElement: area,
3314
3434
  DS: this,
3315
3435
  draggability: draggability,
3316
- immediateDrag: immediateDrag
3436
+ immediateDrag: immediateDrag,
3437
+ selectableClass: selectableClass
3317
3438
  }); // Subscriber Aliases
3318
3439
 
3319
3440
  subscriberAliases({
@@ -3437,6 +3558,7 @@ var DragSelect = /*#__PURE__*/function () {
3437
3558
  this.stores.ScrollStore.stop();
3438
3559
  if (remove) this.SelectableSet.clear();
3439
3560
  if (fromSelection) this.SelectedSet.clear();
3561
+ this.stopped = true;
3440
3562
  }
3441
3563
  /**
3442
3564
  * Utility to override DragSelect internal functionality: