@neo4j-nvl/interaction-handlers
Advanced tools
Comparing version 0.2.14 to 0.2.15
import { NODE_EDGE_WIDTH } from '../constants'; | ||
import { BaseInteraction } from './base'; | ||
const DragThreshold = 10; | ||
/** | ||
@@ -75,3 +76,3 @@ * Interaction handler for dragging nodes. | ||
this.selectedNodes = this.nvlInstance.getSelectedNodes(); | ||
if (this.mouseDownNode && this.selectedNodes.map((node) => node.id).includes(this.mouseDownNode.data.id)) { | ||
if (this.mouseDownNode !== null && this.selectedNodes.map((node) => node.id).includes(this.mouseDownNode.data.id)) { | ||
this.moveSelectedNodes = true; | ||
@@ -90,4 +91,11 @@ } | ||
// Avoid conflicts on moving node position in drawing process. | ||
if (!this.mouseDownNode || event.buttons !== 1 || this.isDrawing) | ||
if (this.mouseDownNode === null || event.buttons !== 1 || this.isDrawing) { | ||
return; | ||
} | ||
const diffX = Math.abs(event.clientX - this.mousePosition.x); | ||
const diffY = Math.abs(event.clientY - this.mousePosition.y); | ||
const distanceSquared = Math.pow(diffX, 2) + Math.pow(diffY, 2); | ||
if (distanceSquared < DragThreshold) { | ||
return; | ||
} | ||
const zoom = this.nvlInstance.getScale(); | ||
@@ -94,0 +102,0 @@ const dx = ((event.clientX - this.mousePosition.x) / zoom) * window.devicePixelRatio; |
{ | ||
"name": "@neo4j-nvl/interaction-handlers", | ||
"version": "0.2.14", | ||
"version": "0.2.15", | ||
"license": "SEE LICENSE IN 'Neo4j Early Access Agreement - Visualization Library.pdf'", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
268862
1803