@neo4j-nvl/interaction-handlers 0.2.28 → 0.2.30

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,4 +1,4 @@
1
- import { NVL } from '@neo4j-nvl/core';
1
+ import type { NVL } from '@neo4j-nvl/core';
2
2
  /**
3
3
  * Base class for all interactions.
4
4
  * @abstract
@@ -1,4 +1,4 @@
1
- import { NVL, Node, Relationship } from '@neo4j-nvl/core';
1
+ import type { NVL, Node, Relationship } from '@neo4j-nvl/core';
2
2
  import { BaseInteraction } from './base';
3
3
  /**
4
4
  * @internal
@@ -107,8 +107,7 @@ export class DrawInteraction extends BaseInteraction {
107
107
  to: targetNode ? targetNode.id : newTargetNodeId,
108
108
  captions: [{ value: 'TEST' }]
109
109
  };
110
- let x = pos.x;
111
- let y = pos.y;
110
+ let { x, y } = pos;
112
111
  let size = 25;
113
112
  if (hitNode) {
114
113
  x = hitNode.targetCoordinates.x;
@@ -1,4 +1,4 @@
1
- import { NVL } from '@neo4j-nvl/core';
1
+ import type { NVL } from '@neo4j-nvl/core';
2
2
  import { BaseInteraction } from './base';
3
3
  /**
4
4
  * Options for the click interaction handler to customize its behavior.
@@ -59,7 +59,7 @@ export declare class PanInteraction extends BaseInteraction<PanInteractionCallba
59
59
  * panInteraction.updateTargets([], true)
60
60
  * ```
61
61
  */
62
- updateTargets: (targets: Array<'node' | 'relationship'>, excludeNodeMargin: boolean) => void;
62
+ updateTargets: (targets: ('node' | 'relationship')[], excludeNodeMargin: boolean) => void;
63
63
  private handleMouseDown;
64
64
  private handleMouseMove;
65
65
  private handleMouseUp;
@@ -1,4 +1,4 @@
1
- import { NVL } from '@neo4j-nvl/core';
1
+ import type { NVL } from '@neo4j-nvl/core';
2
2
  import { BaseInteraction } from './base';
3
3
  /**
4
4
  * Callbacks for the zoom interaction handler.
@@ -49,8 +49,8 @@ export class OverlayRenderer {
49
49
  _fixCanvasSize(canvas) {
50
50
  const parent = canvas.parentElement;
51
51
  const rect = parent.getBoundingClientRect();
52
- const width = rect.width;
53
- const height = rect.height;
52
+ const { width } = rect;
53
+ const { height } = rect;
54
54
  const devicePixelRatio = window.devicePixelRatio || 1;
55
55
  canvas.width = width * devicePixelRatio;
56
56
  canvas.height = height * devicePixelRatio;
@@ -75,8 +75,9 @@ export class OverlayRenderer {
75
75
  const localStartY = (startY - rect.top) * devicePixelRatio;
76
76
  const localEndX = (endX - rect.left) * devicePixelRatio;
77
77
  const localEndY = (endY - rect.top) * devicePixelRatio;
78
- if (!this._ctx)
78
+ if (!this._ctx) {
79
79
  return;
80
+ }
80
81
  this._ctx.beginPath();
81
82
  this._ctx.rect(localStartX, localStartY, localEndX - localStartX, localEndY - localStartY);
82
83
  this._ctx.closePath();
@@ -100,8 +101,9 @@ export class OverlayRenderer {
100
101
  clear() {
101
102
  const rect = this.canvas.getBoundingClientRect();
102
103
  const devicePixelRatio = window.devicePixelRatio || 1;
103
- if (!this._ctx)
104
+ if (!this._ctx) {
104
105
  return;
106
+ }
105
107
  this._ctx.clearRect(0, 0, rect.width * devicePixelRatio, rect.height * devicePixelRatio);
106
108
  }
107
109
  destroy() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-nvl/interaction-handlers",
3
- "version": "0.2.28",
3
+ "version": "0.2.30",
4
4
  "license": "SEE LICENSE IN 'Neo4j Early Access Agreement - Visualization Library.pdf'",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",