@opendata-ai/openchart-vanilla 8.5.1 → 8.5.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/dist/{chunk-WOLX5EZT.js → chunk-273EHRBC.js} +22 -18
- package/dist/chunk-273EHRBC.js.map +1 -0
- package/dist/graph-3d/index.d.ts +5 -4
- package/dist/graph-3d/index.js +214 -27
- package/dist/graph-3d/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-WOLX5EZT.js.map +0 -1
|
@@ -2338,6 +2338,25 @@ function edgeSetsEqual(prev, next) {
|
|
|
2338
2338
|
}
|
|
2339
2339
|
return true;
|
|
2340
2340
|
}
|
|
2341
|
+
function reheatAlpha(diff, nextEdgeCount) {
|
|
2342
|
+
const prevNodeCount = diff.survivingPositions.size + diff.exitingNodes.length;
|
|
2343
|
+
const nextNodeCount = diff.survivingPositions.size + diff.enteringIds.length;
|
|
2344
|
+
const nodeRatio = ratio(
|
|
2345
|
+
diff.enteringIds.length + diff.exitingNodes.length,
|
|
2346
|
+
Math.max(prevNodeCount, nextNodeCount)
|
|
2347
|
+
);
|
|
2348
|
+
const prevEdgeCount = nextEdgeCount - diff.enteringEdgeCount + diff.exitingEdges.length;
|
|
2349
|
+
const edgeRatio = ratio(
|
|
2350
|
+
diff.enteringEdgeCount + diff.exitingEdges.length,
|
|
2351
|
+
Math.max(prevEdgeCount, nextEdgeCount)
|
|
2352
|
+
);
|
|
2353
|
+
const changeRatio = Math.max(nodeRatio, edgeRatio);
|
|
2354
|
+
return Math.min(1, REHEAT_FLOOR + (1 - REHEAT_FLOOR) * changeRatio);
|
|
2355
|
+
}
|
|
2356
|
+
var REHEAT_FLOOR = 0.3;
|
|
2357
|
+
function ratio(numerator, denominator) {
|
|
2358
|
+
return denominator > 0 ? numerator / denominator : 0;
|
|
2359
|
+
}
|
|
2341
2360
|
|
|
2342
2361
|
// src/graph-mount.ts
|
|
2343
2362
|
var SPRINGY_DRAG_MAX_NODES = 5e3;
|
|
@@ -3326,20 +3345,7 @@ function createGraph(container, spec, options) {
|
|
|
3326
3345
|
const positions = /* @__PURE__ */ new Map();
|
|
3327
3346
|
for (const [id, p] of diff.survivingPositions) positions.set(id, p);
|
|
3328
3347
|
for (const [id, p] of diff.spawnPositions) positions.set(id, p);
|
|
3329
|
-
const
|
|
3330
|
-
const nextNodeCount = diff.survivingPositions.size + diff.enteringIds.length;
|
|
3331
|
-
const nodeRatio = ratio(
|
|
3332
|
-
diff.enteringIds.length + diff.exitingNodes.length,
|
|
3333
|
-
Math.max(prevNodeCount, nextNodeCount)
|
|
3334
|
-
);
|
|
3335
|
-
const prevEdgeCount = compilation.edges.length - diff.enteringEdgeCount + diff.exitingEdges.length;
|
|
3336
|
-
const nextEdgeCount = compilation.edges.length;
|
|
3337
|
-
const edgeRatio = ratio(
|
|
3338
|
-
diff.enteringEdgeCount + diff.exitingEdges.length,
|
|
3339
|
-
Math.max(prevEdgeCount, nextEdgeCount)
|
|
3340
|
-
);
|
|
3341
|
-
const changeRatio = Math.max(nodeRatio, edgeRatio);
|
|
3342
|
-
const initialAlpha = Math.min(1, 0.3 + 0.7 * changeRatio);
|
|
3348
|
+
const initialAlpha = reheatAlpha(diff, compilation.edges.length);
|
|
3343
3349
|
positionedNodes = compilation.nodes.map((node, index) => {
|
|
3344
3350
|
const pos = positions.get(node.id) ?? { x: 0, y: 0 };
|
|
3345
3351
|
return { ...node, x: pos.x, y: pos.y, index };
|
|
@@ -3364,9 +3370,6 @@ function createGraph(container, spec, options) {
|
|
|
3364
3370
|
needsRender = true;
|
|
3365
3371
|
scheduleRender();
|
|
3366
3372
|
}
|
|
3367
|
-
function ratio(numerator, denominator) {
|
|
3368
|
-
return denominator > 0 ? numerator / denominator : 0;
|
|
3369
|
-
}
|
|
3370
3373
|
function reconcileStateAfterUpdate() {
|
|
3371
3374
|
const nextIds = new Set(compilation.nodes.map((n) => n.id));
|
|
3372
3375
|
if (hoveredNodeId && !nextIds.has(hoveredNodeId)) hoveredNodeId = null;
|
|
@@ -3572,6 +3575,7 @@ export {
|
|
|
3572
3575
|
GraphSearchManager,
|
|
3573
3576
|
seedNodePositions,
|
|
3574
3577
|
diffGraphUpdate,
|
|
3578
|
+
reheatAlpha,
|
|
3575
3579
|
createGraph
|
|
3576
3580
|
};
|
|
3577
|
-
//# sourceMappingURL=chunk-
|
|
3581
|
+
//# sourceMappingURL=chunk-273EHRBC.js.map
|