dragselect 2.5.4 → 2.5.5

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.
@@ -64,9 +64,9 @@ export default class Area {
64
64
 
65
65
  this.setArea(this.DS.stores.SettingsStore.s.area)
66
66
  // @ts-ignore: @todo: update to typescript
67
- this.DS.PubSub.subscribe('Settings:updated:area', ({ settings }) =>
67
+ this.DS.PubSub.subscribe('Settings:updated:area', ({ settings }) => {
68
68
  this.setArea(settings.area)
69
- )
69
+ })
70
70
 
71
71
  this.DS.PubSub.subscribe('Interaction:init', this.start)
72
72
  this.DS.PubSub.subscribe('Interaction:end', this.reset)
@@ -74,6 +74,7 @@ export default class Area {
74
74
 
75
75
  /** @param {DSArea} area */
76
76
  setArea = (area) => {
77
+ this.reset()
77
78
  this._node = area
78
79
  handleElementPositionAttribute({
79
80
  computedStyle: this.computedStyle,
@@ -18,7 +18,10 @@ export default class Interaction {
18
18
  this.DS = DS
19
19
  this.Settings = DS.stores.SettingsStore.s
20
20
  // @ts-ignore: @todo: update to typescript
21
- this.DS.subscribe('Settings:updated:area', this.init)
21
+ this.DS.subscribe('Settings:updated:area', ({ settings }) => {
22
+ this.stop(settings['area:pre'])
23
+ this.init()
24
+ })
22
25
  this.DS.subscribe('PointerStore:updated', this.update)
23
26
  this.DS.subscribe('Selectable:click', this.onClick)
24
27
  this.DS.subscribe('Selectable:pointer', ({ event }) => this.start(event))
@@ -156,24 +159,24 @@ export default class Interaction {
156
159
  this.reset() // simulate mouse-up (that does not exist on keyboard)
157
160
  }
158
161
 
159
- stop = () => {
162
+ stop = (area = this.DS.Area.HTMLNode) => {
160
163
  this.isInteracting = false
161
164
  this.isDragging = false
162
165
 
163
166
  // @TODO: fix pointer events mixing issue see [PR](https://github.com/ThibaultJanBeyer/DragSelect/pull/128#issuecomment-1154885289)
164
167
  if (this.Settings.usePointerEvents) {
165
- this.DS.Area.HTMLNode.removeEventListener('pointerdown', this.start, {
168
+ area.removeEventListener('pointerdown', this.start, {
166
169
  // @ts-ignore
167
170
  passive: false,
168
171
  })
169
172
  document.removeEventListener('pointerup', this.reset)
170
173
  document.removeEventListener('pointercancel', this.reset)
171
174
  } else {
172
- this.DS.Area.HTMLNode.removeEventListener('mousedown', this.start)
175
+ area.removeEventListener('mousedown', this.start)
173
176
  document.removeEventListener('mouseup', this.reset)
174
177
  }
175
178
 
176
- this.DS.Area.HTMLNode.removeEventListener('touchstart', this.start, {
179
+ area.removeEventListener('touchstart', this.start, {
177
180
  // @ts-ignore
178
181
  passive: false,
179
182
  })
package/jsdoc.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "opts": {
3
- "template": "node_modules/minami",
4
- "destination": "./docs"
5
- },
6
- "source": {
7
- "include": ["./src", "./src/modules/PubSub.js", "./README.md"],
8
- "includePattern": "\\.(jsx|js|ts|tsx)$"
9
- },
10
- "plugins": [
11
- "node_modules/better-docs/typescript",
12
- "node_modules/better-docs/typedef-import"
13
- ],
14
- "tags": {
15
- "allowUnknownTags": ["optional"]
16
- },
17
- "sourceType": "module"
18
- }
package/todos.md DELETED
@@ -1,10 +0,0 @@
1
- # TODOs
2
- ### Zoom Drag
3
- - Dragging when the area is zoomed is wrong
4
- ## Drag and Drop
5
- #### Constrain direction
6
- - User can set in which direction the element can be dragged
7
- ### Add drop-zones
8
- A way to add zones in which elements can be dropped that also react on element changes
9
- ### Classes
10
- - Elements should get different classes based on their state