@opendata-ai/openchart-vanilla 6.1.5 → 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/dist/index.js
CHANGED
|
@@ -2858,6 +2858,7 @@ function createGraph(container, spec, options) {
|
|
|
2858
2858
|
centerForce: config.centerForce
|
|
2859
2859
|
});
|
|
2860
2860
|
let initialSettleDone = false;
|
|
2861
|
+
let initialFitDone = false;
|
|
2861
2862
|
simulation.onTick((positions, _alpha) => {
|
|
2862
2863
|
if (destroyed) return;
|
|
2863
2864
|
const posMap = /* @__PURE__ */ new Map();
|
|
@@ -2880,7 +2881,8 @@ function createGraph(container, spec, options) {
|
|
|
2880
2881
|
};
|
|
2881
2882
|
});
|
|
2882
2883
|
spatialIndex.rebuild(positionedNodes);
|
|
2883
|
-
if (!
|
|
2884
|
+
if (!initialFitDone && positionedNodes.length > 0 && interactionManager) {
|
|
2885
|
+
initialFitDone = true;
|
|
2884
2886
|
const { width: cw, height: ch } = getCanvasDimensions();
|
|
2885
2887
|
const { transform: fitTransform } = ZoomTransform.fitBounds(positionedNodes, cw, ch);
|
|
2886
2888
|
interactionManager.setTransform(fitTransform);
|