@neo4j-nvl/base 0.3.6-ade05d13 → 0.3.6-d3c1707d
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/dist/types/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { CompatibilityError } from './utils/errors';
|
|
|
8
8
|
import type { Point } from './utils/geometry';
|
|
9
9
|
import type { HitTargetNode, HitTargetRelationship, HitTargets } from './utils/hittest';
|
|
10
10
|
import { nvlResultTransformer } from './utils/jsDriverResultTransformer';
|
|
11
|
+
import { getZoomTargetForNodePositions } from './utils/zoomFunctions';
|
|
11
12
|
/**
|
|
12
13
|
* Extends the MouseEvent interface with the {@link HitTargets} property.
|
|
13
14
|
* The result of a _.{@link NVL.getHits} call.
|
|
@@ -249,6 +250,8 @@ declare class NVL {
|
|
|
249
250
|
* @param {Node[]} data The positions that the nodes should be set to.
|
|
250
251
|
* @param {boolean} updateLayout whether or not the current layout algorithm
|
|
251
252
|
* should update the graph after setting the node positions.
|
|
253
|
+
* For node positions to be unaffected by layout algorithms, use the {@link FreeLayoutType}
|
|
254
|
+
* or use {@link pinNode} to pin the nodes that should remain still.
|
|
252
255
|
* False by default.
|
|
253
256
|
*/
|
|
254
257
|
setNodePositions(data: Node[], updateLayout?: boolean): void;
|
|
@@ -364,4 +367,4 @@ declare const colorMapperFunctions: {
|
|
|
364
367
|
};
|
|
365
368
|
export default NVL;
|
|
366
369
|
export type { NvlOptions, Renderer, Node, Relationship, PartialNode, PartialRelationship, Layout, LayoutOptions, ForceDirectedOptions, HierarchicalOptions, ExternalCallbacks, HitTargets, HitTargetNode, HitTargetRelationship, Point, NvlMouseEvent, ZoomOptions, StyledCaption, WebGLRendererType, CanvasRendererType };
|
|
367
|
-
export { NVL, colorMapperFunctions, CompatibilityError, ForceDirectedLayoutType, HierarchicalLayoutType, GridLayoutType, FreeLayoutType, d3ForceLayoutType, drawCircleBand, nvlResultTransformer };
|
|
370
|
+
export { NVL, colorMapperFunctions, CompatibilityError, ForceDirectedLayoutType, HierarchicalLayoutType, GridLayoutType, FreeLayoutType, d3ForceLayoutType, drawCircleBand, nvlResultTransformer, getZoomTargetForNodePositions };
|
|
@@ -130,7 +130,12 @@ export interface NvlOptions {
|
|
|
130
130
|
* The DOM element in which to render the graph visualization
|
|
131
131
|
*/
|
|
132
132
|
frame?: HTMLElement;
|
|
133
|
-
/**
|
|
133
|
+
/**
|
|
134
|
+
* The DOM container in which to render the minimap.
|
|
135
|
+
*
|
|
136
|
+
* @note When using a React ref, make sure the attached element is rendered before the NVL instance is created.
|
|
137
|
+
* Otherwise, the minimap will not be displayed.
|
|
138
|
+
*/
|
|
134
139
|
minimapContainer?: HTMLElement;
|
|
135
140
|
/** Configuration for the current layout */
|
|
136
141
|
layoutOptions?: LayoutOptions;
|
|
@@ -9,8 +9,12 @@ export declare const MappingEnd = 999999;
|
|
|
9
9
|
export declare const ActiveAnimDuration = 1000;
|
|
10
10
|
export declare const DefaultNodeSize = 25;
|
|
11
11
|
export declare const DefaultNodeColor = "#478BFF";
|
|
12
|
+
export declare const DefaultRelColor = "#848484";
|
|
12
13
|
export declare const DefaultRelWidth = 1;
|
|
13
|
-
export declare const
|
|
14
|
+
export declare const DisabledItemColor = "#ededed";
|
|
15
|
+
export declare const DefaultShadowColor = "#bbb";
|
|
16
|
+
export declare const DefaultSelectedInnerColor = "#fff";
|
|
17
|
+
export declare const DefaultSelectedOuterColor = "#8FE3E8";
|
|
14
18
|
export declare const absFillStyle: {
|
|
15
19
|
position: string;
|
|
16
20
|
top: number;
|
|
@@ -2,19 +2,50 @@ import type { Node } from '../index';
|
|
|
2
2
|
import type { Point } from './geometry';
|
|
3
3
|
declare const getExtremeLimits: (nodePositions: Point[]) => Point[];
|
|
4
4
|
declare const getMaxDistance: (extremeLimits?: Point[]) => number;
|
|
5
|
+
/**
|
|
6
|
+
* Gets the center choordinates and the width and height for the given node positions
|
|
7
|
+
* @param {Point[] | Node[]} nodePositions - The node positions
|
|
8
|
+
* @param {number} maxNodeRadius - The maximum node radius
|
|
9
|
+
* @returns An object with the center x and y coordinates and the width and height
|
|
10
|
+
*/
|
|
5
11
|
declare const getPositionBoundaries: (nodePositions?: Point[] | Node[], maxNodeRadius?: number) => {
|
|
6
12
|
centerX: number;
|
|
7
13
|
centerY: number;
|
|
8
14
|
nodesWidth: number;
|
|
9
15
|
nodesHeight: number;
|
|
10
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Gets the required zoom level for the given view and scene dimensions to fit the scene into the view
|
|
19
|
+
* @param {number} viewWidth - The width of the required view
|
|
20
|
+
* @param {number} viewHeight - The height of the required view
|
|
21
|
+
* @param {number} sceneWidth - The width of the canvas scene
|
|
22
|
+
* @param {number} sceneHeight - The height of the canvas scene
|
|
23
|
+
* @returns An object with the zoom level for the x and y axis
|
|
24
|
+
*/
|
|
11
25
|
declare const getZoomLevel: (viewWidth: number, viewHeight: number, sceneWidth: number, sceneHeight: number) => {
|
|
12
26
|
zoomX: number;
|
|
13
27
|
zoomY: number;
|
|
14
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Creates a zoom target based on the given zoom levels and the min and max zoom level
|
|
31
|
+
* @param {number} zoomX - The zoom level for the x axis
|
|
32
|
+
* @param {number} zoomY - The zoom level for the y axis
|
|
33
|
+
* @param {number} minZoom - The minimum zoom level
|
|
34
|
+
* @param {number} maxZoom - The maximum zoom level
|
|
35
|
+
* @returns The zoom target
|
|
36
|
+
*/
|
|
15
37
|
declare const createZoomTarget: (zoomX: number, zoomY: number, minZoom?: number, maxZoom?: number) => number;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the zoom target to fit the given node positions into the scene
|
|
40
|
+
* @param {Point[]} nodePositions - The node positions
|
|
41
|
+
* @param {number} containerWidth - The width of the container NVL is displayed in
|
|
42
|
+
* @param {number} containerHeight - The height of the container NVL is displayed in
|
|
43
|
+
* @param {number} maxNodeRadius - The maximum node radius, which is added as margin to the scene (defaults to `50`)
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
declare const getZoomTargetForNodePositions: (nodePositions: Point[], containerWidth: number, containerHeight: number, maxNodeRadius?: number) => number;
|
|
16
47
|
declare const getFlexibleZoomLimit: (nodePositions: Point[], rect: HTMLCanvasElement, maxNodeRadius: number) => number;
|
|
17
48
|
declare const getNewZoomWithinLimits: (newZoom: number, oldZoom: number, minZoom: number, maxZoom: number) => number;
|
|
18
49
|
declare const isZoomOutAtLimit: (newZoom: number, oldZoom: number, zoomOutLimit: number) => boolean;
|
|
19
50
|
declare const getDynamicZoom: (nodePositions: Point[] & Node[], minZoom: number, maxZoom: number, rect: HTMLCanvasElement, newZoom: number, currentZoom: number) => number;
|
|
20
|
-
export { getFlexibleZoomLimit, isZoomOutAtLimit, getNewZoomWithinLimits, getExtremeLimits, getMaxDistance, getPositionBoundaries, getZoomLevel, createZoomTarget, getDynamicZoom };
|
|
51
|
+
export { getFlexibleZoomLimit, getZoomTargetForNodePositions, isZoomOutAtLimit, getNewZoomWithinLimits, getExtremeLimits, getMaxDistance, getPositionBoundaries, getZoomLevel, createZoomTarget, getDynamicZoom };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-nvl/base",
|
|
3
|
-
"version": "0.3.6-
|
|
3
|
+
"version": "0.3.6-d3c1707d",
|
|
4
4
|
"license": "SEE LICENSE IN 'LICENSE.txt'",
|
|
5
5
|
"homepage": "https://neo4j.com/docs/nvl/current/",
|
|
6
6
|
"description": "Base library for the Neo4j Visualization Library",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"postpack": "rm LICENSE.txt"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@neo4j-nvl/layout-workers": "0.3.6-
|
|
31
|
+
"@neo4j-nvl/layout-workers": "0.3.6-d3c1707d",
|
|
32
32
|
"@segment/analytics-next": "^1.70.0",
|
|
33
33
|
"color-string": "^1.9.1",
|
|
34
34
|
"d3-force": "^3.0.0",
|