dragselect 2.4.2 → 2.4.4

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 CHANGED
@@ -1,6 +1,14 @@
1
+ # 2.4.4
2
+
3
+ - Add support for `pointerEvents` (from @HollowMan6) [#143](https://github.com/ThibaultJanBeyer/DragSelect/pull/143) & [#128](https://github.com/ThibaultJanBeyer/DragSelect/pull/128)
4
+
5
+ # 2.4.3
6
+
7
+ - add `triggerCallback` option to `removeSelectables` and `addSelectables`
8
+
1
9
  # 2.4.2
2
10
 
3
- - Add Selecrables events/topics for add/delete
11
+ - Add Selecrables events/topics for add/delete: `Selectable:added` & `Selectable:added:pre` & `Selectable:removed` & `Selectable:removed:pre`
4
12
 
5
13
  # 2.4.0-1
6
14
 
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  [GitHub](https://github.com/ThibaultJanBeyer/DragSelect/) | [NPM](https://www.npmjs.com/package/dragselect) | [Project-Page](https://dragselect.com/)
11
11
 
12
- [![Build Status](https://travis-ci.com/ThibaultJanBeyer/DragSelect.svg?branch=master)](https://travis-ci.com/ThibaultJanBeyer/DragSelect) ![gzip size](https://img.badgesize.io/https://dragselect.com/v2/ds.min.js?compression=gzip) ![npm downloads count](https://img.shields.io/npm/dt/dragselect.svg) [![No Dependency](https://img.shields.io/badge/dependencies-none-informational)](https://github.com/ThibaultJanBeyer/DragSelect/blob/master/package.json) [![Contributors Welcome](https://img.shields.io/badge/contributors-welcome-blueviolet)](https://github.com/ThibaultJanBeyer/DragSelect/blob/master/CONTRIBUTING.md) [![Sponsors Welcome](https://img.shields.io/badge/sponsors-welcome-blueviolet)](https://github.com/sponsors/ThibaultJanBeyer)
12
+ [![Build Status](https://github.com/ThibaultJanBeyer/DragSelect/actions/workflows/github-actions-build.yml/badge.svg)](https://github.com/ThibaultJanBeyer/DragSelect/actions) ![gzip size](https://img.badgesize.io/https://dragselect.com/v2/ds.min.js?compression=gzip) ![npm downloads count](https://img.shields.io/npm/dt/dragselect.svg) [![No Dependency](https://img.shields.io/badge/dependencies-none-informational)](https://github.com/ThibaultJanBeyer/DragSelect/blob/master/package.json) [![Contributors Welcome](https://img.shields.io/badge/contributors-welcome-blueviolet)](https://github.com/ThibaultJanBeyer/DragSelect/blob/master/CONTRIBUTING.md) [![Sponsors Welcome](https://img.shields.io/badge/sponsors-welcome-blueviolet)](https://github.com/sponsors/ThibaultJanBeyer)
13
13
 
14
14
  # DragSelect ![GitHub package.json version](https://img.shields.io/github/package-json/v/ThibaultJanBeyer/DragSelect.svg)
15
15
  easily add a selection algorithm to your application/website.
@@ -20,20 +20,32 @@ easily add a selection algorithm to your application/website.
20
20
  - [Key-Features](#key-features)
21
21
  - [Why?](#why)
22
22
  - [Supporters](#supporters)
23
+ - [Thanks to:](#thanks-to)
23
24
  - [Installation](#installation)
25
+ - [NPM](#npm)
26
+ - [Yarn](#yarn)
27
+ - [Global](#global)
28
+ - [Bower (deprecated)](#bower-deprecated)
29
+ - [That's it, you're ready to rock!](#thats-it-youre-ready-to-rock)
24
30
  - [Usage](#usage)
25
- - - [Simple](#simple)
26
- - - [Within a scroll-able Area](#within-a-scroll-able-area)
27
- - - [Extended](#extended)
28
- - - [Mobile Touch usage](#mobiletouch-usage)
29
- - - [Accessibility (a11y)](#accessibility-a11y)
30
- - - [Use your own Drag And Drop](#use-your-own-drag-and-drop)
31
- - [Constructor Properties (Settings)](#constructor-properties-settings)
32
- - - [Post initialization setting updates](#post-initialization-setting-updates)
31
+ - [Simple](#simple)
32
+ - [Within a scroll-able Area](#within-a-scroll-able-area)
33
+ - [Extended](#extended)
34
+ - [Mobile/Touch usage](#mobiletouch-usage)
35
+ - [Accessibility (a11y)](#accessibility-a11y)
36
+ - [Use your own Drag And Drop](#use-your-own-drag-and-drop)
37
+ - [Using another plugin/tool (3rd party)](#using-another-plugintool-3rd-party)
38
+ - [Example](#example)
39
+ - [Writing a fully custom solution](#writing-a-fully-custom-solution)
40
+ - [Example](#example-1)
41
+ - [Constructor Properties (Settings):](#constructor-properties-settings)
42
+ - [Post-Initialization Setting-Updates](#post-initialization-setting-updates)
33
43
  - [Event Callbacks](#event-callbacks)
34
- - - [Callback Object Keys](#callback-object-keys)
35
- - [Methods](#methods)
44
+ - [Events](#events)
45
+ - [Callback Object Keys](#callback-object-keys)
46
+ - [Methods:](#methods)
36
47
  - [Classes](#classes)
48
+ - [Have Fun!](#have-fun)
37
49
 
38
50
  # Project Page: Demo & Info
39
51
 
@@ -289,6 +301,7 @@ Here is the full list:
289
301
  |hoverClass |string |The class name assigned to the mouse hovered items. |[see classes](#classes)
290
302
  |selectorClass |string |The class name assigned to the square selector helper. |[see classes](#classes)
291
303
  |selectableClass |string |The class name assigned to the elements that can be selected. |[see classes](#classes)
304
+ |usePointerEvents |boolean |Whether to use Pointer Events to replace traditional Mouse or Touch Events. Useful for tools like Google Blockly. |`false`
292
305
 
293
306
  ## Post-Initialization Setting-Updates
294
307
 
package/deploying.md CHANGED
@@ -14,7 +14,7 @@ if you are a regular contributor, see [contibuting](CONTRIBUTING.md) and make a
14
14
  Typically you don’t have to do this, since you most likely are not the project owner.
15
15
  But if you are the project owner:
16
16
 
17
- - Travis will take care of deployment to gh-pages when you push/merge to github (gh-pages will be build by Travis)
17
+ - Github Actions will take care of deployment to gh-pages when you push/merge to github main branch (gh-pages will be build by Github Actions)
18
18
 
19
19
  If this was successful, the next step is to publish the new version on `npm`:
20
20
 
@@ -101,9 +101,10 @@ declare class DragSelect {
101
101
  * Add elements that can be selected. No node is added twice
102
102
  * @param {DSInputElements} elements dom element(s)
103
103
  * @param {boolean} [addToSelection] if elements should also be added to current selection
104
+ * @param {boolean} [triggerCallback] - if callback should be called
104
105
  * @return {DSInputElements} the added element(s)
105
106
  */
106
- addSelectables(elements: DSInputElements, addToSelection?: boolean): DSInputElements;
107
+ addSelectables(elements: DSInputElements, addToSelection?: boolean, triggerCallback?: boolean): DSInputElements;
107
108
  /**
108
109
  * Gets all nodes that can potentially be selected
109
110
  * @return {DSElements} this.selectables
@@ -123,9 +124,10 @@ declare class DragSelect {
123
124
  * Remove elements from the elements that can be selected.
124
125
  * @param {DSInputElements} elements – dom element(s)
125
126
  * @param {boolean} [removeFromSelection] if elements should also be removed from current selection
127
+ * @param {boolean} [triggerCallback] - if callback should be called
126
128
  * @return {DSInputElements} the removed element(s)
127
129
  */
128
- removeSelectables(elements: DSInputElements, removeFromSelection?: boolean): DSInputElements;
130
+ removeSelectables(elements: DSInputElements, removeFromSelection?: boolean, triggerCallback?: boolean): DSInputElements;
129
131
  /** The starting/initial position of the cursor/selector @return {Vect2} */
130
132
  getInitialCursorPosition: () => Vect2;
131
133
  /** The last seen position of the cursor/selector @return {Vect2} */
@@ -1,6 +1,6 @@
1
1
  /***
2
2
 
3
- ~~~ Version 2.4.2 ~~~
3
+ ~~~ Version 2.4.4 ~~~
4
4
 
5
5
  ******************************************
6
6
 
@@ -355,6 +355,7 @@ function _nonIterableRest() {
355
355
  * @property {DSDragKeys} [dragKeys={up:['ArrowUp'],down:['ArrowDown'],left:['ArrowLeft'],righ:['ArrowRight']}] The keys available to drag element using the keyboard.
356
356
  * @property {number} [keyboardDragSpeed=10] The speed at which elements are dragged using the keyboard. In pixels per keydown.
357
357
  * @property {boolean} [useTransform=true] Whether to use hardware accelerated css transforms when dragging or top/left instead
358
+ * @property {boolean} [usePointerEvents=false] Whether to use Pointer Events to replace traditional Mouse or Touch Events. Useful for tools like Google Blockly.
358
359
  * @property {string} [hoverClass=ds-hover] the class assigned to the mouse hovered items
359
360
  * @property {string} [selectableClass=ds-selectable] the class assigned to the elements that can be selected
360
361
  * @property {string} [selectedClass=ds-selected] the class assigned to the selected items
@@ -366,7 +367,7 @@ function _nonIterableRest() {
366
367
  * The Object that is passed back to any callback method
367
368
  * @typedef {Object} CallbackObject
368
369
  * @property {Array<HTMLElement|SVGElement|any>} [items] The items currently selected
369
- * @property {MouseEvent|TouchEvent|KeyboardEvent|Event} [event] The respective event object
370
+ * @property {MouseEvent|TouchEvent|PointerEvent|KeyboardEvent|Event} [event] The respective event object
370
371
  * @property {HTMLElement|SVGElement|any} [item] The single item currently interacted with
371
372
  * @property {boolean} [isDragging] Whether the interaction is a drag or a select
372
373
  * @property {boolean} [isDraggingKeyboard] Whether or not the drag interaction is via keyboard
@@ -397,7 +398,7 @@ function _nonIterableRest() {
397
398
 
398
399
  /** @typedef {HTMLElement|SVGElement} DSElement a single element that can be selected */
399
400
 
400
- /** @typedef {MouseEvent|TouchEvent} DSEvent en event from a touch or mouse interaction */
401
+ /** @typedef {MouseEvent|TouchEvent|PointerEvent} DSEvent en event from a touch or mouse interaction */
401
402
 
402
403
  /** @typedef {Array.<'Shift'|'Control'|'Meta'|string>} DSMultiSelectKeys An array of keys that allows switching to the multi-select mode */
403
404
 
@@ -693,7 +694,7 @@ var getOverflowEdges = (function (_ref) {
693
694
  /**
694
695
  * Returns cursor x, y position based on event object
695
696
  * @param {Object} p
696
- * @param {MouseEvent|Touch} p.event
697
+ * @param {MouseEvent|Touch|PointerEvent} p.event
697
698
  * @return {Vect2} cursor X/Y position
698
699
  */
699
700
 
@@ -1159,7 +1160,7 @@ var hydrateHelper = function hydrateHelper(key, value, withFallback, fallback) {
1159
1160
 
1160
1161
 
1161
1162
  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
+ return _objectSpread2(_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
1164
  x: 25,
1164
1165
  y: 25
1165
1166
  })), 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, {
@@ -1167,7 +1168,7 @@ var hydrateSettings = (function (settings, withFallback) {
1167
1168
  down: ['ArrowDown'],
1168
1169
  left: ['ArrowLeft'],
1169
1170
  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
+ })), hydrateHelper('keyboardDragSpeed', settings.keyboardDragSpeed, withFallback, 10)), hydrateHelper('useTransform', settings.useTransform, withFallback, true)), hydrateHelper('usePointerEvents', settings.usePointerEvents, withFallback, false)), 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
  });
1172
1173
 
1173
1174
  // @ts-check
@@ -1865,9 +1866,12 @@ var Interaction = /*#__PURE__*/function () {
1865
1866
  });
1866
1867
 
1867
1868
  _defineProperty(this, "_init", function () {
1868
- _this.stop();
1869
+ _this.stop(); // @TODO: fix pointer events mixing issue see [PR](https://github.com/ThibaultJanBeyer/DragSelect/pull/128#issuecomment-1154885289)
1870
+
1869
1871
 
1870
- _this.DS.Area.HTMLNode.addEventListener('mousedown', _this.start);
1872
+ if (_this.Settings.usePointerEvents) _this.DS.Area.HTMLNode.addEventListener('pointerdown', _this.start, {
1873
+ passive: false
1874
+ });else _this.DS.Area.HTMLNode.addEventListener('mousedown', _this.start);
1871
1875
 
1872
1876
  _this.DS.Area.HTMLNode.addEventListener('touchstart', _this.start, {
1873
1877
  passive: false
@@ -1893,19 +1897,24 @@ var Interaction = /*#__PURE__*/function () {
1893
1897
  _this.DS.publish('Interaction:start', {
1894
1898
  event: event,
1895
1899
  isDragging: _this.isDragging
1896
- });
1900
+ }); // @TODO: fix pointer events mixing issue see [PR](https://github.com/ThibaultJanBeyer/DragSelect/pull/128#issuecomment-1154885289)
1901
+
1902
+
1903
+ if (_this.Settings.usePointerEvents) {
1904
+ document.addEventListener('pointerup', _this.reset);
1905
+ document.addEventListener('pointercancel', _this.reset);
1906
+ } else document.addEventListener('mouseup', _this.reset);
1897
1907
 
1898
- document.addEventListener('mouseup', _this.reset);
1899
1908
  document.addEventListener('touchend', _this.reset);
1900
1909
  });
1901
1910
 
1902
1911
  _defineProperty(this, "isDragEvent", function (event) {
1903
1912
  var clickedElement =
1904
1913
  /** @type {Element} */
1905
- event.target.closest(".".concat(_this.DS.stores.SettingsStore.s.selectableClass));
1906
- if (!_this.DS.stores.SettingsStore.s.draggability || _this.DS.stores.KeyStore.isMultiSelectKeyPressed(event) || !clickedElement) return false;
1914
+ event.target.closest(".".concat(_this.Settings.selectableClass));
1915
+ if (!_this.Settings.draggability || _this.DS.stores.KeyStore.isMultiSelectKeyPressed(event) || !clickedElement) return false;
1907
1916
 
1908
- if (_this.DS.stores.SettingsStore.s.immediateDrag) {
1917
+ if (_this.Settings.immediateDrag) {
1909
1918
  if (!_this.DS.SelectedSet.size) _this.DS.SelectedSet.add(
1910
1919
  /** @type {DSElement} */
1911
1920
  clickedElement);else if (!_this.DS.SelectedSet.has(clickedElement)) {
@@ -1946,16 +1955,27 @@ var Interaction = /*#__PURE__*/function () {
1946
1955
 
1947
1956
  _defineProperty(this, "stop", function () {
1948
1957
  _this.isInteracting = false;
1949
- _this.isDragging = false;
1958
+ _this.isDragging = false; // @TODO: fix pointer events mixing issue see [PR](https://github.com/ThibaultJanBeyer/DragSelect/pull/128#issuecomment-1154885289)
1959
+
1960
+ if (_this.Settings.usePointerEvents) {
1961
+ _this.DS.Area.HTMLNode.removeEventListener('pointerdown', _this.start, {
1962
+ // @ts-ignore
1963
+ passive: false
1964
+ });
1950
1965
 
1951
- _this.DS.Area.HTMLNode.removeEventListener('mousedown', _this.start);
1966
+ document.removeEventListener('pointerup', _this.reset);
1967
+ document.removeEventListener('pointercancel', _this.reset);
1968
+ } else {
1969
+ _this.DS.Area.HTMLNode.removeEventListener('mousedown', _this.start);
1970
+
1971
+ document.removeEventListener('mouseup', _this.reset);
1972
+ }
1952
1973
 
1953
1974
  _this.DS.Area.HTMLNode.removeEventListener('touchstart', _this.start, {
1954
1975
  // @ts-ignore
1955
1976
  passive: false
1956
1977
  });
1957
1978
 
1958
- document.removeEventListener('mouseup', _this.reset);
1959
1979
  document.removeEventListener('touchend', _this.reset);
1960
1980
  });
1961
1981
 
@@ -1991,7 +2011,8 @@ var Interaction = /*#__PURE__*/function () {
1991
2011
  });
1992
2012
  });
1993
2013
 
1994
- this.DS = DS; // @ts-ignore: @todo: update to typescript
2014
+ this.DS = DS;
2015
+ this.Settings = DS.stores.SettingsStore.s; // @ts-ignore: @todo: update to typescript
1995
2016
 
1996
2017
  this.DS.subscribe('Settings:updated:area', this.init);
1997
2018
  this.DS.subscribe('PointerStore:updated', this.update);
@@ -2129,7 +2150,7 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
2129
2150
  _this = _super.call(this);
2130
2151
 
2131
2152
  _defineProperty(_assertThisInitialized(_this), "init", function () {
2132
- return toArray(_this.DS.stores.SettingsStore.s.selectables).forEach(function (el) {
2153
+ return toArray(_this.Settings.selectables).forEach(function (el) {
2133
2154
  return _this.add(el);
2134
2155
  });
2135
2156
  });
@@ -2165,6 +2186,7 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
2165
2186
  });
2166
2187
 
2167
2188
  _this.DS = DS;
2189
+ _this.Settings = DS.stores.SettingsStore.s;
2168
2190
 
2169
2191
  _this.DS.subscribe('Interaction:init', _this.init); // @ts-ignore: @todo: update to typescript
2170
2192
 
@@ -2199,14 +2221,17 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
2199
2221
  item: element
2200
2222
  };
2201
2223
  this.DS.publish('Selectable:added:pre', publishData);
2202
- element.classList.add(this.DS.stores.SettingsStore.s.selectableClass);
2224
+ element.classList.add(this.Settings.selectableClass);
2203
2225
  element.addEventListener('click', this._onClick);
2204
- element.addEventListener('mousedown', this._onPointer);
2226
+ if (this.Settings.usePointerEvents) element.addEventListener('pointerdown', this._onPointer, {
2227
+ // @ts-ignore
2228
+ passive: false
2229
+ });else element.addEventListener('mousedown', this._onPointer);
2205
2230
  element.addEventListener('touchstart', this._onPointer, {
2206
2231
  // @ts-ignore
2207
2232
  passive: false
2208
2233
  });
2209
- if (this.DS.stores.SettingsStore.s.draggability && !this.DS.stores.SettingsStore.s.useTransform) handleElementPositionAttribute({
2234
+ if (this.Settings.draggability && !this.Settings.useTransform) handleElementPositionAttribute({
2210
2235
  computedStyle: window.getComputedStyle(element),
2211
2236
  node: element
2212
2237
  });
@@ -2224,10 +2249,13 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
2224
2249
  item: element
2225
2250
  };
2226
2251
  this.DS.publish('Selectable:removed:pre', publishData);
2227
- element.classList.remove(this.DS.stores.SettingsStore.s.selectableClass);
2228
- element.classList.remove(this.DS.stores.SettingsStore.s.hoverClass);
2252
+ element.classList.remove(this.Settings.selectableClass);
2253
+ element.classList.remove(this.Settings.hoverClass);
2229
2254
  element.removeEventListener('click', this._onClick);
2230
- element.removeEventListener('mousedown', this._onPointer);
2255
+ if (this.Settings.usePointerEvents) element.removeEventListener('pointerdown', this._onPointer, {
2256
+ // @ts-ignore
2257
+ passive: false
2258
+ });else element.removeEventListener('mousedown', this._onPointer);
2231
2259
  element.removeEventListener('touchstart', this._onPointer, {
2232
2260
  // @ts-ignore
2233
2261
  passive: false
@@ -2786,7 +2814,7 @@ var KeyStore = /*#__PURE__*/function () {
2786
2814
  _createClass(KeyStore, [{
2787
2815
  key: "isMultiSelectKeyPressed",
2788
2816
 
2789
- /** @param {KeyboardEvent|MouseEvent|TouchEvent} [event] */
2817
+ /** @param {KeyboardEvent|MouseEvent|PointerEvent|TouchEvent} [event] */
2790
2818
  value: function isMultiSelectKeyPressed(event) {
2791
2819
  var _this2 = this;
2792
2820
 
@@ -2882,7 +2910,10 @@ var PointerStore = /*#__PURE__*/function () {
2882
2910
  _defineProperty(this, "_lastTouch", void 0);
2883
2911
 
2884
2912
  _defineProperty(this, "init", function () {
2885
- document.addEventListener('mousemove', _this.update);
2913
+ if (_this.Settings.usePointerEvents) document.addEventListener('pointermove', _this.update, {
2914
+ // @ts-ignore
2915
+ passive: false
2916
+ });else document.addEventListener('mousemove', _this.update);
2886
2917
  document.addEventListener('touchmove', _this.update, {
2887
2918
  // @ts-ignore
2888
2919
  passive: false
@@ -2911,7 +2942,11 @@ var PointerStore = /*#__PURE__*/function () {
2911
2942
  });
2912
2943
 
2913
2944
  _defineProperty(this, "stop", function () {
2914
- document.removeEventListener('mousemove', _this.update);
2945
+ // @TODO: fix pointer events mixing issue see [PR](https://github.com/ThibaultJanBeyer/DragSelect/pull/128#issuecomment-1154885289)
2946
+ if (_this.Settings.usePointerEvents) document.removeEventListener('pointermove', _this.update, {
2947
+ // @ts-ignore
2948
+ passive: false
2949
+ });else document.removeEventListener('mousemove', _this.update);
2915
2950
  document.removeEventListener('touchmove', _this.update, {
2916
2951
  // @ts-ignore
2917
2952
  passive: false
@@ -2932,6 +2967,7 @@ var PointerStore = /*#__PURE__*/function () {
2932
2967
  });
2933
2968
 
2934
2969
  this.DS = DS;
2970
+ this.Settings = DS.stores.SettingsStore.s;
2935
2971
  this.DS.subscribe('Interaction:init', this.init);
2936
2972
  this.DS.subscribe('Interaction:start', function (_ref2) {
2937
2973
  var event = _ref2.event;
@@ -2959,7 +2995,7 @@ var PointerStore = /*#__PURE__*/function () {
2959
2995
 
2960
2996
  /**
2961
2997
  * @param {DSEvent} event
2962
- * @return {MouseEvent|Touch}
2998
+ * @return {MouseEvent|PointerEvent|Touch}
2963
2999
  * @private
2964
3000
  */
2965
3001
  value: function _normalizedEvent(event) {
@@ -3540,16 +3576,19 @@ var DragSelect = /*#__PURE__*/function () {
3540
3576
  * Add elements that can be selected. No node is added twice
3541
3577
  * @param {DSInputElements} elements dom element(s)
3542
3578
  * @param {boolean} [addToSelection] if elements should also be added to current selection
3579
+ * @param {boolean} [triggerCallback] - if callback should be called
3543
3580
  * @return {DSInputElements} the added element(s)
3544
3581
  */
3545
3582
 
3546
3583
  }, {
3547
3584
  key: "addSelectables",
3548
- value: function addSelectables(elements) {
3549
- var addToSelection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3585
+ value: function addSelectables(elements, addToSelection, triggerCallback) {
3550
3586
  var els = toArray(elements);
3551
3587
  this.SelectableSet.addAll(els);
3552
3588
  if (addToSelection) this.SelectedSet.addAll(els);
3589
+ if (triggerCallback) this.PubSub.publish('callback', {
3590
+ items: this.getSelection()
3591
+ });
3553
3592
  return elements;
3554
3593
  }
3555
3594
  /**
@@ -3580,15 +3619,18 @@ var DragSelect = /*#__PURE__*/function () {
3580
3619
  * Remove elements from the elements that can be selected.
3581
3620
  * @param {DSInputElements} elements – dom element(s)
3582
3621
  * @param {boolean} [removeFromSelection] if elements should also be removed from current selection
3622
+ * @param {boolean} [triggerCallback] - if callback should be called
3583
3623
  * @return {DSInputElements} the removed element(s)
3584
3624
  */
3585
3625
 
3586
3626
  }, {
3587
3627
  key: "removeSelectables",
3588
- value: function removeSelectables(elements) {
3589
- var removeFromSelection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3628
+ value: function removeSelectables(elements, removeFromSelection, triggerCallback) {
3590
3629
  this.SelectableSet.deleteAll(toArray(elements));
3591
3630
  if (removeFromSelection) this.removeSelection(elements);
3631
+ if (triggerCallback) this.PubSub.publish('callback', {
3632
+ items: this.getSelection()
3633
+ });
3592
3634
  return elements;
3593
3635
  }
3594
3636
  /** The starting/initial position of the cursor/selector @return {Vect2} */