@opendata-ai/openchart-vanilla 8.6.3 → 8.6.4
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-273EHRBC.js → chunk-5IMVUHVC.js} +4 -2
- package/dist/chunk-5IMVUHVC.js.map +1 -0
- package/dist/graph-3d/index.d.ts +1 -1
- package/dist/graph-3d/index.js +16 -15
- package/dist/graph-3d/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{renderer-registry-B5tW6yAZ.d.ts → renderer-registry-Cng76n8F.d.ts} +7 -0
- package/dist/styles.css.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-273EHRBC.js.map +0 -1
package/dist/graph-3d/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GraphSpec } from '@opendata-ai/openchart-core';
|
|
2
|
-
import { a as GraphCamera, b as GraphFlyTarget, g as GraphRendererContext, d as GraphInstance, f as GraphMountOptions } from '../renderer-registry-
|
|
2
|
+
import { a as GraphCamera, b as GraphFlyTarget, g as GraphRendererContext, d as GraphInstance, f as GraphMountOptions } from '../renderer-registry-Cng76n8F.js';
|
|
3
3
|
import '@opendata-ai/openchart-engine';
|
|
4
4
|
import '@floating-ui/dom';
|
|
5
5
|
|
package/dist/graph-3d/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
reheatAlpha,
|
|
15
15
|
resolveHighlightTarget,
|
|
16
16
|
seedNodePositions
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-5IMVUHVC.js";
|
|
18
18
|
import {
|
|
19
19
|
AnimationScheduler,
|
|
20
20
|
createTween,
|
|
@@ -169,7 +169,7 @@ function computeFit(points, view) {
|
|
|
169
169
|
halfRight * slack / Math.tan(hFov / 2),
|
|
170
170
|
MIN_FIT_DISTANCE
|
|
171
171
|
) + Math.max(0, nearDepth);
|
|
172
|
-
return { center, dir, distance };
|
|
172
|
+
return { center, dir, distance, nearDepth: Math.max(0, nearDepth) };
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
// src/graph-3d/forces.ts
|
|
@@ -512,7 +512,7 @@ var LABEL_SCALE_MIN = 0.4;
|
|
|
512
512
|
var LABEL_SCALE_MAX = 8;
|
|
513
513
|
var MAX_PIXEL_RATIO = 2;
|
|
514
514
|
var DEFAULT_FOV_DEG = 50;
|
|
515
|
-
var
|
|
515
|
+
var NEAR_CLEARANCE = 60;
|
|
516
516
|
var NODE_FOCUS_DISTANCE = 120;
|
|
517
517
|
var AUTO_FLIGHT_MS = 800;
|
|
518
518
|
var ENTRANCE_MIN_SCALE = 0.01;
|
|
@@ -582,7 +582,7 @@ function createGraph3DRenderer(ctx) {
|
|
|
582
582
|
});
|
|
583
583
|
}
|
|
584
584
|
let autoFit = true;
|
|
585
|
-
let
|
|
585
|
+
let firstAutoFitDone = false;
|
|
586
586
|
let cameraChangeQueued = false;
|
|
587
587
|
const labelShown = /* @__PURE__ */ new Set();
|
|
588
588
|
let lastLabelRank = 0;
|
|
@@ -947,7 +947,11 @@ function createGraph3DRenderer(ctx) {
|
|
|
947
947
|
autoFit = false;
|
|
948
948
|
fitNow(opts);
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function autoFitNow() {
|
|
951
|
+
firstAutoFitDone = true;
|
|
952
|
+
fitNow({ duration: 0 }, options?.initialZoom ?? 1);
|
|
953
|
+
}
|
|
954
|
+
function fitNow(opts, zoom = 1) {
|
|
951
955
|
if (destroyed || nodeData.length === 0) return;
|
|
952
956
|
const camera = graph.camera();
|
|
953
957
|
const fit = computeFit(
|
|
@@ -966,7 +970,8 @@ function createGraph3DRenderer(ctx) {
|
|
|
966
970
|
}
|
|
967
971
|
);
|
|
968
972
|
if (!fit) return;
|
|
969
|
-
const
|
|
973
|
+
const framed = zoom > 0 && zoom !== 1 ? Math.max(fit.distance / zoom, fit.nearDepth + NEAR_CLEARANCE) : fit.distance;
|
|
974
|
+
const distance = framed * entranceCameraPull;
|
|
970
975
|
graph.cameraPosition(
|
|
971
976
|
{
|
|
972
977
|
x: fit.center.x + fit.dir.x * distance,
|
|
@@ -1224,7 +1229,7 @@ function createGraph3DRenderer(ctx) {
|
|
|
1224
1229
|
}
|
|
1225
1230
|
if (enter.cameraFit) {
|
|
1226
1231
|
entranceCameraPull = ENTRANCE_CAMERA_PULLBACK + (1 - ENTRANCE_CAMERA_PULLBACK) * ease(t);
|
|
1227
|
-
if (autoFit && options?.fitOnLoad !== false)
|
|
1232
|
+
if (autoFit && options?.fitOnLoad !== false) autoFitNow();
|
|
1228
1233
|
}
|
|
1229
1234
|
paint();
|
|
1230
1235
|
},
|
|
@@ -1648,13 +1653,9 @@ function createGraph3DRenderer(ctx) {
|
|
|
1648
1653
|
}).onEngineTick(() => {
|
|
1649
1654
|
if (destroyed) return;
|
|
1650
1655
|
anchorTooltip();
|
|
1651
|
-
if (autoFit && options?.fitOnLoad !== false) {
|
|
1652
|
-
|
|
1653
|
-
if (now -
|
|
1654
|
-
lastAutoFit = now;
|
|
1655
|
-
fitNow({ duration: 0 });
|
|
1656
|
-
refreshLabels();
|
|
1657
|
-
}
|
|
1656
|
+
if (autoFit && options?.fitOnLoad !== false && (!firstAutoFitDone || !prefersReducedMotion())) {
|
|
1657
|
+
autoFitNow();
|
|
1658
|
+
if (performance.now() - lastLabelRank >= LABEL_RERANK_MS) refreshLabels();
|
|
1658
1659
|
}
|
|
1659
1660
|
}).onEngineStop(() => {
|
|
1660
1661
|
if (destroyed) return;
|
|
@@ -1664,7 +1665,7 @@ function createGraph3DRenderer(ctx) {
|
|
|
1664
1665
|
}
|
|
1665
1666
|
if (autoFit && options?.fitOnLoad !== false) {
|
|
1666
1667
|
autoFit = false;
|
|
1667
|
-
|
|
1668
|
+
autoFitNow();
|
|
1668
1669
|
}
|
|
1669
1670
|
refreshLabels();
|
|
1670
1671
|
});
|