astraeus 0.6.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.
Files changed (288) hide show
  1. package/CHANGELOG.md +192 -0
  2. package/README.md +205 -34
  3. package/package.json +5 -4
  4. package/src/api/AstraeusScene.d.ts +24 -6
  5. package/src/api/AstraeusScene.js +46 -19
  6. package/src/api/AstraeusScene.node.js +46 -19
  7. package/src/api/assembleScene.d.ts +36 -0
  8. package/src/api/assembleScene.js +175 -0
  9. package/src/api/bodySetChecks.d.ts +10 -0
  10. package/src/api/bodySetChecks.js +117 -0
  11. package/src/api/bodySetInput.d.ts +81 -0
  12. package/src/api/bodySetInput.js +1 -0
  13. package/src/api/containingBlock.d.ts +6 -0
  14. package/src/api/containingBlock.js +16 -0
  15. package/src/api/data.d.ts +17 -5
  16. package/src/api/data.js +28 -10
  17. package/src/api/definitionOf.d.ts +16 -0
  18. package/src/api/definitionOf.js +20 -0
  19. package/src/api/errors.d.ts +61 -1
  20. package/src/api/frozenCopy.d.ts +6 -0
  21. package/src/api/frozenCopy.js +26 -0
  22. package/src/api/group.d.ts +8 -2
  23. package/src/api/group.js +24 -5
  24. package/src/api/index.d.ts +19 -7
  25. package/src/api/index.js +2 -2
  26. package/src/api/index.node.js +2 -2
  27. package/src/api/listeners.d.ts +5 -0
  28. package/src/api/listeners.js +25 -0
  29. package/src/api/look.d.ts +47 -0
  30. package/src/api/look.js +1 -0
  31. package/src/api/lookInput.d.ts +3 -0
  32. package/src/api/lookInput.js +41 -0
  33. package/src/api/moonPanelInput.d.ts +60 -0
  34. package/src/api/moonPanelInput.js +1 -0
  35. package/src/api/mount.d.ts +10 -16
  36. package/src/api/mount.js +27 -11
  37. package/src/api/mount.node.js +27 -11
  38. package/src/api/pathProvenance.d.ts +15 -6
  39. package/src/api/pathProvenance.js +23 -11
  40. package/src/api/pickerInput.d.ts +25 -0
  41. package/src/api/pickerInput.js +1 -0
  42. package/src/api/planBodies.d.ts +72 -0
  43. package/src/api/planBodies.js +300 -0
  44. package/src/api/planBodySets.d.ts +68 -0
  45. package/src/api/planBodySets.js +234 -0
  46. package/src/api/planCamera.d.ts +83 -0
  47. package/src/api/planCamera.js +184 -0
  48. package/src/api/planGroups.d.ts +36 -0
  49. package/src/api/planGroups.js +103 -0
  50. package/src/api/planMoonPanel.d.ts +19 -0
  51. package/src/api/planMoonPanel.js +104 -0
  52. package/src/api/planPaths.d.ts +40 -0
  53. package/src/api/planPaths.js +212 -0
  54. package/src/api/planPicker.d.ts +12 -0
  55. package/src/api/planPicker.js +40 -0
  56. package/src/api/planPlaces.d.ts +16 -0
  57. package/src/api/planPlaces.js +99 -0
  58. package/src/api/planStory.d.ts +26 -0
  59. package/src/api/planStory.js +66 -0
  60. package/src/api/planTimeline.d.ts +27 -0
  61. package/src/api/planTimeline.js +68 -0
  62. package/src/api/planViews.d.ts +25 -0
  63. package/src/api/planViews.js +35 -0
  64. package/src/api/prepared.js +4 -1
  65. package/src/api/renamedInputs.d.ts +15 -0
  66. package/src/api/renamedInputs.js +39 -0
  67. package/src/api/scene.d.ts +176 -65
  68. package/src/api/scene.js +257 -725
  69. package/src/api/sceneFreeze.d.ts +4 -0
  70. package/src/api/sceneFreeze.js +10 -0
  71. package/src/api/sceneReads.d.ts +171 -0
  72. package/src/api/sceneReads.js +6 -0
  73. package/src/api/sphereOfInfluence.d.ts +20 -0
  74. package/src/api/sphereOfInfluence.js +48 -0
  75. package/src/api/story.d.ts +49 -19
  76. package/src/api/story.js +54 -22
  77. package/src/api/sunOrbit.js +9 -11
  78. package/src/api/time.d.ts +2 -1
  79. package/src/api/time.js +2 -1
  80. package/src/api/viewerCamera.d.ts +22 -0
  81. package/src/api/viewerCamera.js +84 -0
  82. package/src/api/viewerClock.d.ts +30 -0
  83. package/src/api/viewerClock.js +85 -0
  84. package/src/api/viewerFirstDraw.d.ts +14 -0
  85. package/src/api/viewerFirstDraw.js +26 -0
  86. package/src/api/viewerHandle.d.ts +79 -0
  87. package/src/api/viewerHandle.js +31 -0
  88. package/src/api/viewerLink.d.ts +91 -13
  89. package/src/api/viewerLink.js +111 -64
  90. package/src/api/viewerLooks.d.ts +19 -0
  91. package/src/api/viewerLooks.js +37 -0
  92. package/src/api/viewerPicker.d.ts +22 -0
  93. package/src/api/viewerPicker.js +49 -0
  94. package/src/api/viewerSelection.d.ts +25 -0
  95. package/src/api/viewerSelection.js +31 -0
  96. package/src/api/viewerViews.d.ts +10 -0
  97. package/src/api/viewerViews.js +18 -0
  98. package/src/api/viewerZones.d.ts +20 -0
  99. package/src/api/viewerZones.js +47 -0
  100. package/src/api/views.d.ts +41 -0
  101. package/src/api/views.js +82 -0
  102. package/src/app/App.d.ts +5 -3
  103. package/src/app/App.js +211 -75
  104. package/src/app/App.node.js +211 -75
  105. package/src/app/AstraeusScene.d.ts +19 -2
  106. package/src/app/AstraeusScene.js +4 -4
  107. package/src/app/BodyView.d.ts +4 -1
  108. package/src/app/BodyView.js +2 -2
  109. package/src/app/CameraController.d.ts +12 -0
  110. package/src/app/CameraController.js +3 -1
  111. package/src/app/DeveloperSettings.d.ts +1 -4
  112. package/src/app/DeveloperSettings.js +6 -10
  113. package/src/app/FeatureMarkers.d.ts +4 -3
  114. package/src/app/FeatureMarkers.js +8 -13
  115. package/src/app/FrameRateSection.js +2 -1
  116. package/src/app/OrbitSetView.js +1 -1
  117. package/src/app/SettingControls.d.ts +11 -3
  118. package/src/app/SettingControls.js +10 -2
  119. package/src/app/SkyView.d.ts +3 -10
  120. package/src/app/SkyView.js +6 -28
  121. package/src/app/StoryMarkers.d.ts +4 -1
  122. package/src/app/StoryMarkers.js +3 -2
  123. package/src/app/TrackedBodyView.d.ts +1 -1
  124. package/src/app/TrackedBodyView.js +20 -11
  125. package/src/app/address.d.ts +16 -0
  126. package/src/app/address.js +31 -0
  127. package/src/app/bodyDraw.d.ts +10 -7
  128. package/src/app/bodyDraw.js +12 -32
  129. package/src/app/bodyMetrics.js +2 -2
  130. package/src/app/bodySet.d.ts +4 -20
  131. package/src/app/bodySet.js +5 -16
  132. package/src/app/debugReadout.js +1 -1
  133. package/src/app/displaySwitches.d.ts +4 -0
  134. package/src/app/displaySwitches.js +6 -0
  135. package/src/app/experienceDefinition.d.ts +14 -23
  136. package/src/app/listSwitch.d.ts +8 -14
  137. package/src/app/listSwitch.js +3 -10
  138. package/src/app/liveLook.d.ts +39 -0
  139. package/src/app/liveLook.js +66 -0
  140. package/src/app/look.d.ts +36 -0
  141. package/src/app/look.js +61 -0
  142. package/src/app/mission.d.ts +16 -3
  143. package/src/app/mission.js +16 -1
  144. package/src/app/openClock.d.ts +3 -2
  145. package/src/app/openClock.js +3 -3
  146. package/src/app/sceneCamera.d.ts +2 -0
  147. package/src/app/sceneCamera.js +23 -0
  148. package/src/app/sceneFrame.d.ts +6 -4
  149. package/src/app/sceneFrame.js +55 -14
  150. package/src/app/sceneHooks.js +3 -2
  151. package/src/app/style.css +114 -139
  152. package/src/app/trackedMetrics.d.ts +10 -3
  153. package/src/app/trackedMetrics.js +22 -11
  154. package/src/app/viewHiding.d.ts +13 -0
  155. package/src/app/viewHiding.js +37 -0
  156. package/src/app/viewLink.d.ts +10 -32
  157. package/src/app/viewLink.js +10 -49
  158. package/src/app/viewerPort.d.ts +56 -0
  159. package/src/app/views.d.ts +32 -0
  160. package/src/app/views.js +2 -0
  161. package/src/assets/bodies/galileanMoons.js +1 -2
  162. package/src/assets/bodies/io.js +2 -2
  163. package/src/assets/bodies/listedMoons.d.ts +1 -1
  164. package/src/assets/bodies/listedMoons.js +2 -3
  165. package/src/assets/bodies/planetSystemMaps.js +2 -3
  166. package/src/assets/bodies/venus.js +2 -6
  167. package/src/assets/catalogue.js +1 -2
  168. package/src/assets/licence.d.ts +3 -3
  169. package/src/assets/licence.js +3 -3
  170. package/src/assets/pictures.d.ts +15 -12
  171. package/src/assets/pictures.js +24 -20
  172. package/src/assets/sky.d.ts +6 -5
  173. package/src/assets/sky.js +6 -9
  174. package/src/assets/visual.d.ts +4 -0
  175. package/src/core/bodies/index.d.ts +0 -4
  176. package/src/core/bodies/index.js +1 -6
  177. package/src/core/bodies/jupiterData.d.ts +0 -1
  178. package/src/core/bodies/jupiterData.js +2 -5
  179. package/src/core/bodies/moonSystem.d.ts +1 -1
  180. package/src/core/bodies/moonSystem.js +102 -55
  181. package/src/core/bodies/outerPlanetRingData.js +2 -2
  182. package/src/core/bodies/planetTrajectory.js +1 -1
  183. package/src/core/bodySetFamilies.d.ts +20 -0
  184. package/src/core/bodySetFamilies.js +14 -0
  185. package/src/core/chebyshevEphemeris.js +1 -1
  186. package/src/core/elementsBody.d.ts +8 -4
  187. package/src/core/elementsBody.js +32 -11
  188. package/src/core/elementsGroup.d.ts +27 -0
  189. package/src/core/elementsGroup.js +85 -0
  190. package/src/core/events.d.ts +2 -0
  191. package/src/core/events.js +2 -0
  192. package/src/core/illumination.js +1 -1
  193. package/src/core/listedOrbitGroup.d.ts +2 -0
  194. package/src/core/listedOrbitGroup.js +11 -7
  195. package/src/core/moonListText.d.ts +6 -0
  196. package/src/core/moonListText.js +19 -0
  197. package/src/core/moonTrajectory.js +1 -1
  198. package/src/core/pacing.d.ts +38 -3
  199. package/src/core/pacing.js +55 -4
  200. package/src/core/planetModels.js +2 -2
  201. package/src/core/planetSeries.d.ts +8 -0
  202. package/src/core/planetSeries.js +16 -2
  203. package/src/core/pointGroup.js +1 -1
  204. package/src/core/provenance.d.ts +2 -1
  205. package/src/core/provenance.js +2 -2
  206. package/src/core/referenceCenters.js +5 -5
  207. package/src/core/sampledTrajectory.js +1 -1
  208. package/src/core/scalePolicy.d.ts +1 -0
  209. package/src/core/startView.d.ts +19 -0
  210. package/src/core/startView.js +28 -0
  211. package/src/core/state.d.ts +6 -2
  212. package/src/core/state.js +3 -3
  213. package/src/core/storyPanels.d.ts +63 -0
  214. package/src/core/storyPanels.js +111 -0
  215. package/src/core/sunCentredSources.d.ts +4 -0
  216. package/src/core/sunCentredSources.js +9 -2
  217. package/src/core/timeInput.d.ts +4 -0
  218. package/src/core/timeInput.js +4 -0
  219. package/src/shell/AstraeusShell.d.ts +17 -3
  220. package/src/shell/AstraeusShell.js +60 -13
  221. package/src/shell/AstraeusShell.node.js +60 -13
  222. package/src/shell/Collapsible.d.ts +4 -3
  223. package/src/shell/Collapsible.js +5 -5
  224. package/src/shell/ControlsDrawer.d.ts +1 -1
  225. package/src/shell/ControlsDrawer.js +3 -1
  226. package/src/shell/DisplaySwitches.d.ts +18 -1
  227. package/src/shell/DisplaySwitches.js +20 -6
  228. package/src/shell/InfoPanel.d.ts +3 -1
  229. package/src/shell/InfoPanel.js +5 -4
  230. package/src/shell/MoonFamilyPanel.js +1 -1
  231. package/src/shell/ObjectControls.d.ts +3 -1
  232. package/src/shell/ObjectControls.js +2 -2
  233. package/src/shell/Sources.d.ts +5 -3
  234. package/src/shell/Sources.js +5 -5
  235. package/src/shell/StoryPanelView.d.ts +4 -3
  236. package/src/shell/StoryPanelView.js +8 -6
  237. package/src/shell/SwitchControl.d.ts +5 -11
  238. package/src/shell/SwitchControl.js +2 -20
  239. package/src/shell/TimelineBar.css +84 -66
  240. package/src/shell/TimelineBar.d.ts +5 -2
  241. package/src/shell/TimelineBar.js +37 -11
  242. package/src/shell/TimelineBar.node.js +37 -11
  243. package/src/shell/TopBar.css +22 -22
  244. package/src/shell/TopBar.d.ts +9 -3
  245. package/src/shell/TopBar.js +5 -5
  246. package/src/shell/TopBar.node.js +5 -5
  247. package/src/shell/bootLoader.d.ts +4 -10
  248. package/src/shell/bootLoader.js +6 -52
  249. package/src/shell/embedded.css +18 -18
  250. package/src/shell/experience.d.ts +1 -1
  251. package/src/shell/moonFamilies.d.ts +2 -6
  252. package/src/shell/moonFamilies.js +2 -18
  253. package/src/shell/phone.css +58 -58
  254. package/src/shell/storyPanels.d.ts +2 -53
  255. package/src/shell/storyPanels.js +1 -106
  256. package/src/shell/style.css +153 -134
  257. package/src/shell/timelineModel.d.ts +13 -0
  258. package/src/shell/timelineModel.js +25 -0
  259. package/src/shell/useDrawers.d.ts +3 -2
  260. package/src/shell/useDrawers.js +4 -3
  261. package/src/shell/viewCamera.d.ts +4 -0
  262. package/src/shell/viewCamera.js +13 -0
  263. package/src/shell/viewerKeys.d.ts +8 -0
  264. package/src/shell/viewerKeys.js +16 -0
  265. package/src/synthetic/syntheticDefinition.js +20 -24
  266. package/src/synthetic/syntheticJourneyScene.js +14 -4
  267. package/src/synthetic/syntheticProbeDefinition.js +2 -1
  268. package/src/synthetic/syntheticViewsDefinition.d.ts +3 -0
  269. package/src/synthetic/syntheticViewsDefinition.js +38 -0
  270. package/data/moons/jupiter.json +0 -3333
  271. package/data/moons/neptune.json +0 -555
  272. package/data/moons/pluto.json +0 -205
  273. package/data/moons/saturn.json +0 -8267
  274. package/data/moons/uranus.json +0 -887
  275. package/src/app/addressNavigation.d.ts +0 -17
  276. package/src/app/addressNavigation.js +0 -16
  277. package/src/assets/bodies/jupiterMoonCatalogue.d.ts +0 -3
  278. package/src/assets/bodies/jupiterMoonCatalogue.js +0 -4
  279. package/src/assets/bodies/outerPlanetCatalogues.d.ts +0 -7
  280. package/src/assets/bodies/outerPlanetCatalogues.js +0 -8
  281. package/src/assets/bodies/swiftTuttle.d.ts +0 -12
  282. package/src/assets/bodies/swiftTuttle.js +0 -13
  283. package/src/assets/moonCatalogue.d.ts +0 -49
  284. package/src/assets/moonCatalogue.js +0 -80
  285. package/src/core/bodies/outerPlanetData.d.ts +0 -4
  286. package/src/core/bodies/outerPlanetData.js +0 -13
  287. package/src/core/bodies/swiftTuttle.d.ts +0 -46
  288. package/src/core/bodies/swiftTuttle.js +0 -106
@@ -4,6 +4,19 @@ import type { Provenance } from "../core/provenance.js";
4
4
  import type { State } from "../core/state.js";
5
5
  import type { TimeBounds, Trajectory } from "../core/trajectory.js";
6
6
  import type { PathSamples } from "./pathRules.js";
7
+ /** One stretch of a path's line, `[startUtcMs, endUtcMs)` (the last may include its end), drawn against `body`. */
8
+ export interface LineStretch {
9
+ readonly startUtcMs: number;
10
+ readonly endUtcMs: number;
11
+ readonly body: string;
12
+ }
13
+ /** The body a path's line is drawn against at `timeUtcMs`: the one named, the covering stretch's, or `fallback` (the scene centre). A shared boundary belongs to the later stretch. */
14
+ export declare function lineAgainstAt(lineFixedTo: TrackedBody["lineFixedTo"], timeUtcMs: number, fallback: string): string;
15
+ /** Every body a path's line is drawn against, in order, with the `lineFixedTo` index of each (a plain id is index null). */
16
+ export declare function lineBodies(lineFixedTo: TrackedBody["lineFixedTo"]): readonly {
17
+ readonly index: number | null;
18
+ readonly body: string;
19
+ }[];
7
20
  /** A bounded trajectory the scene can draw. Nothing here names a mission. */
8
21
  export interface TrackedBody {
9
22
  readonly id: string;
@@ -20,8 +33,8 @@ export interface TrackedBody {
20
33
  readonly anchorLabels?: readonly string[];
21
34
  /** Published position discrepancy per reconstruction segment, in time order. */
22
35
  readonly positionDiscrepancies?: readonly PositionDiscrepancy[];
23
- /** The body the line is drawn against, at each sample's own time; absent: the scene centre. */
24
- readonly lineFixedTo?: string;
36
+ /** The body the line is drawn against, at each sample's own time; absent: the scene centre. A list draws each stretch against its own body (time outside every stretch: the scene centre). */
37
+ readonly lineFixedTo?: string | readonly LineStretch[];
25
38
  /** The trajectory's own Provenance, passed through unchanged. */
26
39
  readonly provenance?: Provenance;
27
40
  }
@@ -73,7 +86,7 @@ export interface TrackedReadout {
73
86
  readonly rangeFromEarthKm: number;
74
87
  readonly speedKmS: number | null;
75
88
  /** Frame and centre the range and speed are measured in. */
76
- readonly frame: State["frame"];
89
+ readonly frame: State["plane"];
77
90
  readonly center: State["center"];
78
91
  }
79
92
  /** Current-position rows for the bodies whose trajectories cover `timeUtcMs`; the rest are omitted. */
@@ -1,3 +1,18 @@
1
+ /** The body a path's line is drawn against at `timeUtcMs`: the one named, the covering stretch's, or `fallback` (the scene centre). A shared boundary belongs to the later stretch. */
2
+ export function lineAgainstAt(lineFixedTo, timeUtcMs, fallback) {
3
+ if (lineFixedTo === undefined)
4
+ return fallback;
5
+ if (typeof lineFixedTo === "string")
6
+ return lineFixedTo;
7
+ const last = lineFixedTo[lineFixedTo.length - 1];
8
+ return lineFixedTo.find((stretch) => timeUtcMs >= stretch.startUtcMs && timeUtcMs < stretch.endUtcMs)?.body ?? (last !== undefined && timeUtcMs === last.endUtcMs ? last.body : fallback);
9
+ }
10
+ /** Every body a path's line is drawn against, in order, with the `lineFixedTo` index of each (a plain id is index null). */
11
+ export function lineBodies(lineFixedTo) {
12
+ if (lineFixedTo === undefined)
13
+ return [];
14
+ return typeof lineFixedTo === "string" ? [{ index: null, body: lineFixedTo }] : lineFixedTo.map((stretch, index) => ({ index, body: stretch.body }));
15
+ }
1
16
  /** The segment covering `timeUtcMs`; a shared boundary belongs to the later segment. */
2
17
  export function discrepancyAt(body, timeUtcMs) {
3
18
  const segments = body.positionDiscrepancies ?? [];
@@ -72,7 +87,7 @@ export function trackedReadouts(bodies, timeUtcMs) {
72
87
  positionKm: [state.positionKm[0], state.positionKm[1], state.positionKm[2]],
73
88
  rangeFromEarthKm: Math.hypot(...state.positionKm),
74
89
  speedKmS: state.velocityKmS === undefined ? null : Math.hypot(...state.velocityKmS),
75
- frame: state.frame,
90
+ frame: state.plane,
76
91
  center: state.center,
77
92
  });
78
93
  }
@@ -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;
@@ -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;
@@ -27,6 +27,8 @@ export interface CameraStepInput {
27
27
  }
28
28
  /** Keeps the same relative framing when the visual scale changes (physical state is untouched). */
29
29
  export declare function rescaleCameraForPolicy(camState: OrbitCameraState, sceneCenter: BodyId, factor: number): void;
30
+ /** Where the camera's target is this frame: the held point after a `hold` request, else the focus. */
31
+ export declare function cameraTargetAbsolute(camState: OrbitCameraState, targets: SceneTargets): RenderVector;
30
32
  /**
31
33
  * One frame of camera decisions before the camera is posed: the opening view, a pending request, a change of up, and the zoom limits.
32
34
  * Returns the body (or other id) the camera is focused on.
@@ -9,6 +9,13 @@ export function rescaleCameraForPolicy(camState, sceneCenter, factor) {
9
9
  camState.distance *= factor;
10
10
  for (let i = 0; i < 3; i += 1)
11
11
  camState.transition[i] *= factor;
12
+ if (camState.fixedPoint !== null)
13
+ for (let i = 0; i < 3; i += 1)
14
+ camState.fixedPoint[i] *= factor;
15
+ }
16
+ /** Where the camera's target is this frame: the held point after a `hold` request, else the focus. */
17
+ export function cameraTargetAbsolute(camState, targets) {
18
+ return camState.fixedPoint ?? focusAbsoluteOf(targets, camState.focus);
12
19
  }
13
20
  /** An explicit start view wins over the overview rule: the camera opens exactly there (the zoom limits still apply). */
14
21
  function applyStartView(camState, view) {
@@ -66,6 +73,22 @@ function faceParent(camState, targets, viewUp, body, parent) {
66
73
  }
67
74
  function applyCameraRequest(input, request) {
68
75
  const { camState, targets, frame, catalogue, viewUp } = input;
76
+ if (request.kind === "hold") {
77
+ // The target stops where it is (including any tween still running); angles and distance are untouched. Scene-frame state only: nothing in State changes.
78
+ const now = cameraTargetAbsolute(camState, targets);
79
+ camState.fixedPoint = [now[0] + camState.transition[0], now[1] + camState.transition[1], now[2] + camState.transition[2]];
80
+ camState.transition.fill(0);
81
+ return;
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
+ }
69
92
  const target = request.kind === "overview" ? frame.centre : request.target;
70
93
  const targetBody = targets.bodyIdFor(target);
71
94
  switchFocus(camState, target, focusAbsoluteOf(targets, target));
@@ -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
- /** The loading cover's showing this scene mounted under; its first frame hides only that one (I-074). */
26
- readonly coverShowing: number;
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. */
@@ -142,6 +142,8 @@ export declare function publishOrbitHeadGap(canvas: HTMLCanvasElement, views: re
142
142
  export declare function publishCanvasReadouts(ctx: FrameContext): void;
143
143
  /** Stage 5: places every view about the floating origin and publishes the views' readouts. Returns the hover brightness gain. */
144
144
  export declare function placeViews(ctx: FrameContext, t: number, placed: PlacedScene, setLook: BodySetLook): number;
145
+ /** Stage 5b: shows or hides each drawn group by the current view's hidden ids (bodies, paths, point groups, body sets). One set, read here; nothing is rebuilt. */
146
+ export declare function applyViewVisibility(ctx: FrameContext): void;
145
147
  /** A mounted body's drawn sphere and radius for the feature markers, or null when the body is not drawn as a sphere. */
146
148
  export declare function featureHostOf(assets: readonly BodyAsset[], parts: ReadonlyMap<BodyId, BodyParts>, id: string, policy: ScalePolicy): FeatureHost | null;
147
149
  /** Stage 6: updates the overlay layers (names, story and feature markers) and rebuilds what a tap or hover can pick. */
@@ -1,11 +1,10 @@
1
- import { bootShowing, hideBootLoader } from "../shell/bootLoader.js";
2
1
  import { drawnRadii } from "./bodyDraw.js";
3
2
  import { DEFAULT_BODY_SET_LOOK, familyColorOf } from "./bodySet.js";
4
3
  import { applyPacing } from "../core/pacing.js";
5
4
  import { poseCamera, resolveCamera } from "./CameraController.js";
6
5
  import { DEFAULT_CAMERA_FAR } from "./experienceDefinition.js";
7
6
  import { DEFAULT_FEATURE_MIN_BODY_PX } from "./FeatureMarkers.js";
8
- import { rescaleCameraForPolicy, stepCameraTarget } from "./sceneCamera.js";
7
+ import { cameraTargetAbsolute, rescaleCameraForPolicy, stepCameraTarget } from "./sceneCamera.js";
9
8
  import { buildFrameReadout, publishBodyData, publishPathData, publishPointsData, publishSceneData, recordFrameStats } from "./sceneDebug.js";
10
9
  import { focusRadius, liveReach } from "./sceneFraming.js";
11
10
  import { bodyScreenReadouts, placeBodies, swapSmallBodiesToMarkers } from "./sceneBodies.js";
@@ -14,14 +13,14 @@ import { bodyAbsolute, placeComposition } from "./sceneLayout.js";
14
13
  import { placeBodyLights } from "./sceneLights.js";
15
14
  import { clampHoverBrightness, HOVER_BRIGHTNESS_DEFAULT, hoverTarget, pickCandidatesOf } from "./scenePicking.js";
16
15
  import { updateSky } from "./sceneSky.js";
17
- import { focusAbsoluteOf, labelPositionOf } from "./sceneTargets.js";
16
+ import { labelPositionOf } from "./sceneTargets.js";
18
17
  import { viewFromAngles } from "./viewLink.js";
19
18
  import { EQUATORIAL_UP } from "./viewUp.js";
20
19
  /** Floating-origin rebase threshold in scaled units (Earth radii). */
21
20
  const REBASE_THRESHOLD = 1;
22
- export function createFrameState(policyId) {
21
+ export function createFrameState(policyId, onFirstDraw) {
23
22
  return {
24
- started: false, coverShowing: bootShowing(), spanScaled: 6, lastPolicyId: policyId, lastUp: null, pickables: [], hoverPoint: null,
23
+ started: false, onFirstDraw, spanScaled: 6, lastPolicyId: policyId, lastUp: null, pickables: [], hoverPoint: null,
25
24
  drawThisFrame: true, framesDrawn: 0, wakes: 0,
26
25
  drawn: { timeUtcMs: Number.NaN, pose: [], size: "", controls: new Map(), wakes: 0, mounted: -1, quietFrames: 0 },
27
26
  };
@@ -41,7 +40,7 @@ export function frameTime(runtime, controls) {
41
40
  else if (runtime.stopAtWindow === true && runtime.loopWindow !== undefined)
42
41
  runtime.clock.stopWithin(runtime.loopWindow);
43
42
  if (controls.paceAuto === true && runtime.pacing !== undefined)
44
- applyPacing(runtime.clock, runtime.pacing);
43
+ applyPacing(runtime.clock, runtime.pacing, controls.pace);
45
44
  return runtime.clock.now();
46
45
  }
47
46
  /** Stage 1: brings every view to the time of the frame. Returns the live body-set look. */
@@ -103,11 +102,13 @@ export function stepAndPoseCamera(ctx, t, placed) {
103
102
  const reach = liveReach(runtime.cameraReach, policy, camera.aspect);
104
103
  const focusBody = stepCameraTarget({ camState: orbit, controls, targets, frame, catalogue, reach, fovDeg: camera.fov, viewUp, firstFrame, previousUp: state.lastUp });
105
104
  state.lastUp = viewUp;
106
- resolveCamera(orbit, focusAbsoluteOf(targets, orbit.focus), ctx.origin, ctx.delta, REBASE_THRESHOLD, viewUp);
105
+ resolveCamera(orbit, cameraTargetAbsolute(orbit, targets), ctx.origin, ctx.delta, REBASE_THRESHOLD, viewUp);
107
106
  placeBodies(ctx.assets, placed.composed.states, ctx.bodyRefs, policy, ctx.origin);
108
107
  poseCamera(camera, orbit, focusRadius(focusBody, policy, catalogue), ctx.origin, reach.far ?? DEFAULT_CAMERA_FAR, viewUp);
109
- if (firstFrame)
110
- requestAnimationFrame(() => hideBootLoader(state.coverShowing));
108
+ if (firstFrame && state.onFirstDraw !== undefined) {
109
+ const told = state.onFirstDraw;
110
+ requestAnimationFrame(told);
111
+ }
111
112
  controls.viewReadout = viewFromAngles(orbit.focus, orbit.azimuth, orbit.elevation, orbit.distance);
112
113
  return { targets };
113
114
  }
@@ -127,8 +128,12 @@ export function publishCanvasReadouts(ctx) {
127
128
  const { controls, camera, canvas, size, views } = ctx;
128
129
  const markerBodies = swapSmallBodiesToMarkers(ctx.assets, ctx.bodyRefs, camera, camera.fov, size.height, controls.policy, controls.bodyMarker);
129
130
  publishSceneData(canvas, { markerBodies, viewUp: viewUpOf(ctx), markerMinSpherePx: controls.bodyMarker.minSpherePx });
130
- if (views.skyView !== null)
131
- updateSky(views.skyView, camera, canvas, controls, controls.frameStats !== null);
131
+ if (views.skyView !== null) {
132
+ if (controls.skyVisible !== undefined)
133
+ views.skyView.group.visible = controls.skyVisible;
134
+ if (controls.skyVisible !== false)
135
+ updateSky(views.skyView, camera, canvas, controls, controls.frameStats !== null);
136
+ }
132
137
  }
133
138
  /** Stage 5: places every view about the floating origin and publishes the views' readouts. Returns the hover brightness gain. */
134
139
  export function placeViews(ctx, t, placed, setLook) {
@@ -156,12 +161,46 @@ export function placeViews(ctx, t, placed, setLook) {
156
161
  publishPointsData(canvas, views.groupViews, camera, views.bodySetViews);
157
162
  return hoverGain;
158
163
  }
164
+ /** Stage 5b: shows or hides each drawn group by the current view's hidden ids (bodies, paths, point groups, body sets). One set, read here; nothing is rebuilt. */
165
+ export function applyViewVisibility(ctx) {
166
+ const hidden = ctx.controls.viewHidden?.objects;
167
+ const { views, bodyRefs } = ctx;
168
+ const show = (id, group) => { group.visible = hidden?.has(id) !== true; };
169
+ for (const [id, group] of bodyRefs.groups)
170
+ show(id, group);
171
+ for (const view of views.trackedViews)
172
+ show(view.body.id, view.group);
173
+ for (const view of views.groupViews)
174
+ show(view.id, view.group);
175
+ for (const view of views.sunCentredViews)
176
+ show(view.id, view.group);
177
+ // A line follows the body or set it belongs to (the link the line already carries), so a view never names orbit lines.
178
+ const showOwned = (id, owner, group) => { group.visible = hidden?.has(id) !== true && hidden?.has(owner) !== true; };
179
+ for (const view of views.compositionPaths)
180
+ showOwned(view.id, String(view.layer.source.body), view.group);
181
+ for (const view of views.bodySetViews)
182
+ show(view.id, view.group);
183
+ for (const view of views.orbitSetViews)
184
+ showOwned(view.id, view.layer.id, view.group);
185
+ }
159
186
  /** A mounted body's drawn sphere and radius for the feature markers, or null when the body is not drawn as a sphere. */
160
187
  export function featureHostOf(assets, parts, id, policy) {
161
188
  const sphere = parts.get(id)?.sphere;
162
189
  const asset = assets.find((candidate) => candidate.definition.id === id);
163
190
  return sphere === undefined || asset === undefined ? null : { sphere, radius: drawnRadii(asset.definition, policy).equatorial };
164
191
  }
192
+ /** What the labels and taps see under the current view: the objects and body sets it shows, and the label-hidden ids with the view's own added. Allocates only when a view hides something. */
193
+ function shownUnderView(ctx) {
194
+ const { controls, views } = ctx;
195
+ const hidden = controls.viewHidden?.objects;
196
+ if (hidden === undefined || hidden.size === 0)
197
+ return { objects: controls.labelObjects, bodySetViews: views.bodySetViews, hiddenLabels: controls.hiddenLabels };
198
+ return {
199
+ objects: controls.labelObjects.filter((object) => !hidden.has(object.id)),
200
+ bodySetViews: views.bodySetViews.filter((view) => !hidden.has(view.id)),
201
+ hiddenLabels: new Set([...(controls.hiddenLabels ?? []), ...hidden]),
202
+ };
203
+ }
165
204
  /** Stage 6: updates the overlay layers (names, story and feature markers) and rebuilds what a tap or hover can pick. */
166
205
  export function updateOverlays(ctx, t, step, hoverGain) {
167
206
  const { controls, camera, canvas, size, origin, state, layers } = ctx;
@@ -169,13 +208,14 @@ export function updateOverlays(ctx, t, step, hoverGain) {
169
208
  publishBodyData(canvas, bodyScreens);
170
209
  layers.anchorLabels.current?.update(controls.showAnchorLabels, camera, size.width, size.height);
171
210
  const positionFor = (id) => labelPositionOf(step.targets, id);
172
- layers.sceneLabels.current?.update(positionFor, camera, size.width, size.height, origin, controls.selectedObjectId, controls.hiddenLabels);
173
- state.pickables = pickCandidatesOf({ objects: controls.labelObjects, bodyIdFor: ctx.bodyIdFor, bodyScreens, widthPx: size.width, heightPx: size.height, labelRects: layers.sceneLabels.current?.shownRects, canvas, bodySetViews: ctx.views.bodySetViews });
211
+ const shown = shownUnderView(ctx);
212
+ layers.sceneLabels.current?.update(positionFor, camera, size.width, size.height, origin, controls.selectedObjectId, shown.hiddenLabels);
213
+ state.pickables = pickCandidatesOf({ objects: shown.objects, bodyIdFor: ctx.bodyIdFor, bodyScreens, widthPx: size.width, heightPx: size.height, labelRects: layers.sceneLabels.current?.shownRects, canvas, bodySetViews: shown.bodySetViews });
174
214
  const hover = state.hoverPoint === null ? null : hoverTarget(state.pickables, state.hoverPoint.x, state.hoverPoint.y, "mouse");
175
215
  canvas.style.cursor = hover === null ? "" : "pointer";
176
216
  canvas.dataset.pickHover = hover ?? "";
177
217
  layers.sceneLabels.current?.setHover(hover, hoverGain);
178
- layers.storyMarkers.current?.update(positionFor, camera, size.width, size.height, origin, controls.openStoryPanelId ?? null, t);
218
+ layers.storyMarkers.current?.update(positionFor, camera, size.width, size.height, origin, controls.openStoryPanelId ?? null, t, controls.viewHidden);
179
219
  const featureReadout = layers.featureMarkers.current?.update((id) => featureHostOf(ctx.assets, ctx.bodyRefs.parts, id, controls.policy), camera, camera.fov, size.width, size.height, controls.openFeatureKey ?? null, controls.featureMinBodyPx ?? DEFAULT_FEATURE_MIN_BODY_PX);
180
220
  if (featureReadout !== null && featureReadout !== undefined)
181
221
  canvas.dataset.featureMarkers = JSON.stringify(featureReadout);
@@ -271,6 +311,7 @@ export function runFrame(ctx) {
271
311
  const placed = placeScene(ctx, t);
272
312
  const step = stepAndPoseCamera(ctx, t, placed);
273
313
  publishCanvasReadouts(ctx);
314
+ applyViewVisibility(ctx);
274
315
  const hoverGain = placeViews(ctx, t, placed, setLook);
275
316
  updateOverlays(ctx, t, step, hoverGain);
276
317
  placeLightsAndReadout(ctx, t, placed);
@@ -1,6 +1,7 @@
1
1
  // Scene React hooks: host-layer lifetime, sky stars loading and the scene views.
2
2
  import { useEffect, useMemo } from "react";
3
- import { loadStarCatalogue } from "../assets/sky.js";
3
+ import { NO_PICTURES } from "../assets/pictures.js";
4
+ import { loadStarCatalogue, milkyWayPicture } from "../assets/sky.js";
4
5
  import { compositionPathView, createPathViews } from "./PathView.js";
5
6
  import { BodySetView } from "./BodySetView.js";
6
7
  import { OrbitSetView } from "./OrbitSetView.js";
@@ -57,7 +58,7 @@ export function useSceneViews(runtime, gl) {
57
58
  const groupViews = useMemo(() => runtime.groups.map((layer) => new PointsView(layer)), [runtime.groups]);
58
59
  const sunCentredViews = useMemo(() => createPathViews(runtime.paths ?? []), [runtime.paths]);
59
60
  const compositionPaths = useMemo(() => (runtime.composition?.paths ?? []).map((path) => compositionPathView(path, runtime.resolver, runtime.catalogue)), [runtime.composition, runtime.resolver, runtime.catalogue]);
60
- const skyView = useMemo(() => (runtime.sky?.visible ? new SkyView({ starBrightness: runtime.sky.starBrightness, milkyWayBrightness: runtime.sky.milkyWayBrightness, pixelRatio: gl.getPixelRatio(), maxAnisotropy: gl.capabilities.getMaxAnisotropy(), milkyWay: runtime.sky.milkyWay, picture: null }) : null), [runtime.sky, gl]);
61
+ const skyView = useMemo(() => (runtime.sky !== undefined && (runtime.sky.visible || runtime.sky.live === true) ? new SkyView({ starBrightness: runtime.sky.starBrightness, milkyWayBrightness: runtime.sky.milkyWayBrightness, pixelRatio: gl.getPixelRatio(), maxAnisotropy: gl.capabilities.getMaxAnisotropy(), milkyWay: runtime.sky.milkyWay, picture: null, pictureSet: milkyWayPicture(runtime.pictures ?? NO_PICTURES) }) : null), [runtime.sky, runtime.pictures, gl]);
61
62
  const bodySetViews = useMemo(() => (runtime.bodySets ?? []).map((layer) => new BodySetView(layer)), [runtime.bodySets]);
62
63
  const orbitSetViews = useMemo(() => (runtime.bodySets ?? []).map((layer) => new OrbitSetView(layer)), [runtime.bodySets]);
63
64
  useEffect(() => () => { for (const view of bodySetViews)