worldorbit 2.5.12 → 2.5.13
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/unpkg/worldorbit-core.min.js +5 -5
- package/dist/unpkg/worldorbit-markdown.min.js +20 -20
- package/dist/unpkg/worldorbit-viewer.min.js +19 -19
- package/dist/unpkg/worldorbit.js +24 -14
- package/dist/unpkg/worldorbit.min.js +26 -26
- package/package.json +1 -1
- package/packages/core/dist/scene.js +26 -14
- package/packages/editor/dist/editor.js +493 -121
package/dist/unpkg/worldorbit.js
CHANGED
|
@@ -1851,8 +1851,9 @@ var WorldOrbit = (() => {
|
|
|
1851
1851
|
}
|
|
1852
1852
|
const orbiting = [...context.orbitChildren.get(object.id) ?? []].sort(compareOrbiting);
|
|
1853
1853
|
const orbitMetricContext = computeOrbitMetricContext(orbiting, parent.radius, context.spacingFactor, context.scaleModel);
|
|
1854
|
+
const orbitRadiiPx = resolveOrbitRadiiPx(orbiting, orbitMetricContext);
|
|
1854
1855
|
orbiting.forEach((child, index) => {
|
|
1855
|
-
const orbitGeometry = resolveOrbitGeometry(child, index, orbiting.length, parent, orbitMetricContext, context);
|
|
1856
|
+
const orbitGeometry = resolveOrbitGeometry(child, index, orbiting.length, parent, orbitMetricContext, orbitRadiiPx[index] ?? orbitMetricContext.innerPx, context);
|
|
1856
1857
|
orbitDrafts.push({
|
|
1857
1858
|
object: child,
|
|
1858
1859
|
parentId: object.id,
|
|
@@ -1926,7 +1927,8 @@ var WorldOrbit = (() => {
|
|
|
1926
1927
|
metricSpread: 0,
|
|
1927
1928
|
innerPx,
|
|
1928
1929
|
stepPx,
|
|
1929
|
-
pixelSpread: Math.max(stepPx * Math.max(objects.length - 1, 1), stepPx)
|
|
1930
|
+
pixelSpread: Math.max(stepPx * Math.max(objects.length - 1, 1), stepPx),
|
|
1931
|
+
minimumGapPx: stepPx * 0.42
|
|
1930
1932
|
};
|
|
1931
1933
|
}
|
|
1932
1934
|
const minMetric = Math.min(...presentMetrics);
|
|
@@ -1939,10 +1941,11 @@ var WorldOrbit = (() => {
|
|
|
1939
1941
|
metricSpread,
|
|
1940
1942
|
innerPx,
|
|
1941
1943
|
stepPx,
|
|
1942
|
-
pixelSpread: Math.max(stepPx * Math.max(objects.length - 1, 1), stepPx)
|
|
1944
|
+
pixelSpread: Math.max(stepPx * Math.max(objects.length - 1, 1), stepPx),
|
|
1945
|
+
minimumGapPx: stepPx * 0.42
|
|
1943
1946
|
};
|
|
1944
1947
|
}
|
|
1945
|
-
function resolveOrbitGeometry(object, index, count, parent, metricContext, context) {
|
|
1948
|
+
function resolveOrbitGeometry(object, index, count, parent, metricContext, orbitRadiusPx, context) {
|
|
1946
1949
|
const placement = object.placement;
|
|
1947
1950
|
const band = object.type === "belt" || object.type === "ring";
|
|
1948
1951
|
if (!placement || placement.mode !== "orbit") {
|
|
@@ -1960,7 +1963,7 @@ var WorldOrbit = (() => {
|
|
|
1960
1963
|
};
|
|
1961
1964
|
}
|
|
1962
1965
|
const eccentricity = clampNumber(typeof placement.eccentricity === "number" ? placement.eccentricity : 0, 0, 0.92);
|
|
1963
|
-
const semiMajor =
|
|
1966
|
+
const semiMajor = orbitRadiusPx;
|
|
1964
1967
|
const baseMinor = Math.max(semiMajor * Math.sqrt(1 - eccentricity * eccentricity), semiMajor * 0.18);
|
|
1965
1968
|
const inclinationDeg = unitValueToDegrees(placement.inclination) ?? 0;
|
|
1966
1969
|
const inclinationScale = context.projection === "isometric" ? Math.max(MIN_ISO_MINOR_SCALE, Math.cos(degreesToRadians(inclinationDeg))) * ISO_FLATTENING : 1;
|
|
@@ -1990,15 +1993,19 @@ var WorldOrbit = (() => {
|
|
|
1990
1993
|
objectY: objectPoint.y
|
|
1991
1994
|
};
|
|
1992
1995
|
}
|
|
1993
|
-
function resolveOrbitRadiusPx(
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
1996
|
+
function resolveOrbitRadiusPx(metric, metricContext) {
|
|
1997
|
+
return metricContext.innerPx + metricContext.stepPx * log2(Math.max(metric, 0) + 1);
|
|
1998
|
+
}
|
|
1999
|
+
function resolveOrbitRadiiPx(objects, metricContext) {
|
|
2000
|
+
const radii = [];
|
|
2001
|
+
objects.forEach((object, index) => {
|
|
2002
|
+
const metric = orbitMetric(object);
|
|
2003
|
+
const fallbackRadius = metricContext.innerPx + index * metricContext.stepPx;
|
|
2004
|
+
const baseRadius = metric === null ? fallbackRadius : resolveOrbitRadiusPx(metric, metricContext);
|
|
2005
|
+
const minimumRadius = index === 0 ? metricContext.innerPx : (radii[index - 1] ?? metricContext.innerPx) + metricContext.minimumGapPx;
|
|
2006
|
+
radii.push(Math.max(baseRadius, minimumRadius));
|
|
2007
|
+
});
|
|
2008
|
+
return radii;
|
|
2002
2009
|
}
|
|
2003
2010
|
function orbitMetric(object) {
|
|
2004
2011
|
if (!object.placement || object.placement.mode !== "orbit") {
|
|
@@ -2006,6 +2013,9 @@ var WorldOrbit = (() => {
|
|
|
2006
2013
|
}
|
|
2007
2014
|
return toDistanceMetric(object.placement.semiMajor ?? object.placement.distance ?? null);
|
|
2008
2015
|
}
|
|
2016
|
+
function log2(value) {
|
|
2017
|
+
return Math.log(value) / Math.log(2);
|
|
2018
|
+
}
|
|
2009
2019
|
function resolveOrbitPhase(phase, index, count) {
|
|
2010
2020
|
const degreeValue = phase ? unitValueToDegrees(phase) : null;
|
|
2011
2021
|
if (degreeValue !== null) {
|