@opendata-ai/openchart-vanilla 6.1.4 → 6.2.0
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/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/graph-mount.ts +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendata-ai/openchart-vanilla",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Vanilla JS renderer for openchart: SVG charts, HTML tables, force-directed graphs",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Riley Hilliard",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@floating-ui/dom": "^1.7.6",
|
|
53
|
-
"@opendata-ai/openchart-core": "6.
|
|
54
|
-
"@opendata-ai/openchart-engine": "6.
|
|
53
|
+
"@opendata-ai/openchart-core": "6.2.0",
|
|
54
|
+
"@opendata-ai/openchart-engine": "6.2.0",
|
|
55
55
|
"d3-force": "^3.0.0",
|
|
56
56
|
"d3-quadtree": "^3.0.1"
|
|
57
57
|
},
|
package/src/graph-mount.ts
CHANGED
|
@@ -379,6 +379,7 @@ export function createGraph(
|
|
|
379
379
|
});
|
|
380
380
|
|
|
381
381
|
let initialSettleDone = false;
|
|
382
|
+
let initialFitDone = false;
|
|
382
383
|
|
|
383
384
|
simulation.onTick((positions, _alpha) => {
|
|
384
385
|
if (destroyed) return;
|
|
@@ -411,10 +412,11 @@ export function createGraph(
|
|
|
411
412
|
// Rebuild spatial index
|
|
412
413
|
spatialIndex.rebuild(positionedNodes);
|
|
413
414
|
|
|
414
|
-
//
|
|
415
|
-
//
|
|
416
|
-
//
|
|
417
|
-
if (!
|
|
415
|
+
// Fit the viewport once on the first tick so the graph is visible and
|
|
416
|
+
// centered immediately. After that, let the user interact freely while
|
|
417
|
+
// the simulation continues settling in the background.
|
|
418
|
+
if (!initialFitDone && positionedNodes.length > 0 && interactionManager) {
|
|
419
|
+
initialFitDone = true;
|
|
418
420
|
const { width: cw, height: ch } = getCanvasDimensions();
|
|
419
421
|
const { transform: fitTransform } = ZoomTransform.fitBounds(positionedNodes, cw, ch);
|
|
420
422
|
interactionManager.setTransform(fitTransform);
|