astraeus 0.7.0 → 0.8.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/CHANGELOG.md +176 -0
- package/README.md +185 -37
- package/package.json +5 -4
- package/src/api/AstraeusScene.d.ts +21 -5
- package/src/api/AstraeusScene.js +34 -10
- package/src/api/AstraeusScene.node.js +34 -10
- package/src/api/assembleScene.d.ts +36 -0
- package/src/api/assembleScene.js +175 -0
- package/src/api/bodySetChecks.d.ts +10 -0
- package/src/api/bodySetChecks.js +117 -0
- package/src/api/bodySetInput.d.ts +81 -0
- package/src/api/bodySetInput.js +1 -0
- package/src/api/containingBlock.d.ts +6 -0
- package/src/api/containingBlock.js +16 -0
- package/src/api/data.d.ts +17 -5
- package/src/api/data.js +28 -10
- package/src/api/definitionOf.d.ts +16 -0
- package/src/api/definitionOf.js +20 -0
- package/src/api/errors.d.ts +61 -1
- package/src/api/frozenCopy.d.ts +6 -0
- package/src/api/frozenCopy.js +26 -0
- package/src/api/group.d.ts +8 -2
- package/src/api/group.js +24 -5
- package/src/api/index.d.ts +18 -7
- package/src/api/index.js +2 -2
- package/src/api/index.node.js +2 -2
- package/src/api/listeners.d.ts +5 -0
- package/src/api/listeners.js +25 -0
- package/src/api/look.d.ts +47 -0
- package/src/api/look.js +1 -0
- package/src/api/lookInput.d.ts +3 -0
- package/src/api/lookInput.js +41 -0
- package/src/api/moonPanelInput.d.ts +60 -0
- package/src/api/moonPanelInput.js +1 -0
- package/src/api/mount.d.ts +9 -19
- package/src/api/mount.js +27 -13
- package/src/api/mount.node.js +27 -13
- package/src/api/pathProvenance.js +1 -1
- package/src/api/pickerInput.d.ts +25 -0
- package/src/api/pickerInput.js +1 -0
- package/src/api/planBodies.d.ts +72 -0
- package/src/api/planBodies.js +300 -0
- package/src/api/planBodySets.d.ts +68 -0
- package/src/api/planBodySets.js +234 -0
- package/src/api/planCamera.d.ts +83 -0
- package/src/api/planCamera.js +184 -0
- package/src/api/planGroups.d.ts +36 -0
- package/src/api/planGroups.js +103 -0
- package/src/api/planMoonPanel.d.ts +19 -0
- package/src/api/planMoonPanel.js +104 -0
- package/src/api/planPaths.d.ts +40 -0
- package/src/api/planPaths.js +212 -0
- package/src/api/planPicker.d.ts +12 -0
- package/src/api/planPicker.js +40 -0
- package/src/api/planPlaces.d.ts +16 -0
- package/src/api/planPlaces.js +99 -0
- package/src/api/planStory.d.ts +26 -0
- package/src/api/planStory.js +66 -0
- package/src/api/planTimeline.d.ts +27 -0
- package/src/api/planTimeline.js +68 -0
- package/src/api/planViews.d.ts +25 -0
- package/src/api/planViews.js +35 -0
- package/src/api/prepared.js +4 -1
- package/src/api/renamedInputs.d.ts +15 -0
- package/src/api/renamedInputs.js +39 -0
- package/src/api/scene.d.ts +162 -68
- package/src/api/scene.js +247 -793
- package/src/api/sceneFreeze.d.ts +4 -0
- package/src/api/sceneFreeze.js +10 -0
- package/src/api/sceneReads.d.ts +171 -0
- package/src/api/sceneReads.js +6 -0
- package/src/api/story.d.ts +49 -19
- package/src/api/story.js +54 -22
- package/src/api/sunOrbit.js +9 -11
- package/src/api/time.d.ts +2 -1
- package/src/api/time.js +2 -1
- package/src/api/viewerCamera.d.ts +22 -0
- package/src/api/viewerCamera.js +84 -0
- package/src/api/viewerClock.d.ts +30 -0
- package/src/api/viewerClock.js +85 -0
- package/src/api/viewerFirstDraw.d.ts +14 -0
- package/src/api/viewerFirstDraw.js +26 -0
- package/src/api/viewerHandle.d.ts +79 -0
- package/src/api/viewerHandle.js +31 -0
- package/src/api/viewerLink.d.ts +87 -15
- package/src/api/viewerLink.js +111 -75
- package/src/api/viewerLooks.d.ts +19 -0
- package/src/api/viewerLooks.js +37 -0
- package/src/api/viewerPicker.d.ts +22 -0
- package/src/api/viewerPicker.js +49 -0
- package/src/api/viewerSelection.d.ts +25 -0
- package/src/api/viewerSelection.js +31 -0
- package/src/api/viewerViews.d.ts +10 -0
- package/src/api/viewerViews.js +18 -0
- package/src/api/viewerZones.d.ts +20 -0
- package/src/api/viewerZones.js +47 -0
- package/src/api/views.d.ts +4 -5
- package/src/api/views.js +7 -5
- package/src/app/App.d.ts +5 -3
- package/src/app/App.js +191 -82
- package/src/app/App.node.js +191 -82
- package/src/app/AstraeusScene.d.ts +16 -2
- package/src/app/AstraeusScene.js +4 -4
- package/src/app/BodyView.d.ts +4 -1
- package/src/app/BodyView.js +2 -2
- package/src/app/CameraController.d.ts +6 -0
- package/src/app/DeveloperSettings.d.ts +1 -4
- package/src/app/DeveloperSettings.js +6 -10
- package/src/app/FeatureMarkers.d.ts +4 -3
- package/src/app/FeatureMarkers.js +8 -13
- package/src/app/FrameRateSection.js +2 -1
- package/src/app/OrbitSetView.js +1 -1
- package/src/app/SettingControls.d.ts +11 -3
- package/src/app/SettingControls.js +10 -2
- package/src/app/SkyView.d.ts +3 -10
- package/src/app/SkyView.js +6 -28
- package/src/app/address.d.ts +16 -0
- package/src/app/address.js +31 -0
- package/src/app/bodyDraw.d.ts +10 -7
- package/src/app/bodyDraw.js +12 -32
- package/src/app/bodyMetrics.js +2 -2
- package/src/app/bodySet.d.ts +4 -20
- package/src/app/bodySet.js +5 -16
- package/src/app/debugReadout.js +1 -1
- package/src/app/displaySwitches.d.ts +4 -0
- package/src/app/displaySwitches.js +6 -0
- package/src/app/experienceDefinition.d.ts +11 -23
- package/src/app/listSwitch.d.ts +8 -14
- package/src/app/listSwitch.js +3 -10
- package/src/app/liveLook.d.ts +39 -0
- package/src/app/liveLook.js +66 -0
- package/src/app/look.d.ts +36 -0
- package/src/app/look.js +61 -0
- package/src/app/mission.d.ts +1 -1
- package/src/app/mission.js +1 -1
- package/src/app/openClock.d.ts +3 -2
- package/src/app/openClock.js +3 -3
- package/src/app/sceneCamera.js +9 -0
- package/src/app/sceneFrame.d.ts +4 -4
- package/src/app/sceneFrame.js +13 -8
- package/src/app/sceneHooks.js +3 -2
- package/src/app/style.css +114 -139
- package/src/app/trackedMetrics.d.ts +10 -3
- package/src/app/trackedMetrics.js +22 -11
- package/src/app/viewLink.d.ts +10 -32
- package/src/app/viewLink.js +10 -49
- package/src/app/viewerPort.d.ts +50 -0
- package/src/app/views.d.ts +1 -0
- package/src/assets/bodies/galileanMoons.js +1 -2
- package/src/assets/bodies/io.js +2 -2
- package/src/assets/bodies/listedMoons.d.ts +1 -1
- package/src/assets/bodies/listedMoons.js +2 -3
- package/src/assets/bodies/planetSystemMaps.js +2 -3
- package/src/assets/bodies/venus.js +2 -6
- package/src/assets/catalogue.js +1 -2
- package/src/assets/licence.d.ts +3 -3
- package/src/assets/licence.js +3 -3
- package/src/assets/pictures.d.ts +15 -12
- package/src/assets/pictures.js +24 -20
- package/src/assets/sky.d.ts +6 -5
- package/src/assets/sky.js +6 -9
- package/src/assets/visual.d.ts +4 -0
- package/src/core/bodies/index.d.ts +0 -4
- package/src/core/bodies/index.js +1 -6
- package/src/core/bodies/jupiterData.d.ts +0 -1
- package/src/core/bodies/jupiterData.js +2 -5
- package/src/core/bodies/moonSystem.d.ts +1 -1
- package/src/core/bodies/moonSystem.js +102 -55
- package/src/core/bodies/outerPlanetRingData.js +2 -2
- package/src/core/bodies/planetTrajectory.js +1 -1
- package/src/core/bodySetFamilies.d.ts +20 -0
- package/src/core/bodySetFamilies.js +14 -0
- package/src/core/chebyshevEphemeris.js +1 -1
- package/src/core/elementsBody.d.ts +8 -4
- package/src/core/elementsBody.js +32 -11
- package/src/core/elementsGroup.d.ts +27 -0
- package/src/core/elementsGroup.js +85 -0
- package/src/core/events.d.ts +2 -0
- package/src/core/events.js +2 -0
- package/src/core/illumination.js +1 -1
- package/src/core/listedOrbitGroup.d.ts +2 -0
- package/src/core/listedOrbitGroup.js +11 -7
- package/src/core/moonListText.d.ts +6 -0
- package/src/core/moonListText.js +19 -0
- package/src/core/moonTrajectory.js +1 -1
- package/src/core/pacing.d.ts +38 -3
- package/src/core/pacing.js +55 -4
- package/src/core/planetModels.js +2 -2
- package/src/core/planetSeries.d.ts +8 -0
- package/src/core/planetSeries.js +16 -2
- package/src/core/pointGroup.js +1 -1
- package/src/core/provenance.d.ts +2 -1
- package/src/core/provenance.js +2 -2
- package/src/core/referenceCenters.js +5 -5
- package/src/core/sampledTrajectory.js +1 -1
- package/src/core/scalePolicy.d.ts +1 -0
- package/src/core/startView.d.ts +19 -0
- package/src/core/startView.js +28 -0
- package/src/core/state.d.ts +6 -2
- package/src/core/state.js +3 -3
- package/src/core/storyPanels.d.ts +63 -0
- package/src/core/storyPanels.js +111 -0
- package/src/core/sunCentredSources.d.ts +4 -0
- package/src/core/sunCentredSources.js +9 -2
- package/src/core/timeInput.d.ts +4 -0
- package/src/core/timeInput.js +4 -0
- package/src/shell/AstraeusShell.d.ts +5 -1
- package/src/shell/AstraeusShell.js +20 -11
- package/src/shell/AstraeusShell.node.js +20 -11
- package/src/shell/Collapsible.d.ts +4 -3
- package/src/shell/Collapsible.js +5 -5
- package/src/shell/ControlsDrawer.d.ts +1 -1
- package/src/shell/ControlsDrawer.js +3 -1
- package/src/shell/DisplaySwitches.js +2 -1
- package/src/shell/InfoPanel.d.ts +3 -1
- package/src/shell/InfoPanel.js +5 -4
- package/src/shell/MoonFamilyPanel.js +1 -1
- package/src/shell/ObjectControls.d.ts +3 -1
- package/src/shell/ObjectControls.js +2 -2
- package/src/shell/Sources.d.ts +5 -3
- package/src/shell/Sources.js +5 -5
- package/src/shell/StoryPanelView.d.ts +4 -3
- package/src/shell/StoryPanelView.js +8 -6
- package/src/shell/SwitchControl.d.ts +5 -11
- package/src/shell/SwitchControl.js +2 -20
- package/src/shell/TimelineBar.css +81 -81
- package/src/shell/TimelineBar.d.ts +5 -2
- package/src/shell/TimelineBar.js +9 -8
- package/src/shell/TimelineBar.node.js +9 -8
- package/src/shell/TopBar.css +22 -22
- package/src/shell/TopBar.d.ts +5 -1
- package/src/shell/TopBar.js +2 -2
- package/src/shell/TopBar.node.js +2 -2
- package/src/shell/bootLoader.d.ts +4 -10
- package/src/shell/bootLoader.js +6 -52
- package/src/shell/embedded.css +18 -18
- package/src/shell/experience.d.ts +1 -1
- package/src/shell/moonFamilies.d.ts +2 -6
- package/src/shell/moonFamilies.js +2 -18
- package/src/shell/phone.css +58 -58
- package/src/shell/storyPanels.d.ts +2 -53
- package/src/shell/storyPanels.js +1 -106
- package/src/shell/style.css +153 -134
- package/src/shell/useDrawers.d.ts +3 -2
- package/src/shell/useDrawers.js +4 -3
- package/src/shell/viewerKeys.d.ts +8 -0
- package/src/shell/viewerKeys.js +16 -0
- package/src/synthetic/syntheticDefinition.js +20 -24
- package/src/synthetic/syntheticJourneyScene.js +3 -3
- package/src/synthetic/syntheticProbeDefinition.js +2 -1
- package/src/synthetic/syntheticViewsDefinition.d.ts +0 -3
- package/src/synthetic/syntheticViewsDefinition.js +10 -16
- package/data/moons/jupiter.json +0 -3333
- package/data/moons/neptune.json +0 -555
- package/data/moons/pluto.json +0 -205
- package/data/moons/saturn.json +0 -8267
- package/data/moons/uranus.json +0 -887
- package/src/app/addressNavigation.d.ts +0 -17
- package/src/app/addressNavigation.js +0 -16
- package/src/assets/bodies/jupiterMoonCatalogue.d.ts +0 -3
- package/src/assets/bodies/jupiterMoonCatalogue.js +0 -4
- package/src/assets/bodies/outerPlanetCatalogues.d.ts +0 -7
- package/src/assets/bodies/outerPlanetCatalogues.js +0 -8
- package/src/assets/bodies/swiftTuttle.d.ts +0 -12
- package/src/assets/bodies/swiftTuttle.js +0 -13
- package/src/assets/moonCatalogue.d.ts +0 -49
- package/src/assets/moonCatalogue.js +0 -80
- package/src/core/bodies/outerPlanetData.d.ts +0 -4
- package/src/core/bodies/outerPlanetData.js +0 -13
- package/src/core/bodies/swiftTuttle.d.ts +0 -46
- package/src/core/bodies/swiftTuttle.js +0 -106
package/src/app/bodyMetrics.js
CHANGED
|
@@ -18,7 +18,7 @@ function distanceMetric(resolver, id, label, body, from, timeUtcMs) {
|
|
|
18
18
|
value: Math.hypot(...state.positionKm),
|
|
19
19
|
unit: "km",
|
|
20
20
|
digits: 0,
|
|
21
|
-
context: `centre to centre · ${state.
|
|
21
|
+
context: `centre to centre · ${state.plane}`,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
/** Fraction of the disc lit, seen from the parent: the angle at the body between the Sun and the parent. */
|
|
@@ -44,7 +44,7 @@ function coordinatesMetric(resolver, body, parent, label, timeUtcMs) {
|
|
|
44
44
|
label,
|
|
45
45
|
system: "xyz",
|
|
46
46
|
components: ["x", "y", "z"].map((component, index) => ({ label: component, value: state.positionKm[index], unit: "km", digits: 0 })),
|
|
47
|
-
frame: state.
|
|
47
|
+
frame: state.plane,
|
|
48
48
|
origin: centreName(parent),
|
|
49
49
|
planViews: { references: [] },
|
|
50
50
|
};
|
package/src/app/bodySet.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { BodyId } from "../core/body.js";
|
|
2
2
|
import type { EphemerisGroup } from "../core/ephemerisGroup.js";
|
|
3
3
|
import type { BalancePoint } from "../core/orbitPeriod.js";
|
|
4
|
+
import { DEFAULT_FAMILY_PALETTE, MAX_BODY_SET_FAMILIES, familiesWithPalette, type BodySetFamily } from "../core/bodySetFamilies.js";
|
|
5
|
+
export { DEFAULT_FAMILY_PALETTE, MAX_BODY_SET_FAMILIES, familiesWithPalette, type BodySetFamily };
|
|
4
6
|
export interface BodySetMember {
|
|
5
7
|
readonly id: BodyId;
|
|
6
8
|
readonly label: string;
|
|
@@ -8,14 +10,6 @@ export interface BodySetMember {
|
|
|
8
10
|
/** One of the layer's family ids. */
|
|
9
11
|
readonly family: string;
|
|
10
12
|
}
|
|
11
|
-
export interface BodySetFamily {
|
|
12
|
-
readonly id: string;
|
|
13
|
-
readonly label: string;
|
|
14
|
-
/** Default orbit colour, #rrggbb; the live settings may change it. */
|
|
15
|
-
readonly color: string;
|
|
16
|
-
}
|
|
17
|
-
/** Shader uniform arrays hold at most this many families. */
|
|
18
|
-
export declare const MAX_BODY_SET_FAMILIES = 16;
|
|
19
13
|
export interface BodySetLayer {
|
|
20
14
|
readonly id: string;
|
|
21
15
|
/** Positions (and, for the orbits, velocities) of the members, in member order. */
|
|
@@ -68,11 +62,6 @@ export interface BodySetLook {
|
|
|
68
62
|
/** Orbit-line brightness multiplier for the lit family. */
|
|
69
63
|
readonly highlightOrbitGain: number;
|
|
70
64
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Default orbit colours, in family order: the Okabe and Ito colour-blind-safe set (Okabe and Ito 2008, "Color Universal Design"), without
|
|
73
|
-
* its black and its dark blue (both vanish on the night sky), preceded by the cream of the existing orbit lines and followed by a neutral grey.
|
|
74
|
-
*/
|
|
75
|
-
export declare const DEFAULT_FAMILY_PALETTE: readonly string[];
|
|
76
65
|
export declare const DEFAULT_BODY_SET_LOOK: BodySetLook;
|
|
77
66
|
export declare const BODY_SET_LOOK_LIMITS: Readonly<{
|
|
78
67
|
dotPx: {
|
|
@@ -100,13 +89,8 @@ export declare const BODY_SET_LOOK_LIMITS: Readonly<{
|
|
|
100
89
|
max: number;
|
|
101
90
|
};
|
|
102
91
|
}>;
|
|
103
|
-
/** The orbit brightness multiplier of a family now: its own gain, else the highlight's when it is the lit one. */
|
|
104
|
-
export declare function familyGainOf(look: BodySetLook, family: string): number;
|
|
105
|
-
/** Families in data order with the default palette's colours, cycling past its end. */
|
|
106
|
-
export declare function familiesWithPalette(families: readonly {
|
|
107
|
-
readonly id: string;
|
|
108
|
-
readonly label: string;
|
|
109
|
-
}[], palette?: readonly string[]): readonly BodySetFamily[];
|
|
92
|
+
/** The orbit brightness multiplier of a family now: its own gain, else the highlight's when it is the lit one, else `base` (the family's own brightness, default 1). */
|
|
93
|
+
export declare function familyGainOf(look: BodySetLook, family: string, base?: number): number;
|
|
110
94
|
/** Checks a layer: members and families unique, every member in a family, a positive centre GM, members as the group's. */
|
|
111
95
|
export declare function validateBodySet(layer: BodySetLayer): BodySetLayer;
|
|
112
96
|
/** The colour each family's orbits are drawn in now: the live choice, else the family's own. */
|
package/src/app/bodySet.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
/**
|
|
4
|
-
* Default orbit colours, in family order: the Okabe and Ito colour-blind-safe set (Okabe and Ito 2008, "Color Universal Design"), without
|
|
5
|
-
* its black and its dark blue (both vanish on the night sky), preceded by the cream of the existing orbit lines and followed by a neutral grey.
|
|
6
|
-
*/
|
|
7
|
-
export const DEFAULT_FAMILY_PALETTE = Object.freeze(["#f0e6da", "#f0e442", "#e69f00", "#56b4e9", "#cc79a7", "#009e73", "#d55e00", "#bbbbbb"]);
|
|
1
|
+
import { DEFAULT_FAMILY_PALETTE, MAX_BODY_SET_FAMILIES, familiesWithPalette } from "../core/bodySetFamilies.js";
|
|
2
|
+
export { DEFAULT_FAMILY_PALETTE, MAX_BODY_SET_FAMILIES, familiesWithPalette };
|
|
8
3
|
export const DEFAULT_BODY_SET_LOOK = Object.freeze({
|
|
9
4
|
dotColor: "#9a9a9a",
|
|
10
5
|
dotPx: 3,
|
|
@@ -28,15 +23,9 @@ export const BODY_SET_LOOK_LIMITS = Object.freeze({
|
|
|
28
23
|
orbitZoomFarRatio: { min: 1.5, max: 20 },
|
|
29
24
|
highlightOrbitGain: { min: 1, max: 12 },
|
|
30
25
|
});
|
|
31
|
-
/** The orbit brightness multiplier of a family now: its own gain, else the highlight's when it is the lit one. */
|
|
32
|
-
export function familyGainOf(look, family) {
|
|
33
|
-
return look.familyGains[family] ?? (look.highlightFamily === family ? look.highlightOrbitGain :
|
|
34
|
-
}
|
|
35
|
-
/** Families in data order with the default palette's colours, cycling past its end. */
|
|
36
|
-
export function familiesWithPalette(families, palette = DEFAULT_FAMILY_PALETTE) {
|
|
37
|
-
if (families.length > MAX_BODY_SET_FAMILIES)
|
|
38
|
-
throw new RangeError(`a body set holds at most ${MAX_BODY_SET_FAMILIES} families, got ${families.length}`);
|
|
39
|
-
return Object.freeze(families.map((family, index) => Object.freeze({ id: family.id, label: family.label, color: palette[index % palette.length] })));
|
|
26
|
+
/** The orbit brightness multiplier of a family now: its own gain, else the highlight's when it is the lit one, else `base` (the family's own brightness, default 1). */
|
|
27
|
+
export function familyGainOf(look, family, base = 1) {
|
|
28
|
+
return look.familyGains[family] ?? (look.highlightFamily === family ? look.highlightOrbitGain : base);
|
|
40
29
|
}
|
|
41
30
|
/** Checks a layer: members and families unique, every member in a family, a positive centre GM, members as the group's. */
|
|
42
31
|
export function validateBodySet(layer) {
|
package/src/app/debugReadout.js
CHANGED
|
@@ -11,7 +11,7 @@ export function buildDebugReadout(input) {
|
|
|
11
11
|
policyId: input.policy.id,
|
|
12
12
|
...(input.pair === undefined ? {} : { pair: input.pair }),
|
|
13
13
|
moonPosition: {
|
|
14
|
-
frame: moonFromEarth.
|
|
14
|
+
frame: moonFromEarth.plane,
|
|
15
15
|
center: moonFromEarth.center,
|
|
16
16
|
units: "km",
|
|
17
17
|
positionKm: triple(moonFromEarth.positionKm),
|
|
@@ -3,9 +3,11 @@ import type { OrbitLook } from "../assets/orbitLook.js";
|
|
|
3
3
|
import type { BodySetLook } from "./bodySet.js";
|
|
4
4
|
/** The display switches a story can place. Each one drives the same state as its Developer-drawer buttons, so the two never disagree. */
|
|
5
5
|
export declare const DISPLAY_SWITCH_IDS: readonly ["orbitLines", "labels", "milkyWay"];
|
|
6
|
+
/** The name of one display switch: "orbitLines", "labels" or "milkyWay" (a key of `SwitchesInput`). */
|
|
6
7
|
export type DisplaySwitchId = (typeof DISPLAY_SWITCH_IDS)[number];
|
|
7
8
|
/** Where a switch shows: a button in the top bar, a row in the story switch panel opened from the bar, or only in the Developer drawer (where every switch stays). */
|
|
8
9
|
export declare const DISPLAY_SWITCH_PLACES: readonly ["top-bar", "panel", "developer"];
|
|
10
|
+
/** Where a switch shows: "top-bar", "panel" or "developer". */
|
|
9
11
|
export type DisplaySwitchPlace = (typeof DISPLAY_SWITCH_PLACES)[number];
|
|
10
12
|
/** One switch's placement, and whether it starts on (absent: the scene's own start, which is on). */
|
|
11
13
|
export interface DisplaySwitchSetting {
|
|
@@ -52,3 +54,5 @@ export interface SwitchBindings {
|
|
|
52
54
|
}
|
|
53
55
|
/** The switches to draw in the top bar and the switch panel: the placed ones the scene has something for, in the order orbit lines, labels, Milky Way. */
|
|
54
56
|
export declare function displaySwitchItems(bindings: SwitchBindings): readonly DisplaySwitchItem[];
|
|
57
|
+
/** The settings with every placed switch counted as shown: a host reads and sets a switch placed only in the Developer drawer too. */
|
|
58
|
+
export declare function hostReachable(settings: DisplaySwitchSettings | undefined): DisplaySwitchSettings | undefined;
|
|
@@ -46,3 +46,9 @@ export function displaySwitchItems(bindings) {
|
|
|
46
46
|
return [{ id, label: DISPLAY_SWITCH_LABELS[id], place, on: state[id].on, onToggle: state[id].toggle }];
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
+
/** The settings with every placed switch counted as shown: a host reads and sets a switch placed only in the Developer drawer too. */
|
|
50
|
+
export function hostReachable(settings) {
|
|
51
|
+
if (settings === undefined)
|
|
52
|
+
return undefined;
|
|
53
|
+
return Object.fromEntries(Object.entries(settings).map(([id, setting]) => [id, { ...setting, place: "panel" }]));
|
|
54
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
1
|
import type { SimulationClock } from "../core/clock.js";
|
|
3
|
-
import type { Pacing } from "../core/pacing.js";
|
|
2
|
+
import type { EventZone, Pacing } from "../core/pacing.js";
|
|
4
3
|
import type { StateResolver } from "../core/stateResolver.js";
|
|
5
4
|
import type { PointGroup } from "../core/pointGroup.js";
|
|
6
5
|
import type { TimeBounds, Trajectory } from "../core/trajectory.js";
|
|
@@ -14,6 +13,8 @@ import type { ExperienceConfig, ExperienceObject } from "../shell/experience.js"
|
|
|
14
13
|
import { type ScaleId } from "../shell/scaleModel.js";
|
|
15
14
|
import type { TrackedBody } from "./mission.js";
|
|
16
15
|
import type { SkySettings } from "../assets/sky.js";
|
|
16
|
+
import type { LookInput } from "./look.js";
|
|
17
|
+
import type { Pictures } from "../assets/pictures.js";
|
|
17
18
|
import { type BodySetLayer } from "./bodySet.js";
|
|
18
19
|
import type { DisplaySwitchSettings } from "./displaySwitches.js";
|
|
19
20
|
import type { ViewSettings } from "./views.js";
|
|
@@ -26,14 +27,6 @@ export interface ExperienceRuntime {
|
|
|
26
27
|
readonly resolver: StateResolver;
|
|
27
28
|
readonly catalogue: BodyCatalogue;
|
|
28
29
|
}
|
|
29
|
-
/** One developer-tools section; the app draws the heading and the experience supplies the body. */
|
|
30
|
-
export interface DeveloperSection {
|
|
31
|
-
readonly id: string;
|
|
32
|
-
readonly heading: string;
|
|
33
|
-
/** Sections sit around the generic scene instrumentation and display settings. */
|
|
34
|
-
readonly placement: "before-scene" | "after-scene";
|
|
35
|
-
readonly render: (runtime: ExperienceRuntime) => ReactNode;
|
|
36
|
-
}
|
|
37
30
|
/**
|
|
38
31
|
* One group the `points` layer draws as dots and the shell lists as a single item.
|
|
39
32
|
* Members are never individually pickable. Select, focus and follow target the group's
|
|
@@ -166,6 +159,8 @@ export interface ExperienceDefinition {
|
|
|
166
159
|
};
|
|
167
160
|
/** Playback that slows for encounters and speeds up for cruise (see `pacedRate`). Absent: the clock runs at the rate it opens with or the visitor picks. */
|
|
168
161
|
readonly pacing?: Pacing;
|
|
162
|
+
/** Every event zone a host hears (an event's own `withinSeconds`, or a pacing rule's zone): present when any exists, with or without `pacing`. */
|
|
163
|
+
readonly eventZones?: readonly EventZone[];
|
|
169
164
|
/** Layers the scene mounts, e.g. the tracked-body list. */
|
|
170
165
|
readonly sceneLayers: readonly SceneLayerId[];
|
|
171
166
|
/** The catalogued bodies the scene draws, one view each. Absent: none, as in the bodiless fixture. */
|
|
@@ -179,6 +174,8 @@ export interface ExperienceDefinition {
|
|
|
179
174
|
* viewport gets the base file, so a page that only shows a body in passing does not download the large map.
|
|
180
175
|
*/
|
|
181
176
|
readonly desktopTextures?: boolean;
|
|
177
|
+
/** The pictures of the data packages this viewer was given, by name (`titan`, `venus-8k`, `milky-way`). Absent: none, so a body is a flat colour and the sky has no Milky Way picture; nothing is shared between viewers. */
|
|
178
|
+
readonly pictures?: Pictures;
|
|
182
179
|
/** Per-body presentation overrides; state is untouched. */
|
|
183
180
|
readonly visualOverrides?: Readonly<Record<BodyId, VisualOverride>>;
|
|
184
181
|
/** The scale choices offered, in order; the first is the starting one. Default: true and readable scale. */
|
|
@@ -192,7 +189,6 @@ export interface ExperienceDefinition {
|
|
|
192
189
|
/** Paths of Sun-centred objects; drawn only when the `sun-centred` layer is listed. */
|
|
193
190
|
readonly paths?: readonly PathLayer[];
|
|
194
191
|
readonly createMetrics: (runtime: ExperienceRuntime) => (objectId: string, timeUtcMs: number) => readonly Metric[];
|
|
195
|
-
readonly developerSections?: readonly DeveloperSection[];
|
|
196
192
|
/** Optional camera reach; omitted, the scene keeps its built-in limits. */
|
|
197
193
|
readonly camera?: CameraReach;
|
|
198
194
|
/**
|
|
@@ -200,18 +196,8 @@ export interface ExperienceDefinition {
|
|
|
200
196
|
* bounded by the window is never left past its end. Presentation of time only; the user can still seek, pause and switch it off.
|
|
201
197
|
*/
|
|
202
198
|
readonly loop?: boolean;
|
|
203
|
-
/**
|
|
204
|
-
|
|
205
|
-
* `?param=value` (the experience is built again from the address). Absent: none.
|
|
206
|
-
*/
|
|
207
|
-
readonly alternates?: readonly {
|
|
208
|
-
readonly label: string;
|
|
209
|
-
readonly param: string;
|
|
210
|
-
readonly value: string;
|
|
211
|
-
readonly active: boolean;
|
|
212
|
-
}[];
|
|
213
|
-
/** A choice between versions of this experience, shown in the top bar and the phone drawer: choosing one opens it again with `?param=value` (the camera view and time of the old address are dropped). Absent: none. */
|
|
214
|
-
readonly switcher?: import("../shell/SwitchControl.js").ExperienceSwitch;
|
|
199
|
+
/** A host's picker (`Scene.setPicker`), a press is reported to the host link and nothing else happens. Absent: none. */
|
|
200
|
+
readonly picker?: import("../api/pickerInput.js").PickerInput;
|
|
215
201
|
/** Where the orbit-lines, labels and Milky Way switches show (top bar, switch panel or the Developer drawer only) and whether each starts on. Absent: all in the Developer drawer, the scene's own start. The address (`?labels=`, `?sky=`) still overrides the start. */
|
|
216
202
|
readonly displaySwitches?: DisplaySwitchSettings;
|
|
217
203
|
/** Named views of this one scene (presentation only), resolved once: per view, the object, event and story-panel ids it shows. Anything no view names is in every view. Absent: no views, everything shows. */
|
|
@@ -222,6 +208,8 @@ export interface ExperienceDefinition {
|
|
|
222
208
|
readonly startView?: import("./viewLink.js").StartView;
|
|
223
209
|
/** The sky behind the scene (stars and the Milky Way, at infinity). On at full brightness unless this says otherwise; presentation only. */
|
|
224
210
|
readonly sky?: SkySettings;
|
|
211
|
+
/** The looks the scene set (`Scene.setLook`); the page address (when on) overrides them, see `app/look.ts`. Presentation only. */
|
|
212
|
+
readonly look?: LookInput;
|
|
225
213
|
/** Many small bodies drawn as batches (dots with a pixel floor, balls close up, names on demand, orbit lines by family). Absent: none. */
|
|
226
214
|
readonly bodySets?: readonly BodySetLayer[];
|
|
227
215
|
/** Data to load before the scene mounts (for example the curve-fit chunks of the window). The entry awaits it once. */
|
package/src/app/listSwitch.d.ts
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import type { ExperienceSwitch } from "../shell/SwitchControl.js";
|
|
2
|
-
/**
|
|
3
|
-
export
|
|
4
|
-
readonly
|
|
2
|
+
/** The control for a host's picker (`Scene.setPicker`) with `pressed` as the pressed option: a press calls `choose(value)` and does nothing else (no address, no navigation). */
|
|
3
|
+
export declare function pickerSwitch(picker: {
|
|
4
|
+
readonly id: string;
|
|
5
5
|
readonly label: string;
|
|
6
|
-
readonly
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
readonly param: string;
|
|
12
|
-
readonly keep?: readonly string[];
|
|
13
|
-
}, preferred?: string): {
|
|
14
|
-
readonly name: string;
|
|
15
|
-
readonly switcher: ExperienceSwitch;
|
|
16
|
-
} | undefined;
|
|
6
|
+
readonly options: readonly {
|
|
7
|
+
readonly value: string;
|
|
8
|
+
readonly label: string;
|
|
9
|
+
}[];
|
|
10
|
+
}, pressed: string, choose: (value: string) => void): ExperienceSwitch;
|
package/src/app/listSwitch.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/** The
|
|
2
|
-
export function
|
|
3
|
-
|
|
4
|
-
const chosen = sorted.find((entry) => entry.name === requested) ?? sorted.find((entry) => entry.name === preferred) ?? sorted[0];
|
|
5
|
-
if (chosen === undefined)
|
|
6
|
-
return undefined;
|
|
7
|
-
return {
|
|
8
|
-
name: chosen.name,
|
|
9
|
-
switcher: { label: switchOf.label, param: switchOf.param, ...(switchOf.keep === undefined ? {} : { keep: switchOf.keep }), options: sorted.map((entry) => ({ label: entry.label, value: entry.name, active: entry === chosen })) },
|
|
10
|
-
};
|
|
1
|
+
/** The control for a host's picker (`Scene.setPicker`) with `pressed` as the pressed option: a press calls `choose(value)` and does nothing else (no address, no navigation). */
|
|
2
|
+
export function pickerSwitch(picker, pressed, choose) {
|
|
3
|
+
return { label: picker.label, param: picker.id, choose, options: picker.options.map((option) => ({ label: option.label, value: option.value, active: option.value === pressed })) };
|
|
11
4
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The looks of a running viewer (O-056 T-262). `skySettingsOf` is the sky as a look lays it over the experience's own; `lookReadOf` reads the looks in force back from the scene's live controls
|
|
3
|
+
* (the one place the Developer drawer, the host's `setLook` and the page address all end up), every one filled in; `applyLook` replaces the whole look. Presentation only (ARCH-02).
|
|
4
|
+
*/
|
|
5
|
+
import type { LookInput, LookRead } from "../api/look.js";
|
|
6
|
+
import type { SceneControls } from "./AstraeusScene.js";
|
|
7
|
+
import { type GlowLook } from "./bodyDraw.js";
|
|
8
|
+
import type { ExperienceDefinition } from "./experienceDefinition.js";
|
|
9
|
+
import type { DisplaySwitchItem } from "../shell/DisplaySwitches.js";
|
|
10
|
+
/** The sky settings in force: the experience's own, then the look (the scene's `setLook`, with the address over it). The Milky Way switch's start sits between the two. */
|
|
11
|
+
export declare function skySettingsOf(definition: ExperienceDefinition, look: LookInput): {
|
|
12
|
+
milkyWay: boolean;
|
|
13
|
+
starBrightness: number;
|
|
14
|
+
milkyWayBrightness: number;
|
|
15
|
+
visible: boolean;
|
|
16
|
+
live: boolean;
|
|
17
|
+
};
|
|
18
|
+
/** Whether wide screens draw the larger desktop pictures: the look's `desktopPictures` (the scene's, with the address over it), else the definition's own opt-in (default off). Read once when the viewer is built. */
|
|
19
|
+
export declare function desktopPicturesOf(definition: Pick<ExperienceDefinition, "desktopTextures">, look: LookInput): boolean;
|
|
20
|
+
/** The looks the scene's live controls hold now, every one filled in. */
|
|
21
|
+
export declare function lookReadOf(controls: SceneControls): LookRead;
|
|
22
|
+
/**
|
|
23
|
+
* Replaces the whole look in the live controls with `input` (a look not named takes its default) and returns the looks now in force. The one resolver (`resolveLook`) takes it with no page address:
|
|
24
|
+
* a host's live set wins over the address, which only starts the viewer.
|
|
25
|
+
*/
|
|
26
|
+
export declare function applyLook(controls: SceneControls, definition: ExperienceDefinition, glowBase: GlowLook | null, input: LookInput): LookRead;
|
|
27
|
+
/** What the viewer lets a host do to its presentation: read the display switches, and set the looks, the scale and a switch. Rebuilt every render over the live controls. */
|
|
28
|
+
export interface LivePresentation {
|
|
29
|
+
switches(): Readonly<Record<string, boolean>>;
|
|
30
|
+
setLook(look: LookInput): void;
|
|
31
|
+
setScale(id: string): void;
|
|
32
|
+
setSwitch(id: string, on: boolean): void;
|
|
33
|
+
}
|
|
34
|
+
/** The host's view of the presentation: `items` (read fresh each time) are the display switches the scene placed (those with something to act on), so a switch is read and set exactly as its visible button does. */
|
|
35
|
+
export declare function presentationOf(parts: {
|
|
36
|
+
readonly setLook: (look: LookInput) => void;
|
|
37
|
+
readonly setScale: (id: string) => void;
|
|
38
|
+
readonly items: () => readonly DisplaySwitchItem[];
|
|
39
|
+
}): LivePresentation;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { bootFadeSeconds } from "../shell/bootLoader.js";
|
|
2
|
+
import { glowLookOf, markerSettingsOf } from "./bodyDraw.js";
|
|
3
|
+
import { featureMinBodyPxOf } from "./FeatureMarkers.js";
|
|
4
|
+
import { resolveLook } from "./look.js";
|
|
5
|
+
import { resolveSkySettings } from "./skyModel.js";
|
|
6
|
+
/** The sky settings in force: the experience's own, then the look (the scene's `setLook`, with the address over it). The Milky Way switch's start sits between the two. */
|
|
7
|
+
export function skySettingsOf(definition, look) {
|
|
8
|
+
const settings = resolveSkySettings(definition.sky);
|
|
9
|
+
return {
|
|
10
|
+
...settings,
|
|
11
|
+
milkyWay: look.milkyWay ?? definition.displaySwitches?.milkyWay?.on ?? settings.milkyWay,
|
|
12
|
+
starBrightness: look.starBrightness ?? settings.starBrightness,
|
|
13
|
+
milkyWayBrightness: look.milkyWayBrightness ?? settings.milkyWayBrightness,
|
|
14
|
+
visible: look.skyVisible ?? settings.visible,
|
|
15
|
+
live: true,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/** Whether wide screens draw the larger desktop pictures: the look's `desktopPictures` (the scene's, with the address over it), else the definition's own opt-in (default off). Read once when the viewer is built. */
|
|
19
|
+
export function desktopPicturesOf(definition, look) {
|
|
20
|
+
return look.desktopPictures ?? definition.desktopTextures === true;
|
|
21
|
+
}
|
|
22
|
+
/** The looks the scene's live controls hold now, every one filled in. */
|
|
23
|
+
export function lookReadOf(controls) {
|
|
24
|
+
return {
|
|
25
|
+
starBrightness: controls.starBrightness,
|
|
26
|
+
milkyWay: controls.showMilkyWay,
|
|
27
|
+
milkyWayBrightness: controls.milkyWayBrightness,
|
|
28
|
+
skyVisible: controls.skyVisible !== false,
|
|
29
|
+
...(controls.glowLook === undefined ? {} : { sunGlow: { sizePx: controls.glowLook.sizePx, brightness: controls.glowLook.brightness, scale: controls.glowLook.scale } }),
|
|
30
|
+
markerSwapRadiusPx: controls.bodyMarker.minSpherePx,
|
|
31
|
+
featureMinBodyPx: featureMinBodyPxOf({ featureMinBodyPx: controls.featureMinBodyPx }),
|
|
32
|
+
loadFadeSeconds: controls.loadFadeSeconds ?? bootFadeSeconds(),
|
|
33
|
+
desktopPictures: controls.desktopPictures,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Replaces the whole look in the live controls with `input` (a look not named takes its default) and returns the looks now in force. The one resolver (`resolveLook`) takes it with no page address:
|
|
38
|
+
* a host's live set wins over the address, which only starts the viewer.
|
|
39
|
+
*/
|
|
40
|
+
export function applyLook(controls, definition, glowBase, input) {
|
|
41
|
+
const look = resolveLook(input, "");
|
|
42
|
+
const sky = skySettingsOf(definition, look);
|
|
43
|
+
controls.starBrightness = sky.starBrightness;
|
|
44
|
+
controls.milkyWayBrightness = sky.milkyWayBrightness;
|
|
45
|
+
controls.showMilkyWay = sky.milkyWay;
|
|
46
|
+
controls.skyVisible = sky.visible;
|
|
47
|
+
if (glowBase !== null)
|
|
48
|
+
controls.glowLook = glowLookOf(look, glowBase);
|
|
49
|
+
controls.bodyMarker = { ...controls.bodyMarker, minSpherePx: markerSettingsOf(look).minSpherePx };
|
|
50
|
+
controls.featureMinBodyPx = featureMinBodyPxOf(look);
|
|
51
|
+
controls.loadFadeSeconds = bootFadeSeconds(look);
|
|
52
|
+
return lookReadOf(controls);
|
|
53
|
+
}
|
|
54
|
+
/** The host's view of the presentation: `items` (read fresh each time) are the display switches the scene placed (those with something to act on), so a switch is read and set exactly as its visible button does. */
|
|
55
|
+
export function presentationOf(parts) {
|
|
56
|
+
return {
|
|
57
|
+
switches: () => Object.fromEntries(parts.items().map(({ id, on }) => [id, on])),
|
|
58
|
+
setLook: parts.setLook,
|
|
59
|
+
setScale: parts.setScale,
|
|
60
|
+
setSwitch: (id, on) => {
|
|
61
|
+
const item = parts.items().find((candidate) => candidate.id === id);
|
|
62
|
+
if (item !== undefined && item.on !== on)
|
|
63
|
+
item.onToggle();
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The looks (O-056 T-261, review F11): presentation settings that change how the scene is drawn, never where anything is. Each has a default, is set when building
|
|
3
|
+
* (`Scene.setLook`, type `LookInput` in `api/look.ts`) and may be overridden by the page address when the host turned `address` on. This is the one table that maps each address
|
|
4
|
+
* parameter to its `LookInput` key and parser; every reader takes the resolved `LookInput` from `resolveLook`, so none parses the address itself. Precedence: address over `setLook` over default.
|
|
5
|
+
*/
|
|
6
|
+
import type { LookInput } from "../api/look.js";
|
|
7
|
+
export type { LookInput } from "../api/look.js";
|
|
8
|
+
/** The address parameters that set a look. */
|
|
9
|
+
export type LookParam = "stars" | "milkyway" | "milkywaybrightness" | "sky" | "sunglow" | "sunbrightness" | "sunglowscale" | "markerpx" | "featurepx" | "loadfade" | "desktop";
|
|
10
|
+
/** How a look is written: a number in a range, an `on`/`off` switch, or a switch the address can only turn off. */
|
|
11
|
+
export type LookKind = {
|
|
12
|
+
readonly kind: "range";
|
|
13
|
+
readonly min: number;
|
|
14
|
+
readonly max: number;
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: "onoff";
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: "offOnly";
|
|
19
|
+
};
|
|
20
|
+
/** One look: where it sits in `LookInput` (`["sunGlow", "sizePx"]` for a nested one), its address parameter and how it is written. */
|
|
21
|
+
export interface LookField {
|
|
22
|
+
readonly path: readonly [string] | readonly [string, string];
|
|
23
|
+
readonly param: LookParam;
|
|
24
|
+
readonly spec: LookKind;
|
|
25
|
+
}
|
|
26
|
+
/** Every look. The one table; the order is the order of `LookInput`. */
|
|
27
|
+
export declare const LOOK_FIELDS: readonly LookField[];
|
|
28
|
+
/** The name a look is called in a message: `sunGlow.sizePx`. */
|
|
29
|
+
export declare const lookName: (field: LookField) => string;
|
|
30
|
+
/** The value a look has in `look`, or undefined. */
|
|
31
|
+
export declare function lookValue(look: LookInput, field: LookField): number | boolean | undefined;
|
|
32
|
+
declare function withValue(look: LookInput, field: LookField, value: number | boolean): LookInput;
|
|
33
|
+
/** Sets a look in a copy of `look` (used by `Scene.setLook` to build the checked look). */
|
|
34
|
+
export declare const lookWith: typeof withValue;
|
|
35
|
+
/** The looks in force: `base` (what the scene set) with the address text laid over it (`search` is empty when the host's `address` option is off). Pure; a live change (T-262) resolves a new base the same way. */
|
|
36
|
+
export declare function resolveLook(base: LookInput | undefined, search: string): LookInput;
|
package/src/app/look.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const range = (path, param, min, max) => ({ path, param, spec: { kind: "range", min, max } });
|
|
2
|
+
/** Every look. The one table; the order is the order of `LookInput`. */
|
|
3
|
+
export const LOOK_FIELDS = [
|
|
4
|
+
range(["starBrightness"], "stars", 0, 2),
|
|
5
|
+
{ path: ["milkyWay"], param: "milkyway", spec: { kind: "onoff" } },
|
|
6
|
+
range(["milkyWayBrightness"], "milkywaybrightness", 0, 2),
|
|
7
|
+
{ path: ["skyVisible"], param: "sky", spec: { kind: "offOnly" } },
|
|
8
|
+
range(["sunGlow", "sizePx"], "sunglow", 0, 400),
|
|
9
|
+
range(["sunGlow", "brightness"], "sunbrightness", 0, 2),
|
|
10
|
+
range(["sunGlow", "scale"], "sunglowscale", 1, 6),
|
|
11
|
+
range(["markerSwapRadiusPx"], "markerpx", 0, 100),
|
|
12
|
+
range(["featureMinBodyPx"], "featurepx", 0, 2000),
|
|
13
|
+
range(["loadFadeSeconds"], "loadfade", 0, 3),
|
|
14
|
+
{ path: ["desktopPictures"], param: "desktop", spec: { kind: "onoff" } },
|
|
15
|
+
];
|
|
16
|
+
/** The name a look is called in a message: `sunGlow.sizePx`. */
|
|
17
|
+
export const lookName = (field) => field.path.join(".");
|
|
18
|
+
/** The value a look has in `look`, or undefined. */
|
|
19
|
+
export function lookValue(look, field) {
|
|
20
|
+
const [first, second] = field.path;
|
|
21
|
+
const top = look[first];
|
|
22
|
+
return (second === undefined ? top : top?.[second]);
|
|
23
|
+
}
|
|
24
|
+
function withValue(look, field, value) {
|
|
25
|
+
const [first, second] = field.path;
|
|
26
|
+
const copy = { ...look };
|
|
27
|
+
copy[first] = second === undefined ? value : { ...(copy[first] ?? {}), [second]: value };
|
|
28
|
+
return copy;
|
|
29
|
+
}
|
|
30
|
+
/** Sets a look in a copy of `look` (used by `Scene.setLook` to build the checked look). */
|
|
31
|
+
export const lookWith = withValue;
|
|
32
|
+
function rawParam(search, param) {
|
|
33
|
+
return new URLSearchParams(search).get(param);
|
|
34
|
+
}
|
|
35
|
+
/** What one address parameter says: the value, or undefined when it is absent or unusable (an unusable number warns on the console, never throws). */
|
|
36
|
+
function fromAddress(search, field) {
|
|
37
|
+
const raw = rawParam(search, field.param);
|
|
38
|
+
if (raw === null)
|
|
39
|
+
return undefined;
|
|
40
|
+
const { spec } = field;
|
|
41
|
+
if (spec.kind === "onoff")
|
|
42
|
+
return raw === "on" ? true : raw === "off" ? false : undefined;
|
|
43
|
+
if (spec.kind === "offOnly")
|
|
44
|
+
return raw === "off" ? false : undefined;
|
|
45
|
+
const value = raw.trim() === "" ? Number.NaN : Number(raw);
|
|
46
|
+
if (!Number.isFinite(value) || value < spec.min || value > spec.max) {
|
|
47
|
+
console.warn(`?${field.param}=${raw} ignored: the value must be a number from ${spec.min} to ${spec.max}`);
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
/** The looks in force: `base` (what the scene set) with the address text laid over it (`search` is empty when the host's `address` option is off). Pure; a live change (T-262) resolves a new base the same way. */
|
|
53
|
+
export function resolveLook(base, search) {
|
|
54
|
+
let look = base ?? {};
|
|
55
|
+
for (const field of LOOK_FIELDS) {
|
|
56
|
+
const asked = fromAddress(search, field);
|
|
57
|
+
if (asked !== undefined)
|
|
58
|
+
look = withValue(look, field, asked);
|
|
59
|
+
}
|
|
60
|
+
return look;
|
|
61
|
+
}
|
package/src/app/mission.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ export interface TrackedReadout {
|
|
|
86
86
|
readonly rangeFromEarthKm: number;
|
|
87
87
|
readonly speedKmS: number | null;
|
|
88
88
|
/** Frame and centre the range and speed are measured in. */
|
|
89
|
-
readonly frame: State["
|
|
89
|
+
readonly frame: State["plane"];
|
|
90
90
|
readonly center: State["center"];
|
|
91
91
|
}
|
|
92
92
|
/** Current-position rows for the bodies whose trajectories cover `timeUtcMs`; the rest are omitted. */
|
package/src/app/mission.js
CHANGED
|
@@ -87,7 +87,7 @@ export function trackedReadouts(bodies, timeUtcMs) {
|
|
|
87
87
|
positionKm: [state.positionKm[0], state.positionKm[1], state.positionKm[2]],
|
|
88
88
|
rangeFromEarthKm: Math.hypot(...state.positionKm),
|
|
89
89
|
speedKmS: state.velocityKmS === undefined ? null : Math.hypot(...state.velocityKmS),
|
|
90
|
-
frame: state.
|
|
90
|
+
frame: state.plane,
|
|
91
91
|
center: state.center,
|
|
92
92
|
});
|
|
93
93
|
}
|
package/src/app/openClock.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { SimulationClock } from "../core/clock.js";
|
|
2
|
+
import { type ShownEvents } from "../core/pacing.js";
|
|
2
3
|
import type { ExperienceDefinition } from "./experienceDefinition.js";
|
|
3
4
|
/**
|
|
4
5
|
* The clock a mounted experience opens with: at its start moment and rate (or at the moment a copied link carried), playing unless the definition says
|
|
5
|
-
* `clock.playing: false`, which leaves it frozen there.
|
|
6
|
+
* `clock.playing: false`, which leaves it frozen there. `shown`: the opening view's events, whose zones alone pace it.
|
|
6
7
|
*/
|
|
7
|
-
export declare function openClock(definition: Pick<ExperienceDefinition, "clock" | "pacing">, linkedTimeUtcMs?: number): SimulationClock;
|
|
8
|
+
export declare function openClock(definition: Pick<ExperienceDefinition, "clock" | "pacing">, linkedTimeUtcMs?: number, shown?: ShownEvents): SimulationClock;
|
package/src/app/openClock.js
CHANGED
|
@@ -2,15 +2,15 @@ import { SimulationClock } from "../core/clock.js";
|
|
|
2
2
|
import { pacedRate } from "../core/pacing.js";
|
|
3
3
|
/**
|
|
4
4
|
* The clock a mounted experience opens with: at its start moment and rate (or at the moment a copied link carried), playing unless the definition says
|
|
5
|
-
* `clock.playing: false`, which leaves it frozen there.
|
|
5
|
+
* `clock.playing: false`, which leaves it frozen there. `shown`: the opening view's events, whose zones alone pace it.
|
|
6
6
|
*/
|
|
7
|
-
export function openClock(definition, linkedTimeUtcMs) {
|
|
7
|
+
export function openClock(definition, linkedTimeUtcMs, shown) {
|
|
8
8
|
const clock = new SimulationClock(definition.clock.startUtcMs);
|
|
9
9
|
clock.setRate(definition.clock.rate);
|
|
10
10
|
if (linkedTimeUtcMs !== undefined)
|
|
11
11
|
clock.seek(linkedTimeUtcMs);
|
|
12
12
|
if (definition.pacing !== undefined)
|
|
13
|
-
clock.setRate(pacedRate(definition.pacing, clock.now()));
|
|
13
|
+
clock.setRate(pacedRate(definition.pacing, clock.now(), shown));
|
|
14
14
|
if (definition.clock.playing !== false)
|
|
15
15
|
clock.play();
|
|
16
16
|
return clock;
|
package/src/app/sceneCamera.js
CHANGED
|
@@ -80,6 +80,15 @@ function applyCameraRequest(input, request) {
|
|
|
80
80
|
camState.transition.fill(0);
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
+
if (request.kind === "pose") {
|
|
84
|
+
// The pose's offset is relative to its object, so the camera follows that object (also while it moves) and eases to the read angles and distance.
|
|
85
|
+
const { view } = request;
|
|
86
|
+
switchFocus(camState, view.focus, focusAbsoluteOf(targets, view.focus));
|
|
87
|
+
camState.targetAzimuth = (view.azimuthDeg * Math.PI) / 180;
|
|
88
|
+
camState.targetElevation = (view.elevationDeg * Math.PI) / 180;
|
|
89
|
+
camState.targetDistance = view.distance;
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
83
92
|
const target = request.kind === "overview" ? frame.centre : request.target;
|
|
84
93
|
const targetBody = targets.bodyIdFor(target);
|
|
85
94
|
switchFocus(camState, target, focusAbsoluteOf(targets, target));
|
package/src/app/sceneFrame.d.ts
CHANGED
|
@@ -22,8 +22,8 @@ import type { StoryMarkerLayer } from "./StoryMarkers.js";
|
|
|
22
22
|
/** What survives from one frame to the next. The component owns one and hands it to every frame. */
|
|
23
23
|
export interface FrameState {
|
|
24
24
|
started: boolean;
|
|
25
|
-
/**
|
|
26
|
-
readonly
|
|
25
|
+
/** Told once, after the scene's first frame is drawn (the host link's `onFirstDraw`); absent when nobody listens. */
|
|
26
|
+
readonly onFirstDraw: (() => void) | undefined;
|
|
27
27
|
/** The composition's span of the previous frame, in scaled units. */
|
|
28
28
|
spanScaled: number;
|
|
29
29
|
lastPolicyId: ScalePolicy["id"];
|
|
@@ -56,7 +56,7 @@ export interface DrawnMemo {
|
|
|
56
56
|
/** Frames since anything last asked for a draw. */
|
|
57
57
|
quietFrames: number;
|
|
58
58
|
}
|
|
59
|
-
export declare function createFrameState(policyId: ScalePolicy["id"]): FrameState;
|
|
59
|
+
export declare function createFrameState(policyId: ScalePolicy["id"], onFirstDraw?: () => void): FrameState;
|
|
60
60
|
/** The DOM layers the frame updates; each is absent until its host mounts it. */
|
|
61
61
|
export interface FrameLayers {
|
|
62
62
|
readonly bodySetLabels: {
|
|
@@ -129,7 +129,7 @@ export declare function viewUpOf(ctx: Pick<FrameContext, "runtime" | "controls">
|
|
|
129
129
|
/** A frame is drawn only once every body's group and orientation node is mounted. */
|
|
130
130
|
export declare function bodiesMounted(runtime: SceneRuntime, refs: BodyRefs): boolean;
|
|
131
131
|
/** Stage 0: the time of this frame; looping playback wraps inside its window first, and other playback stops on the window's edge (a scene with a timeline bar). */
|
|
132
|
-
export declare function frameTime(runtime: SceneRuntime, controls: Pick<SceneControls, "loop" | "paceAuto">): number;
|
|
132
|
+
export declare function frameTime(runtime: SceneRuntime, controls: Pick<SceneControls, "loop" | "paceAuto" | "pace">): number;
|
|
133
133
|
/** Stage 1: brings every view to the time of the frame. Returns the live body-set look. */
|
|
134
134
|
export declare function syncViews(ctx: FrameContext, t: number): BodySetLook;
|
|
135
135
|
/** Stage 2: places the composition about the scene centre and keeps the camera's framing when the scale policy changed. */
|