@krainovsd/graph 0.10.0-rc2 → 0.10.0-rc4
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/lib/cjs/index.cjs +22 -11
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/draw-nodes.js +12 -8
- package/lib/esm/module/GraphCanvas/slices/draw-nodes.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-pointer.js +10 -3
- package/lib/esm/module/GraphCanvas/slices/init-pointer.js.map +1 -1
- package/lib/index.d.ts +6 -4
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -2188,10 +2188,14 @@ function getDrawNode(nodeRenders, textRenders, state) {
|
|
|
2188
2188
|
}
|
|
2189
2189
|
if (nodeOptions.nodeDraw && nodeOptions.textDraw) {
|
|
2190
2190
|
nodeRenders.push(() => {
|
|
2191
|
-
nodeOptions
|
|
2191
|
+
if (nodeOptions.nodeDraw) {
|
|
2192
|
+
nodeOptions.nodeDraw.bind(this)(node, nodeOptions);
|
|
2193
|
+
}
|
|
2192
2194
|
});
|
|
2193
2195
|
textRenders.push(() => {
|
|
2194
|
-
nodeOptions
|
|
2196
|
+
if (nodeOptions.textDraw) {
|
|
2197
|
+
nodeOptions.textDraw.bind(this)(node, nodeOptions);
|
|
2198
|
+
}
|
|
2195
2199
|
});
|
|
2196
2200
|
return;
|
|
2197
2201
|
}
|
|
@@ -2447,7 +2451,7 @@ function getDrawNode(nodeRenders, textRenders, state) {
|
|
|
2447
2451
|
});
|
|
2448
2452
|
if (nodeOptions.nodeExtraDraw) {
|
|
2449
2453
|
nodeRenders.push(() => {
|
|
2450
|
-
nodeOptions?.nodeExtraDraw?.(node, {
|
|
2454
|
+
nodeOptions?.nodeExtraDraw?.bind?.(this)?.(node, {
|
|
2451
2455
|
...nodeOptions,
|
|
2452
2456
|
radius,
|
|
2453
2457
|
alpha,
|
|
@@ -2458,14 +2462,14 @@ function getDrawNode(nodeRenders, textRenders, state) {
|
|
|
2458
2462
|
textShiftY,
|
|
2459
2463
|
textWeight,
|
|
2460
2464
|
textWidth,
|
|
2461
|
-
}
|
|
2465
|
+
});
|
|
2462
2466
|
});
|
|
2463
2467
|
}
|
|
2464
2468
|
/** Text draw */
|
|
2465
2469
|
if (nodeOptions.textVisible && nodeOptions.text && nodeOptions.shape !== "text") {
|
|
2466
2470
|
textRenders.push(() => {
|
|
2467
2471
|
if (nodeOptions.textDraw) {
|
|
2468
|
-
nodeOptions.textDraw(node, {
|
|
2472
|
+
nodeOptions.textDraw.bind(this)(node, {
|
|
2469
2473
|
...nodeOptions,
|
|
2470
2474
|
radius,
|
|
2471
2475
|
alpha,
|
|
@@ -2476,7 +2480,7 @@ function getDrawNode(nodeRenders, textRenders, state) {
|
|
|
2476
2480
|
textShiftY,
|
|
2477
2481
|
textWeight,
|
|
2478
2482
|
textWidth,
|
|
2479
|
-
}
|
|
2483
|
+
});
|
|
2480
2484
|
return;
|
|
2481
2485
|
}
|
|
2482
2486
|
if (!this.context || !node.x || !node.y || !nodeOptions.text)
|
|
@@ -2507,7 +2511,7 @@ function getDrawNode(nodeRenders, textRenders, state) {
|
|
|
2507
2511
|
textGap: nodeOptions.textGap,
|
|
2508
2512
|
});
|
|
2509
2513
|
if (nodeOptions.textExtraDraw) {
|
|
2510
|
-
nodeOptions.textExtraDraw(node, {
|
|
2514
|
+
nodeOptions.textExtraDraw.bind(this)(node, {
|
|
2511
2515
|
...nodeOptions,
|
|
2512
2516
|
radius,
|
|
2513
2517
|
alpha,
|
|
@@ -2518,7 +2522,7 @@ function getDrawNode(nodeRenders, textRenders, state) {
|
|
|
2518
2522
|
textShiftY,
|
|
2519
2523
|
textWeight,
|
|
2520
2524
|
textWidth,
|
|
2521
|
-
}
|
|
2525
|
+
});
|
|
2522
2526
|
}
|
|
2523
2527
|
});
|
|
2524
2528
|
}
|
|
@@ -2611,6 +2615,8 @@ function initPointer() {
|
|
|
2611
2615
|
let currentLink;
|
|
2612
2616
|
const checkHighlightNode = this.nodeSettings.highlightByHoverNode && !this.isDragging;
|
|
2613
2617
|
const checkHighlightLink = this.linkSettings.highlightByHoverLink && !this.isDragging;
|
|
2618
|
+
let highlightNode = true;
|
|
2619
|
+
let highlightLink = true;
|
|
2614
2620
|
if (checkHighlightNode) {
|
|
2615
2621
|
currentNode = nodeByPointerGetter({
|
|
2616
2622
|
areaRect: this.areaRect,
|
|
@@ -2618,8 +2624,10 @@ function initPointer() {
|
|
|
2618
2624
|
mouseEvent: event,
|
|
2619
2625
|
nodes: this.nodes,
|
|
2620
2626
|
});
|
|
2627
|
+
if (currentNode?.highlight != undefined)
|
|
2628
|
+
highlightNode = currentNode.highlight;
|
|
2621
2629
|
}
|
|
2622
|
-
if (currentNode) {
|
|
2630
|
+
if (currentNode && highlightNode) {
|
|
2623
2631
|
this.area.style.cursor = "pointer";
|
|
2624
2632
|
}
|
|
2625
2633
|
else if (checkHighlightLink) {
|
|
@@ -2630,7 +2638,9 @@ function initPointer() {
|
|
|
2630
2638
|
mouseEvent: event,
|
|
2631
2639
|
links: this.links,
|
|
2632
2640
|
});
|
|
2633
|
-
if (currentLink)
|
|
2641
|
+
if (currentLink?.highlight != undefined)
|
|
2642
|
+
highlightLink = currentLink?.highlight;
|
|
2643
|
+
if (currentLink && highlightLink) {
|
|
2634
2644
|
this.area.style.cursor = "pointer";
|
|
2635
2645
|
}
|
|
2636
2646
|
else {
|
|
@@ -2640,7 +2650,7 @@ function initPointer() {
|
|
|
2640
2650
|
else {
|
|
2641
2651
|
this.area.style.cursor = "default";
|
|
2642
2652
|
}
|
|
2643
|
-
if (currentNode && this.highlightedNode !== currentNode) {
|
|
2653
|
+
if (currentNode && highlightNode && this.highlightedNode !== currentNode) {
|
|
2644
2654
|
this.highlightedNode = currentNode;
|
|
2645
2655
|
this.highlightedLink = null;
|
|
2646
2656
|
this.highlightedNeighbors = new Set(this.highlightedNode?.neighbors ?? []);
|
|
@@ -2651,6 +2661,7 @@ function initPointer() {
|
|
|
2651
2661
|
});
|
|
2652
2662
|
}
|
|
2653
2663
|
else if (currentLink &&
|
|
2664
|
+
highlightLink &&
|
|
2654
2665
|
checkType(currentLink.source, lodash.isObject(currentLink.source)) &&
|
|
2655
2666
|
checkType(currentLink.target, lodash.isObject(currentLink.target)) &&
|
|
2656
2667
|
this.highlightedLink !== currentLink) {
|