@neo4j-nvl/interaction-handlers 1.0.0-e90ba568 → 1.0.0-ea46e3c1

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.
@@ -65,7 +65,7 @@ declare abstract class BaseInteraction<T extends Record<string, ((...args: unkno
65
65
  * @param enable - Whether to enable or disable global text selection.
66
66
  * @param eventFunction - The event function to be added/removed when text selection is disabled/enabled.
67
67
  */
68
- toggleGlobalTextSelection: (enable: boolean, eventFunction?: ((this: HTMLElement, ev: MouseEvent) => void) | undefined) => void;
68
+ toggleGlobalTextSelection: (enable: boolean, eventFunction?: (this: HTMLElement, ev: MouseEvent) => void) => void;
69
69
  /**
70
70
  * @internal
71
71
  * @hidden
@@ -26,19 +26,17 @@ export class DragNodeInteraction extends BaseInteraction {
26
26
  }
27
27
  handleMouseDown = (event) => {
28
28
  this.mousePosition = { x: event.clientX, y: event.clientY };
29
+ this.mouseDownNode = null;
29
30
  const hits = this.nvlInstance.getHits(event, ['node'], { hitNodeMarginWidth: NODE_EDGE_WIDTH });
30
31
  const hitNodes = hits.nvlTargets.nodes.filter((node) => node.insideNode);
31
32
  const hitNodeEdges = hits.nvlTargets.nodes.filter((node) => !node.insideNode);
32
33
  if (hitNodeEdges.length > 0) {
33
34
  this.isDrawing = true;
34
- this.mouseDownNode = null;
35
35
  this.addEventListener('mouseup', this.resetState, { once: true });
36
36
  }
37
37
  else if (hitNodes.length > 0) {
38
38
  this.mouseDownNode = hits.nvlTargets.nodes[0] ?? null;
39
- }
40
- else {
41
- this.mouseDownNode = null;
39
+ this.toggleGlobalTextSelection(false, this.handleBodyMouseUp);
42
40
  }
43
41
  this.selectedNodes = this.nvlInstance.getSelectedNodes();
44
42
  if (this.mouseDownNode !== null && this.selectedNodes.map((node) => node.id).includes(this.mouseDownNode.data.id)) {
@@ -57,7 +55,6 @@ export class DragNodeInteraction extends BaseInteraction {
57
55
  return;
58
56
  }
59
57
  if (!this.isDragging) {
60
- this.toggleGlobalTextSelection(false, this.handleBodyMouseUp);
61
58
  if (this.moveSelectedNodes) {
62
59
  this.callCallbackIfRegistered('onDragStart', this.selectedNodes, evt);
63
60
  }
@@ -95,9 +92,7 @@ export class DragNodeInteraction extends BaseInteraction {
95
92
  this.callCallbackIfRegistered('onDragEnd', [this.mouseDownNode.data], evt);
96
93
  }
97
94
  }
98
- if (this.isDragging) {
99
- this.resetState();
100
- }
95
+ this.resetState();
101
96
  };
102
97
  resetState = () => {
103
98
  this.isDragging = false;
@@ -57,7 +57,7 @@ export declare class PanInteraction extends BaseInteraction<PanInteractionCallba
57
57
  * panInteraction.updateTargets([], true)
58
58
  * ```
59
59
  */
60
- updateTargets: (targets: ('node' | 'relationship')[], excludeNodeMargin: boolean) => void;
60
+ updateTargets: (targets: ("node" | "relationship")[], excludeNodeMargin: boolean) => void;
61
61
  private handleMouseDown;
62
62
  private handleMouseMove;
63
63
  private handleMouseUp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-nvl/interaction-handlers",
3
- "version": "1.0.0-e90ba568",
3
+ "version": "1.0.0-ea46e3c1",
4
4
  "license": "SEE LICENSE IN 'LICENSE.txt'",
5
5
  "homepage": "https://neo4j.com/docs/nvl/current/",
6
6
  "description": "Interaction handlers for the Neo4j Visualization Library",
@@ -27,14 +27,14 @@
27
27
  "eslint": "yarn global:eslint ./src/"
28
28
  },
29
29
  "dependencies": {
30
- "@neo4j-nvl/base": "1.0.0-e90ba568",
31
- "concaveman": "^1.2.1",
32
- "lodash": "4.17.21"
30
+ "@neo4j-nvl/base": "1.0.0-ea46e3c1",
31
+ "concaveman": "1.2.1",
32
+ "lodash": "4.17.23"
33
33
  },
34
34
  "devDependencies": {
35
- "@testing-library/jest-dom": "^5.16.5",
35
+ "@testing-library/jest-dom": "5.17.0",
36
36
  "@types/concaveman": "1.1.6",
37
- "@types/lodash": "4.14.202"
37
+ "@types/lodash": "4.17.21"
38
38
  },
39
39
  "stableVersion": "1.0.0"
40
40
  }