@krainovsd/graph 0.14.0-beta-7.1 → 0.14.0-beta-7.2
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 +17 -8
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/module/GraphCanvas/GraphCanvas.js +8 -7
- package/lib/esm/module/GraphCanvas/GraphCanvas.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-resize.js +9 -1
- package/lib/esm/module/GraphCanvas/slices/init-resize.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -2328,8 +2328,16 @@ function initResize() {
|
|
|
2328
2328
|
signal: abortController.signal,
|
|
2329
2329
|
});
|
|
2330
2330
|
document.addEventListener("visibilitychange", () => {
|
|
2331
|
-
if (document.hidden)
|
|
2331
|
+
if (document.hidden) {
|
|
2332
|
+
this.highlightController?.abort();
|
|
2333
|
+
this.highlightedNode = null;
|
|
2334
|
+
this.highlightedLink = null;
|
|
2335
|
+
this.highlightedNeighbors = null;
|
|
2336
|
+
this.highlightProgress = 0;
|
|
2337
|
+
this.highlightStart = null;
|
|
2338
|
+
this.highlightPositive = false;
|
|
2332
2339
|
return;
|
|
2340
|
+
}
|
|
2333
2341
|
this.updateSize();
|
|
2334
2342
|
requestAnimationFrame(() => {
|
|
2335
2343
|
this.updateSize();
|
|
@@ -2986,10 +2994,10 @@ class GraphCanvas {
|
|
|
2986
2994
|
_zoomAnimating = false;
|
|
2987
2995
|
isSelecting = false;
|
|
2988
2996
|
selectionRect = null;
|
|
2989
|
-
|
|
2990
|
-
get areaRect() {
|
|
2991
|
-
|
|
2992
|
-
}
|
|
2997
|
+
areaRect;
|
|
2998
|
+
// protected get areaRect() {
|
|
2999
|
+
// return this.area?.getBoundingClientRect();
|
|
3000
|
+
// }
|
|
2993
3001
|
get simulationWorking() {
|
|
2994
3002
|
const simulationAlpha = this.simulation?.alpha?.() ?? 0;
|
|
2995
3003
|
const simulationAlphaMin = this.simulation?.alphaMin?.() ?? 0;
|
|
@@ -3135,8 +3143,9 @@ class GraphCanvas {
|
|
|
3135
3143
|
this.tick();
|
|
3136
3144
|
};
|
|
3137
3145
|
updateRect = () => {
|
|
3138
|
-
|
|
3139
|
-
|
|
3146
|
+
if (!this.area)
|
|
3147
|
+
return;
|
|
3148
|
+
this.areaRect = this.area.getBoundingClientRect();
|
|
3140
3149
|
};
|
|
3141
3150
|
updateSize = () => {
|
|
3142
3151
|
if (!this.area)
|
|
@@ -3375,7 +3384,7 @@ class GraphCanvas {
|
|
|
3375
3384
|
if (controller.signal.aborted)
|
|
3376
3385
|
return;
|
|
3377
3386
|
const elapsed = performance.now() - startTime;
|
|
3378
|
-
const t = Math.min(elapsed / duration, 1);
|
|
3387
|
+
const t = duration === 0 ? 1 : Math.min(elapsed / duration, 1);
|
|
3379
3388
|
const current = startProgress + delta * t;
|
|
3380
3389
|
const eased = current < 0.5 ? 4 * current * current * current : 1 - (-2 * current + 2) ** 3 / 2;
|
|
3381
3390
|
this.highlightProgress = eased;
|