@krainovsd/graph 0.11.0-beta.2 → 0.11.1
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 -15
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/module/GraphCanvas/GraphCanvas.js +14 -12
- package/lib/esm/module/GraphCanvas/GraphCanvas.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/extract-link-point-ids.js +8 -0
- package/lib/esm/module/GraphCanvas/lib/utils/extract-link-point-ids.js.map +1 -0
- package/lib/esm/module/GraphCanvas/slices/init-resize.js +1 -3
- package/lib/esm/module/GraphCanvas/slices/init-resize.js.map +1 -1
- package/lib/index.d.ts +7 -2
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -1118,6 +1118,12 @@ function linkFade(opts) {
|
|
|
1118
1118
|
return { alpha, arrowAlpha };
|
|
1119
1119
|
}
|
|
1120
1120
|
|
|
1121
|
+
function extractLinkPointIds(link) {
|
|
1122
|
+
const sourceId = typeof link.source === "object" ? link.source.id : link.source;
|
|
1123
|
+
const targetId = typeof link.target === "object" ? link.target.id : link.target;
|
|
1124
|
+
return { sourceId, targetId };
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1121
1127
|
function initArea() {
|
|
1122
1128
|
if (!this.area || !this.context || !this.container) {
|
|
1123
1129
|
this.container = d3Selection.create("div")
|
|
@@ -2230,9 +2236,7 @@ function initResize() {
|
|
|
2230
2236
|
observer.disconnect();
|
|
2231
2237
|
return;
|
|
2232
2238
|
}
|
|
2233
|
-
|
|
2234
|
-
this.updateSize();
|
|
2235
|
-
});
|
|
2239
|
+
this.updateSize();
|
|
2236
2240
|
});
|
|
2237
2241
|
document.addEventListener("scroll", this.updateRect.bind(this), {
|
|
2238
2242
|
capture: true,
|
|
@@ -2546,8 +2550,20 @@ class GraphCanvas {
|
|
|
2546
2550
|
this.tick();
|
|
2547
2551
|
}
|
|
2548
2552
|
updateRect() {
|
|
2549
|
-
if (this.area)
|
|
2550
|
-
|
|
2553
|
+
if (!this.area)
|
|
2554
|
+
return;
|
|
2555
|
+
this.areaRect = this.area.getBoundingClientRect();
|
|
2556
|
+
}
|
|
2557
|
+
updateSize() {
|
|
2558
|
+
if (!this.area)
|
|
2559
|
+
return;
|
|
2560
|
+
const { width, height } = this.root.getBoundingClientRect();
|
|
2561
|
+
this.width = width;
|
|
2562
|
+
this.height = height;
|
|
2563
|
+
this.area.width = this.dpi * this.width;
|
|
2564
|
+
this.area.height = this.dpi * this.height;
|
|
2565
|
+
this.areaRect = this.area.getBoundingClientRect();
|
|
2566
|
+
this.draw();
|
|
2551
2567
|
}
|
|
2552
2568
|
clearCache(keys) {
|
|
2553
2569
|
if (!keys) {
|
|
@@ -2641,16 +2657,6 @@ class GraphCanvas {
|
|
|
2641
2657
|
.restart();
|
|
2642
2658
|
}
|
|
2643
2659
|
}
|
|
2644
|
-
updateSize() {
|
|
2645
|
-
this.clearHTMLElements();
|
|
2646
|
-
initArea.call(this);
|
|
2647
|
-
initDnd.call(this);
|
|
2648
|
-
initZoom.call(this);
|
|
2649
|
-
initResize.call(this);
|
|
2650
|
-
initPointer.call(this);
|
|
2651
|
-
if (!this.simulationWorking && !this.highlightWorking)
|
|
2652
|
-
this.draw();
|
|
2653
|
-
}
|
|
2654
2660
|
init() {
|
|
2655
2661
|
initArea.call(this);
|
|
2656
2662
|
initSimulation.call(this);
|
|
@@ -3851,6 +3857,7 @@ exports.colorGetter = colorGetter;
|
|
|
3851
3857
|
exports.colorToRgb = colorToRgb;
|
|
3852
3858
|
exports.dragPlaceCoefficientGetter = dragPlaceCoefficientGetter;
|
|
3853
3859
|
exports.drawText = drawText;
|
|
3860
|
+
exports.extractLinkPointIds = extractLinkPointIds;
|
|
3854
3861
|
exports.extractRgb = extractRgb;
|
|
3855
3862
|
exports.fadeRgb = fadeRgb;
|
|
3856
3863
|
exports.forceSettingsGetter = forceSettingsGetter;
|