@krainovsd/graph 0.10.0-rc3 → 0.10.0-rc5
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 +23 -8
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/module/GraphCanvas/GraphCanvas.js +13 -5
- package/lib/esm/module/GraphCanvas/GraphCanvas.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 +3 -1
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -2615,6 +2615,8 @@ function initPointer() {
|
|
|
2615
2615
|
let currentLink;
|
|
2616
2616
|
const checkHighlightNode = this.nodeSettings.highlightByHoverNode && !this.isDragging;
|
|
2617
2617
|
const checkHighlightLink = this.linkSettings.highlightByHoverLink && !this.isDragging;
|
|
2618
|
+
let highlightNode = true;
|
|
2619
|
+
let highlightLink = true;
|
|
2618
2620
|
if (checkHighlightNode) {
|
|
2619
2621
|
currentNode = nodeByPointerGetter({
|
|
2620
2622
|
areaRect: this.areaRect,
|
|
@@ -2622,8 +2624,10 @@ function initPointer() {
|
|
|
2622
2624
|
mouseEvent: event,
|
|
2623
2625
|
nodes: this.nodes,
|
|
2624
2626
|
});
|
|
2627
|
+
if (currentNode?.highlight != undefined)
|
|
2628
|
+
highlightNode = currentNode.highlight;
|
|
2625
2629
|
}
|
|
2626
|
-
if (currentNode) {
|
|
2630
|
+
if (currentNode && highlightNode) {
|
|
2627
2631
|
this.area.style.cursor = "pointer";
|
|
2628
2632
|
}
|
|
2629
2633
|
else if (checkHighlightLink) {
|
|
@@ -2634,7 +2638,9 @@ function initPointer() {
|
|
|
2634
2638
|
mouseEvent: event,
|
|
2635
2639
|
links: this.links,
|
|
2636
2640
|
});
|
|
2637
|
-
if (currentLink)
|
|
2641
|
+
if (currentLink?.highlight != undefined)
|
|
2642
|
+
highlightLink = currentLink?.highlight;
|
|
2643
|
+
if (currentLink && highlightLink) {
|
|
2638
2644
|
this.area.style.cursor = "pointer";
|
|
2639
2645
|
}
|
|
2640
2646
|
else {
|
|
@@ -2644,7 +2650,7 @@ function initPointer() {
|
|
|
2644
2650
|
else {
|
|
2645
2651
|
this.area.style.cursor = "default";
|
|
2646
2652
|
}
|
|
2647
|
-
if (currentNode && this.highlightedNode !== currentNode) {
|
|
2653
|
+
if (currentNode && highlightNode && this.highlightedNode !== currentNode) {
|
|
2648
2654
|
this.highlightedNode = currentNode;
|
|
2649
2655
|
this.highlightedLink = null;
|
|
2650
2656
|
this.highlightedNeighbors = new Set(this.highlightedNode?.neighbors ?? []);
|
|
@@ -2655,6 +2661,7 @@ function initPointer() {
|
|
|
2655
2661
|
});
|
|
2656
2662
|
}
|
|
2657
2663
|
else if (currentLink &&
|
|
2664
|
+
highlightLink &&
|
|
2658
2665
|
checkType(currentLink.source, lodash.isObject(currentLink.source)) &&
|
|
2659
2666
|
checkType(currentLink.target, lodash.isObject(currentLink.target)) &&
|
|
2660
2667
|
this.highlightedLink !== currentLink) {
|
|
@@ -3155,11 +3162,19 @@ class GraphCanvas {
|
|
|
3155
3162
|
if (this.area)
|
|
3156
3163
|
this.areaRect = this.area.getBoundingClientRect();
|
|
3157
3164
|
}
|
|
3158
|
-
clearCache() {
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3165
|
+
clearCache(keys) {
|
|
3166
|
+
if (!keys) {
|
|
3167
|
+
this.nodeOptionsCache = {};
|
|
3168
|
+
this.linkOptionsCache = {};
|
|
3169
|
+
this.cachedNodeText = {};
|
|
3170
|
+
this.cachedTextNodeParameters = {};
|
|
3171
|
+
}
|
|
3172
|
+
else {
|
|
3173
|
+
for (let i = 0; i < keys.length; i++) {
|
|
3174
|
+
const key = keys[i];
|
|
3175
|
+
this[key] = {};
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3163
3178
|
}
|
|
3164
3179
|
tick() {
|
|
3165
3180
|
if (!this.simulationWorking && !this.highlightWorking)
|