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
@@ -18,7 +18,7 @@ export function AstraeusScene(props) {
18
18
  const layers = useMemo(() => assignBodyLayers(runtime.bodies, TRACK_LAYER, catalogue), [runtime.bodies, catalogue]);
19
19
  const lightLayers = useMemo(() => runtime.bodies.filter((id) => catalogue.get(id).visual.light !== undefined).map((id) => layers.get(id)), [runtime.bodies, layers, catalogue]);
20
20
  // One frame state for the whole canvas: the scene contents decide whether a frame is drawn and the layered render obeys.
21
- const frameState = useRef(createFrameState(props.controls.policy.id));
21
+ const frameState = useRef(createFrameState(props.controls.policy.id, props.onFirstDraw));
22
22
  return (_jsxs(Canvas, { camera: { fov: 45, near: 0.05, far: runtime.cameraReach.far ?? DEFAULT_CAMERA_FAR },
23
23
  // Logarithmic depth (O-048 T-204, I-117): a planet near the camera keeps its depth precision however far the far plane reaches. Every custom shader in src/app carries the log-depth chunks (tests/logDepth.test.ts).
24
24
  gl: { antialias: true, logarithmicDepthBuffer: true }, style: { background: "#000000" }, "data-testid": "earth-moon-canvas", "data-scene-center": runtime.sceneCenter, "data-bodies": runtime.bodies.join(","), "data-lighting": "per-body", "data-composition-paths": runtime.composition?.paths?.length ?? 0, "data-point-groups": runtime.groups.length, "data-sun-centred": (runtime.sun === undefined ? 0 : 1) + (runtime.paths?.length ?? 0), "data-rings": runtime.bodies.map((id) => (runtime.overrides?.get(id)?.rings ?? catalogue.get(id).visual.rings)?.bands.length ?? 0).reduce((sum, n) => sum + n, 0), children: [_jsx(SceneContents, { ...props, layers: layers, frameState: frameState }), _jsx(LayeredRender, { lightLayers: lightLayers, state: frameState })] }));
@@ -40,10 +40,10 @@ function SceneContents({ runtime, controls, readout, layers, frameState }) {
40
40
  const layerRefs = useOverlayLayers(gl.domElement, controls, trackedViews, bodySetViews);
41
41
  useScenePointer(gl.domElement, runtime, controls, catalogue, orbit, frameState);
42
42
  useSceneFrame(rootRef, { runtime, controls, readout, catalogue, origin, orbit, state: frameState, assets, bodyRefs, lightRefs, placement, views, layers: layerRefs, bodyFamilies, readoutPair, pairLabels });
43
- return (_jsxs("group", { ref: rootRef, children: [assets.map((asset) => (_jsx(SceneBody, { asset: asset, layer: layers.get(asset.definition.id), controls: controls, desktopTextures: runtime.desktopTextures === true, ringLookOf: ringLookOf, onParts: partsFor.get(asset.definition.id), groupRef: refFor(groupRefs.current, asset.definition.id), orientRef: refFor(orientRefs.current, asset.definition.id), lightRef: refFor(lightRefs.current, asset.definition.id) }, asset.definition.id))), skyView !== null && _jsx("primitive", { object: skyView.group }), compositionPaths.map((view) => _jsx("primitive", { object: view.group }, view.id)), trackedViews.map((view) => _jsx("primitive", { object: view.group }, view.body.id)), groupViews.map((view) => _jsx("primitive", { object: view.group }, view.id)), sunCentredViews.map((view) => _jsx("primitive", { object: view.group }, view.id)), bodySetViews.map((view) => _jsx("primitive", { object: view.group }, view.id)), orbitSetViews.map((view) => _jsx("primitive", { object: view.group }, view.id))] }));
43
+ return (_jsxs("group", { ref: rootRef, children: [assets.map((asset) => (_jsx(SceneBody, { asset: asset, layer: layers.get(asset.definition.id), controls: controls, desktopTextures: runtime.desktopTextures === true, pictures: runtime.pictures, ringLookOf: ringLookOf, onParts: partsFor.get(asset.definition.id), groupRef: refFor(groupRefs.current, asset.definition.id), orientRef: refFor(orientRefs.current, asset.definition.id), lightRef: refFor(lightRefs.current, asset.definition.id) }, asset.definition.id))), skyView !== null && _jsx("primitive", { object: skyView.group }), compositionPaths.map((view) => _jsx("primitive", { object: view.group }, view.id)), trackedViews.map((view) => _jsx("primitive", { object: view.group }, view.body.id)), groupViews.map((view) => _jsx("primitive", { object: view.group }, view.id)), sunCentredViews.map((view) => _jsx("primitive", { object: view.group }, view.id)), bodySetViews.map((view) => _jsx("primitive", { object: view.group }, view.id)), orbitSetViews.map((view) => _jsx("primitive", { object: view.group }, view.id))] }));
44
44
  }
45
45
  /** One catalogued body: its view and, when its record has a light, the ambient and directional light on its layer. */
46
- function SceneBody({ asset, layer, controls, desktopTextures, ringLookOf, onParts, groupRef, orientRef, lightRef }) {
46
+ function SceneBody({ asset, layer, controls, desktopTextures, pictures, ringLookOf, onParts, groupRef, orientRef, lightRef }) {
47
47
  const light = asset.visual.light;
48
- return (_jsxs("group", { children: [_jsx(BodyView, { asset: asset, policy: controls.policy, desktopTextures: desktopTextures, layer: layer, markerLayer: TRACK_LAYER, markerPx: controls.bodyMarker.markerPx, glowLook: controls.glowLook, ringLookOf: ringLookOf, onParts: onParts, groupRef: groupRef, orientRef: orientRef }), light !== undefined && (_jsxs(_Fragment, { children: [_jsx("ambientLight", { layers: layer, intensity: light.ambient }), _jsx("directionalLight", { ref: lightRef, layers: layer, intensity: light.directional })] }))] }));
48
+ return (_jsxs("group", { children: [_jsx(BodyView, { asset: asset, policy: controls.policy, desktopTextures: desktopTextures, pictures: pictures, layer: layer, markerLayer: TRACK_LAYER, markerPx: controls.bodyMarker.markerPx, glowLook: controls.glowLook, ringLookOf: ringLookOf, onParts: onParts, groupRef: groupRef, orientRef: orientRef }), light !== undefined && (_jsxs(_Fragment, { children: [_jsx("ambientLight", { layers: layer, intensity: light.ambient }), _jsx("directionalLight", { ref: lightRef, layers: layer, intensity: light.directional })] }))] }));
49
49
  }
@@ -1,5 +1,6 @@
1
1
  import { type Group } from "three";
2
2
  import type { BodyAsset } from "../assets/catalogue.js";
3
+ import type { Pictures } from "../assets/pictures.js";
3
4
  import type { ScalePolicy } from "../core/scalePolicy.js";
4
5
  import { type RingLook } from "../assets/rings.js";
5
6
  import { type GlowLook } from "./bodyDraw.js";
@@ -18,6 +19,8 @@ interface BodyViewProps {
18
19
  readonly markerPx?: number;
19
20
  /** The experience's opt-in to desktop texture variants (default off). */
20
21
  readonly desktopTextures?: boolean;
22
+ /** The pictures this viewer was given; a look naming a picture not held here is a flat colour. */
23
+ readonly pictures?: Pictures;
21
24
  /** The live halo settings for a body whose record has a glow. */
22
25
  readonly glowLook?: GlowLook;
23
26
  /** The group the scene positions. */
@@ -33,5 +36,5 @@ interface BodyViewProps {
33
36
  * Draws any catalogued body from its visual record: a sphere or spheroid with an optional atmosphere, or a marker. A sphere also carries a
34
37
  * hidden marker at the same place; the scene shows it instead of the sphere when the sphere would be smaller than a few pixels.
35
38
  */
36
- export declare function BodyView({ asset, policy, layer, markerLayer, markerPx, glowLook, desktopTextures, groupRef, orientRef, onParts, ringLookOf }: BodyViewProps): import("react").JSX.Element;
39
+ export declare function BodyView({ asset, policy, layer, markerLayer, markerPx, glowLook, desktopTextures, pictures, groupRef, orientRef, onParts, ringLookOf }: BodyViewProps): import("react").JSX.Element;
37
40
  export {};
@@ -12,8 +12,8 @@ import { applyGlowLook, createGlow, createMarker, describeBody, DEFAULT_BODY_MAR
12
12
  * Draws any catalogued body from its visual record: a sphere or spheroid with an optional atmosphere, or a marker. A sphere also carries a
13
13
  * hidden marker at the same place; the scene shows it instead of the sphere when the sphere would be smaller than a few pixels.
14
14
  */
15
- export function BodyView({ asset, policy, layer, markerLayer, markerPx = DEFAULT_BODY_MARKER.markerPx, glowLook, desktopTextures = false, groupRef, orientRef, onParts, ringLookOf }) {
16
- const plan = describeBody(asset, policy, desktopTextures);
15
+ export function BodyView({ asset, policy, layer, markerLayer, markerPx = DEFAULT_BODY_MARKER.markerPx, glowLook, desktopTextures = false, pictures, groupRef, orientRef, onParts, ringLookOf }) {
16
+ const plan = describeBody(asset, policy, desktopTextures, pictures);
17
17
  // A body with a halo draws no marker dot: the halo is its marker.
18
18
  const marker = useMemo(() => (plan.kind === "marker" && asset.visual.glow === undefined ? createMarker(asset, layer).group : null), [asset, plan.kind, layer]);
19
19
  const standIn = useMemo(() => (plan.kind === "sphere" ? createMarker(asset, markerLayer, undefined, markerPx).group : null), [asset, plan.kind, markerLayer, markerPx]);
@@ -2,6 +2,7 @@ import { PerspectiveCamera } from "three";
2
2
  import type { FloatingOrigin } from "./floatingOrigin.js";
3
3
  import type { RenderVector } from "./renderCoordinates.js";
4
4
  import { type PickPointer } from "./scenePicking.js";
5
+ import type { StartView } from "./viewLink.js";
5
6
  /** The id of a catalogued body, or of any tracked trajectory body, group or path. */
6
7
  export type FocusId = string;
7
8
  /** Focus re-frames the target; follow keeps the current framing; overview frames Earth and Moon. */
@@ -10,6 +11,15 @@ export type CameraRequest = {
10
11
  readonly target: FocusId;
11
12
  } | {
12
13
  readonly kind: "overview";
14
+ }
15
+ /** Holds the camera where it is: its target becomes the point it looks at now, fixed in the scene frame; the pose is kept. A later focus, follow or overview request replaces it. */
16
+ | {
17
+ readonly kind: "hold";
18
+ }
19
+ /** Puts the camera back on a pose read earlier: it follows the pose's object and eases to its angles and distance (the offset is the object's own, so a moving object is followed from where it is now). */
20
+ | {
21
+ readonly kind: "pose";
22
+ readonly view: StartView;
13
23
  };
14
24
  export interface OrbitCameraState {
15
25
  azimuth: number;
@@ -20,6 +30,8 @@ export interface OrbitCameraState {
20
30
  distance: number;
21
31
  targetDistance: number;
22
32
  focus: FocusId;
33
+ /** Set by a `hold` request: the target stays at this scaled point (scene frame, render axes) whatever `focus` does, until a new focus request clears it. */
34
+ fixedPoint: [number, number, number] | null;
23
35
  /** Decaying offset that tweens the displayed target from the previous focus to the new one. */
24
36
  transition: [number, number, number];
25
37
  /** Scaled absolute camera/target positions (Float64, render axes) for the latest frame. */
@@ -9,6 +9,7 @@ export function createOrbitCameraState(distance, focus) {
9
9
  distance,
10
10
  targetDistance: distance,
11
11
  focus,
12
+ fixedPoint: null,
12
13
  transition: [0, 0, 0],
13
14
  cameraAbsolute: [0, 0, 0],
14
15
  targetAbsolute: [0, 0, 0],
@@ -114,11 +115,12 @@ function pointerSpread(pointers) {
114
115
  }
115
116
  /** Starts a tween from the currently displayed target to a new focus without moving the camera. */
116
117
  export function switchFocus(state, focus, newTargetAbsolute) {
117
- if (focus === state.focus)
118
+ if (focus === state.focus && state.fixedPoint === null)
118
119
  return;
119
120
  for (let i = 0; i < 3; i += 1)
120
121
  state.transition[i] = state.targetAbsolute[i] - newTargetAbsolute[i];
121
122
  state.focus = focus;
123
+ state.fixedPoint = null;
122
124
  }
123
125
  /**
124
126
  * Step 1 (before bodies are placed): computes the absolute target/camera in Float64 render axes
@@ -6,7 +6,6 @@ import type { SceneControls } from "./AstraeusScene.js";
6
6
  import { type DebugReadout } from "./DebugOverlay.js";
7
7
  import { type GroupFill } from "./FrameRateSection.js";
8
8
  import type { FrameSnapshot } from "./frameStats.js";
9
- import type { ExperienceDefinition } from "./experienceDefinition.js";
10
9
  import { type StartView } from "./viewLink.js";
11
10
  import type { ViewUp } from "./viewUp.js";
12
11
  /** The Developer tools' settings bodies that App.tsx hands whole to its folds; each only reads its props and writes the scene's live controls. */
@@ -69,12 +68,10 @@ export declare function ViewLinkReadout({ viewNow, viewLink, scale, upChoice }:
69
68
  readonly scale: string;
70
69
  readonly upChoice: ViewUp;
71
70
  }): import("react").JSX.Element;
72
- export declare function UnderTheHoodSettings({ hud, frames, fills, fpsHistory, alternates }: {
71
+ export declare function UnderTheHoodSettings({ hud, frames, fills, fpsHistory }: {
73
72
  readonly hud: DebugReadout | null;
74
73
  readonly frames: FrameSnapshot | null;
75
74
  readonly fills: readonly GroupFill[];
76
75
  readonly fpsHistory: readonly number[];
77
- /** The experience's alternate data sets; absent or empty: no Data group. */
78
- readonly alternates: ExperienceDefinition["alternates"];
79
76
  }): import("react").JSX.Element;
80
77
  export {};
@@ -7,15 +7,15 @@ import { MAX_PANEL_PAUSE_SECONDS } from "../shell/storyPanels.js";
7
7
  import { DebugOverlay } from "./DebugOverlay.js";
8
8
  import { FrameRateSection } from "./FrameRateSection.js";
9
9
  import { formatView } from "./viewLink.js";
10
- import { SettingButtons, SettingColor, SettingGroup, SettingSlider } from "./SettingControls.js";
10
+ import { HudSection, SettingButtons, SettingColor, SettingGroup, SettingSlider } from "./SettingControls.js";
11
11
  export function StoryPanelSettings({ storyAutoOpen, setStoryAutoOpen, storyPauseSeconds, setStoryPauseSeconds }) {
12
- return (_jsxs(SettingGroup, { id: "story-panels", title: "Story panels", children: [_jsx(SettingButtons, { children: _jsx("button", { "aria-pressed": storyAutoOpen, onClick: () => setStoryAutoOpen(!storyAutoOpen), children: "Open panels automatically" }) }), _jsx(SettingSlider, { label: "Pause when a panel opens (s)", ariaLabel: "Story panel pause", testId: "story-pause-value", display: storyPauseSeconds === 0 ? "off" : storyPauseSeconds.toFixed(1), min: 0, max: MAX_PANEL_PAUSE_SECONDS, step: 0.5, value: storyPauseSeconds, onChange: setStoryPauseSeconds })] }));
12
+ return (_jsxs(SettingGroup, { name: "story-panels", title: "Story panels", children: [_jsx(SettingButtons, { children: _jsx("button", { "aria-pressed": storyAutoOpen, onClick: () => setStoryAutoOpen(!storyAutoOpen), children: "Open panels automatically" }) }), _jsx(SettingSlider, { label: "Pause when a panel opens (s)", ariaLabel: "Story panel pause", testId: "story-pause-value", display: storyPauseSeconds === 0 ? "off" : storyPauseSeconds.toFixed(1), min: 0, max: MAX_PANEL_PAUSE_SECONDS, step: 0.5, value: storyPauseSeconds, onChange: setStoryPauseSeconds })] }));
13
13
  }
14
14
  export function MoonsAndRingsSettings({ bodySets, ringSystems, setLook, changeSetLook, ringLook, changeRing, controls, setSetLook, setRingLook }) {
15
- return (_jsxs(_Fragment, { children: [bodySets.length > 0 && (_jsxs(SettingGroup, { id: "body-set-dots", title: "Small moons", children: [_jsx(SettingSlider, { label: "Dot size (px)", ariaLabel: "Small moon dot size", testId: "body-set-dot-px", display: setLook.dotPx.toFixed(1), min: BODY_SET_LOOK_LIMITS.dotPx.min, max: BODY_SET_LOOK_LIMITS.dotPx.max, step: 0.5, value: setLook.dotPx, onChange: (dotPx) => changeSetLook({ dotPx }) }), _jsx(SettingColor, { label: "Dot colour", ariaLabel: "Small moon dot colour", testId: "body-set-dot-color", value: setLook.dotColor, onChange: (dotColor) => changeSetLook({ dotColor }) }), _jsx(SettingSlider, { label: "Name when ball is (px)", ariaLabel: "Small moon name distance", testId: "body-set-label-px", display: setLook.labelNearPx.toFixed(0), min: BODY_SET_LOOK_LIMITS.labelNearPx.min, max: BODY_SET_LOOK_LIMITS.labelNearPx.max, step: 1, value: setLook.labelNearPx, onChange: (labelNearPx) => changeSetLook({ labelNearPx }) })] })), bodySets.length > 0 && (_jsxs(SettingGroup, { id: "body-set-orbits", title: "Moon orbits by family", children: [_jsx(SettingButtons, { children: _jsx("button", { "aria-pressed": setLook.orbitsOn, onClick: () => changeSetLook({ orbitsOn: !setLook.orbitsOn }), children: "Moon orbits" }) }), _jsx(SettingSlider, { label: "Orbit opacity", ariaLabel: "Moon orbit opacity", testId: "body-set-orbit-opacity", display: setLook.orbitOpacity.toFixed(2), min: BODY_SET_LOOK_LIMITS.orbitOpacity.min, max: BODY_SET_LOOK_LIMITS.orbitOpacity.max, step: 0.01, value: setLook.orbitOpacity, onChange: (orbitOpacity) => changeSetLook({ orbitOpacity }) }), _jsx(SettingSlider, { label: "Zoom boost", ariaLabel: "Moon orbit zoom boost", testId: "body-set-orbit-boost", display: setLook.orbitZoomBoost.toFixed(2), min: BODY_SET_LOOK_LIMITS.orbitZoomBoost.min, max: BODY_SET_LOOK_LIMITS.orbitZoomBoost.max, step: 0.01, value: setLook.orbitZoomBoost, onChange: (orbitZoomBoost) => changeSetLook({ orbitZoomBoost }) }), _jsx(SettingColor, { label: "Highlight colour", ariaLabel: "Moon family highlight colour", testId: "body-set-highlight-color", value: setLook.highlightColor, onChange: (highlightColor) => changeSetLook({ highlightColor }) }), _jsx(SettingSlider, { label: "Highlight orbit brightness", ariaLabel: "Moon family highlight orbit brightness", testId: "body-set-highlight-gain", display: setLook.highlightOrbitGain.toFixed(1), min: BODY_SET_LOOK_LIMITS.highlightOrbitGain.min, max: BODY_SET_LOOK_LIMITS.highlightOrbitGain.max, step: 0.5, value: setLook.highlightOrbitGain, onChange: (highlightOrbitGain) => changeSetLook({ highlightOrbitGain }) }), bodySets.flatMap((layer) => layer.families.map((family) => (_jsx(SettingColor, { label: family.label, ariaLabel: `${family.label} orbit colour`, testId: `body-set-family-${family.id}`, value: familyColorOf(layer, setLook, family.id), onChange: (color) => changeSetLook({ familyColors: { ...setLook.familyColors, [family.id]: color } }) }, `${layer.id}-${family.id}`)))), _jsx(SettingButtons, { children: _jsx("button", { onClick: () => { delete controls.current.bodySetLook; setSetLook(DEFAULT_BODY_SET_LOOK); }, children: "Reset moons" }) })] })), ringSystems.map((rings) => (_jsxs(SettingGroup, { id: `rings-${rings.body}`, title: "Rings", children: [ringBandsWithLook(rings, ringLook).map((band) => (_jsxs("div", { children: [_jsx(SettingColor, { label: band.label, ariaLabel: `${band.label} colour`, testId: `ring-${band.id}-color`, value: band.color, onChange: (color) => changeRing(band.id, { color }) }), _jsx(SettingSlider, { label: `${band.label} opacity`, ariaLabel: `${band.label}: opacity`, testId: `ring-${band.id}-opacity`, display: band.opacity.toFixed(3), min: 0, max: 1, step: 0.005, value: band.opacity, onChange: (opacity) => changeRing(band.id, { opacity }) })] }, band.id))), _jsx(SettingButtons, { children: _jsx("button", { onClick: () => { delete controls.current.ringLook; setRingLook({}); }, children: "Reset rings" }) })] }, rings.body)))] }));
15
+ return (_jsxs(_Fragment, { children: [bodySets.length > 0 && (_jsxs(SettingGroup, { name: "body-set-dots", title: "Small moons", children: [_jsx(SettingSlider, { label: "Dot size (px)", ariaLabel: "Small moon dot size", testId: "body-set-dot-px", display: setLook.dotPx.toFixed(1), min: BODY_SET_LOOK_LIMITS.dotPx.min, max: BODY_SET_LOOK_LIMITS.dotPx.max, step: 0.5, value: setLook.dotPx, onChange: (dotPx) => changeSetLook({ dotPx }) }), _jsx(SettingColor, { label: "Dot colour", ariaLabel: "Small moon dot colour", testId: "body-set-dot-color", value: setLook.dotColor, onChange: (dotColor) => changeSetLook({ dotColor }) }), _jsx(SettingSlider, { label: "Name when ball is (px)", ariaLabel: "Small moon name distance", testId: "body-set-label-px", display: setLook.labelNearPx.toFixed(0), min: BODY_SET_LOOK_LIMITS.labelNearPx.min, max: BODY_SET_LOOK_LIMITS.labelNearPx.max, step: 1, value: setLook.labelNearPx, onChange: (labelNearPx) => changeSetLook({ labelNearPx }) })] })), bodySets.length > 0 && (_jsxs(SettingGroup, { name: "body-set-orbits", title: "Moon orbits by family", children: [_jsx(SettingButtons, { children: _jsx("button", { "aria-pressed": setLook.orbitsOn, onClick: () => changeSetLook({ orbitsOn: !setLook.orbitsOn }), children: "Moon orbits" }) }), _jsx(SettingSlider, { label: "Orbit opacity", ariaLabel: "Moon orbit opacity", testId: "body-set-orbit-opacity", display: setLook.orbitOpacity.toFixed(2), min: BODY_SET_LOOK_LIMITS.orbitOpacity.min, max: BODY_SET_LOOK_LIMITS.orbitOpacity.max, step: 0.01, value: setLook.orbitOpacity, onChange: (orbitOpacity) => changeSetLook({ orbitOpacity }) }), _jsx(SettingSlider, { label: "Zoom boost", ariaLabel: "Moon orbit zoom boost", testId: "body-set-orbit-boost", display: setLook.orbitZoomBoost.toFixed(2), min: BODY_SET_LOOK_LIMITS.orbitZoomBoost.min, max: BODY_SET_LOOK_LIMITS.orbitZoomBoost.max, step: 0.01, value: setLook.orbitZoomBoost, onChange: (orbitZoomBoost) => changeSetLook({ orbitZoomBoost }) }), _jsx(SettingColor, { label: "Highlight colour", ariaLabel: "Moon family highlight colour", testId: "body-set-highlight-color", value: setLook.highlightColor, onChange: (highlightColor) => changeSetLook({ highlightColor }) }), _jsx(SettingSlider, { label: "Highlight orbit brightness", ariaLabel: "Moon family highlight orbit brightness", testId: "body-set-highlight-gain", display: setLook.highlightOrbitGain.toFixed(1), min: BODY_SET_LOOK_LIMITS.highlightOrbitGain.min, max: BODY_SET_LOOK_LIMITS.highlightOrbitGain.max, step: 0.5, value: setLook.highlightOrbitGain, onChange: (highlightOrbitGain) => changeSetLook({ highlightOrbitGain }) }), bodySets.flatMap((layer) => layer.families.map((family) => (_jsx(SettingColor, { label: family.label, ariaLabel: `${family.label} orbit colour`, testId: `body-set-family-${family.id}`, value: familyColorOf(layer, setLook, family.id), onChange: (color) => changeSetLook({ familyColors: { ...setLook.familyColors, [family.id]: color } }) }, `${layer.id}-${family.id}`)))), _jsx(SettingButtons, { children: _jsx("button", { onClick: () => { delete controls.current.bodySetLook; setSetLook(DEFAULT_BODY_SET_LOOK); }, children: "Reset moons" }) })] })), ringSystems.map((rings) => (_jsxs(SettingGroup, { name: `rings-${rings.body}`, title: "Rings", children: [ringBandsWithLook(rings, ringLook).map((band) => (_jsxs("div", { children: [_jsx(SettingColor, { label: band.label, ariaLabel: `${band.label} colour`, testId: `ring-${band.id}-color`, value: band.color, onChange: (color) => changeRing(band.id, { color }) }), _jsx(SettingSlider, { label: `${band.label} opacity`, ariaLabel: `${band.label}: opacity`, testId: `ring-${band.id}-opacity`, display: band.opacity.toFixed(3), min: 0, max: 1, step: 0.005, value: band.opacity, onChange: (opacity) => changeRing(band.id, { opacity }) })] }, band.id))), _jsx(SettingButtons, { children: _jsx("button", { onClick: () => { delete controls.current.ringLook; setRingLook({}); }, children: "Reset rings" }) })] }, rings.body)))] }));
16
16
  }
17
17
  export function SkyAndSunSettings({ illuminateAll, setIlluminateAll, visible, glowShown, setGlowShown, controls, milkyWayOn, setMilkyWayOn, starBrightness, setStarBrightness, milkyWayBrightness, setMilkyWayBrightness }) {
18
- return (_jsxs(_Fragment, { children: [_jsx(SettingGroup, { id: "lighting", title: "Lighting", children: _jsx(SettingButtons, { children: _jsx("button", { "aria-pressed": illuminateAll, "aria-label": "Illuminate all", onClick: () => { controls.current.illuminateAll = !illuminateAll; setIlluminateAll(!illuminateAll); }, children: "Illuminate all" }) }) }), visible && (_jsxs(SettingGroup, { id: "sky", title: "Sky", children: [_jsx(SettingButtons, { children: _jsx("button", { "aria-pressed": milkyWayOn, onClick: () => { controls.current.showMilkyWay = !milkyWayOn; setMilkyWayOn(!milkyWayOn); }, children: "Milky Way picture" }) }), _jsx(SettingSlider, { label: "Star brightness", ariaLabel: "Star brightness", testId: "star-brightness-value", display: starBrightness.toFixed(2), min: 0, max: 2, step: 0.05, value: starBrightness, onChange: (value) => { controls.current.starBrightness = value; setStarBrightness(value); } }), _jsx(SettingSlider, { label: "Milky Way brightness", ariaLabel: "Milky Way brightness", testId: "milky-way-brightness-value", display: milkyWayBrightness.toFixed(2), min: 0, max: 2, step: 0.05, value: milkyWayBrightness, onChange: (value) => { controls.current.milkyWayBrightness = value; setMilkyWayBrightness(value); } })] })), glowShown !== null && (_jsxs(SettingGroup, { id: "glow", title: "Sun glow", children: [_jsx(SettingSlider, { label: "Glow size (px)", ariaLabel: "Sun glow size", testId: "sun-glow-size-value", display: glowShown.sizePx.toFixed(0), min: GLOW_LIMITS.sizePx.min, max: GLOW_LIMITS.sizePx.max, step: 1, value: glowShown.sizePx, onChange: (value) => { controls.current.glowLook.sizePx = value; setGlowShown({ ...controls.current.glowLook }); } }), _jsx(SettingSlider, { label: "Glow brightness", ariaLabel: "Sun glow brightness", testId: "sun-glow-brightness-value", display: glowShown.brightness.toFixed(2), min: GLOW_LIMITS.brightness.min, max: GLOW_LIMITS.brightness.max, step: 0.05, value: glowShown.brightness, onChange: (value) => { controls.current.glowLook.brightness = value; setGlowShown({ ...controls.current.glowLook }); } }), _jsx(SettingSlider, { label: "Glow reach (\u00D7 disc)", ariaLabel: "Sun glow reach", testId: "sun-glow-scale-value", display: glowShown.scale.toFixed(1), min: GLOW_LIMITS.scale.min, max: GLOW_LIMITS.scale.max, step: 0.1, value: glowShown.scale, onChange: (value) => { controls.current.glowLook.scale = value; setGlowShown({ ...controls.current.glowLook }); } })] }))] }));
18
+ return (_jsxs(_Fragment, { children: [_jsx(SettingGroup, { name: "lighting", title: "Lighting", children: _jsx(SettingButtons, { children: _jsx("button", { "aria-pressed": illuminateAll, "aria-label": "Illuminate all", onClick: () => { controls.current.illuminateAll = !illuminateAll; setIlluminateAll(!illuminateAll); }, children: "Illuminate all" }) }) }), visible && (_jsxs(SettingGroup, { name: "sky", title: "Sky", children: [_jsx(SettingButtons, { children: _jsx("button", { "aria-pressed": milkyWayOn, onClick: () => { controls.current.showMilkyWay = !milkyWayOn; setMilkyWayOn(!milkyWayOn); }, children: "Milky Way picture" }) }), _jsx(SettingSlider, { label: "Star brightness", ariaLabel: "Star brightness", testId: "star-brightness-value", display: starBrightness.toFixed(2), min: 0, max: 2, step: 0.05, value: starBrightness, onChange: (value) => { controls.current.starBrightness = value; setStarBrightness(value); } }), _jsx(SettingSlider, { label: "Milky Way brightness", ariaLabel: "Milky Way brightness", testId: "milky-way-brightness-value", display: milkyWayBrightness.toFixed(2), min: 0, max: 2, step: 0.05, value: milkyWayBrightness, onChange: (value) => { controls.current.milkyWayBrightness = value; setMilkyWayBrightness(value); } })] })), glowShown !== null && (_jsxs(SettingGroup, { name: "glow", title: "Sun glow", children: [_jsx(SettingSlider, { label: "Glow size (px)", ariaLabel: "Sun glow size", testId: "sun-glow-size-value", display: glowShown.sizePx.toFixed(0), min: GLOW_LIMITS.sizePx.min, max: GLOW_LIMITS.sizePx.max, step: 1, value: glowShown.sizePx, onChange: (value) => { controls.current.glowLook.sizePx = value; setGlowShown({ ...controls.current.glowLook }); } }), _jsx(SettingSlider, { label: "Glow brightness", ariaLabel: "Sun glow brightness", testId: "sun-glow-brightness-value", display: glowShown.brightness.toFixed(2), min: GLOW_LIMITS.brightness.min, max: GLOW_LIMITS.brightness.max, step: 0.05, value: glowShown.brightness, onChange: (value) => { controls.current.glowLook.brightness = value; setGlowShown({ ...controls.current.glowLook }); } }), _jsx(SettingSlider, { label: "Glow reach (\u00D7 disc)", ariaLabel: "Sun glow reach", testId: "sun-glow-scale-value", display: glowShown.scale.toFixed(1), min: GLOW_LIMITS.scale.min, max: GLOW_LIMITS.scale.max, step: 0.1, value: glowShown.scale, onChange: (value) => { controls.current.glowLook.scale = value; setGlowShown({ ...controls.current.glowLook }); } })] }))] }));
19
19
  }
20
20
  export function LabelSettings({ controls, hoverBrightness, setHoverBrightness, labelToggles, trackedCount, anchorLabels, setAnchorLabels, hiddenLabels, setHiddenLabels }) {
21
21
  return (_jsxs(_Fragment, { children: [_jsx(SettingSlider, { label: "Hover name brightness", ariaLabel: "Hover name brightness", testId: "hover-brightness-value", display: hoverBrightness.toFixed(2), min: HOVER_BRIGHTNESS_LIMITS.min, max: HOVER_BRIGHTNESS_LIMITS.max, step: 0.05, value: hoverBrightness, onChange: (value) => { controls.current.hoverBrightness = value; setHoverBrightness(value); } }), (labelToggles.length > 0 || trackedCount > 0) && _jsxs(SettingButtons, { children: [trackedCount > 0 && _jsx("button", { "aria-pressed": anchorLabels, onClick: () => { controls.current.showAnchorLabels = !anchorLabels; setAnchorLabels(!anchorLabels); }, children: "Anchor labels" }), labelToggles.map((object) => (_jsx("button", { "aria-pressed": !hiddenLabels.has(object.id), onClick: () => {
@@ -31,10 +31,6 @@ export function LabelSettings({ controls, hoverBrightness, setHoverBrightness, l
31
31
  export function ViewLinkReadout({ viewNow, viewLink, scale, upChoice }) {
32
32
  return (_jsxs(_Fragment, { children: [viewNow !== null && _jsx("p", { className: "view-link-values", "data-testid": "view-values", children: `View: ${formatView(viewNow).replace(/%2C/g, ",")} (focus, azimuth °, elevation °, distance) · scale ${scale} · up ${upChoice}` }), viewLink !== null && (_jsxs("p", { className: "view-link-field", children: [_jsx("input", { readOnly: true, "aria-label": "View link", "data-testid": "view-link", value: viewLink.url, onFocus: (event) => event.currentTarget.select() }), _jsx("span", { children: viewLink.copied ? "Copied to the clipboard." : "Clipboard unavailable: select the link above and copy it." })] }))] }));
33
33
  }
34
- export function UnderTheHoodSettings({ hud, frames, fills, fpsHistory, alternates }) {
35
- return (_jsxs(_Fragment, { children: [hud !== null && (_jsxs("section", { className: "hud-section", "aria-labelledby": "developer-scene-heading", children: [_jsx("h4", { id: "developer-scene-heading", children: "Scene instrumentation" }), _jsx(DebugOverlay, { readout: hud })] })), _jsx(FrameRateSection, { frames: frames, fills: fills, fpsHistory: fpsHistory }), alternates !== undefined && alternates.length > 0 && (_jsx(SettingGroup, { id: "data", title: "Data", children: _jsx(SettingButtons, { children: alternates?.map((alternate) => (_jsx("button", { "aria-pressed": alternate.active, onClick: () => {
36
- const url = new URL(window.location.href);
37
- url.searchParams.set(alternate.param, alternate.value);
38
- window.location.assign(url.toString());
39
- }, children: alternate.label }, `${alternate.param}=${alternate.value}`))) }) }))] }));
34
+ export function UnderTheHoodSettings({ hud, frames, fills, fpsHistory }) {
35
+ return (_jsxs(_Fragment, { children: [hud !== null && (_jsx(HudSection, { level: 4, heading: "Scene instrumentation", children: _jsx(DebugOverlay, { readout: hud }) })), _jsx(FrameRateSection, { frames: frames, fills: fills, fpsHistory: fpsHistory })] }));
40
36
  }
@@ -1,5 +1,6 @@
1
1
  import { type Camera, type Object3D } from "three";
2
2
  import type { BodyFeatureSet } from "../shell/bodyFeatures.js";
3
+ import type { LookInput } from "./look.js";
3
4
  /** The donor's `latLonToXYZ`, verbatim: a point on a sphere of `radius`, in the body's own frame (Three.js SphereGeometry UV layout). */
4
5
  export declare function latLonToXYZ(lat: number, lon: number, radius: number): [number, number, number];
5
6
  /** The donor's horizon rule: a marker hides once its surface point is this far past the edge. */
@@ -10,11 +11,11 @@ export declare function isFeatureVisible(surfaceNormal: readonly [number, number
10
11
  export declare const MARKER_RADIUS_MULTIPLIER = 1.02;
11
12
  /**
12
13
  * Presentation only. A body drawn narrower than this many screen pixels shows no markers (they would crowd into a smudge); the donor's
13
- * moon fills the screen, so it has no such rule. Live through `?featurepx=`.
14
+ * moon fills the screen, so it has no such rule. Set through `Scene.setLook` (`featureMinBodyPx`), or live through `?featurepx=`.
14
15
  */
15
16
  export declare const DEFAULT_FEATURE_MIN_BODY_PX = 60;
16
- /** `?featurepx=<n>` sets the narrowest body that still shows its markers; an unusable value keeps the default with a console warning. */
17
- export declare function featureMinBodyPxFromSearch(search: string, fallback?: number): number;
17
+ /** The narrowest body that still shows its markers: the look's `featureMinBodyPx`, else the default. */
18
+ export declare function featureMinBodyPxOf(look: LookInput): number;
18
19
  /**
19
20
  * The shell's own panels, which own their screen areas: a marker whose point falls under one is hidden, so a marker never shows through or
20
21
  * competes with the information panel, the moons sheet and its button, the timeline, the top bar, story panels or the phone drawers.
@@ -4,6 +4,7 @@
4
4
  import { Vector3 } from "three";
5
5
  import { projectedRadiusPx } from "./bodyDraw.js";
6
6
  import { featureColor, featureKey } from "../shell/bodyFeatures.js";
7
+ import { VIEWER_ROOT_CLASS } from "../shell/viewerKeys.js";
7
8
  /** The donor's `latLonToXYZ`, verbatim: a point on a sphere of `radius`, in the body's own frame (Three.js SphereGeometry UV layout). */
8
9
  export function latLonToXYZ(lat, lon, radius) {
9
10
  const phi = (90 - lat) * (Math.PI / 180); // polar angle from +Y
@@ -34,20 +35,12 @@ export function isFeatureVisible(surfaceNormal, cameraLocalPosition, sphereRadiu
34
35
  export const MARKER_RADIUS_MULTIPLIER = 1.02;
35
36
  /**
36
37
  * Presentation only. A body drawn narrower than this many screen pixels shows no markers (they would crowd into a smudge); the donor's
37
- * moon fills the screen, so it has no such rule. Live through `?featurepx=`.
38
+ * moon fills the screen, so it has no such rule. Set through `Scene.setLook` (`featureMinBodyPx`), or live through `?featurepx=`.
38
39
  */
39
40
  export const DEFAULT_FEATURE_MIN_BODY_PX = 60;
40
- /** `?featurepx=<n>` sets the narrowest body that still shows its markers; an unusable value keeps the default with a console warning. */
41
- export function featureMinBodyPxFromSearch(search, fallback = DEFAULT_FEATURE_MIN_BODY_PX) {
42
- const raw = new URLSearchParams(search).get("featurepx");
43
- if (raw === null)
44
- return fallback;
45
- const value = raw.trim() === "" ? Number.NaN : Number(raw);
46
- if (!Number.isFinite(value) || value < 0 || value > 2000) {
47
- console.warn(`?featurepx=${raw} ignored: the value must be a number from 0 to 2000`);
48
- return fallback;
49
- }
50
- return value;
41
+ /** The narrowest body that still shows its markers: the look's `featureMinBodyPx`, else the default. */
42
+ export function featureMinBodyPxOf(look) {
43
+ return look.featureMinBodyPx ?? DEFAULT_FEATURE_MIN_BODY_PX;
51
44
  }
52
45
  /**
53
46
  * The shell's own panels, which own their screen areas: a marker whose point falls under one is hidden, so a marker never shows through or
@@ -183,7 +176,9 @@ export class FeatureMarkerLayer {
183
176
  return;
184
177
  this.#measuredAt = now;
185
178
  const origin = this.#root.getBoundingClientRect();
186
- this.#occluders = [...document.querySelectorAll(FEATURE_OCCLUDER_SELECTOR)].flatMap((element) => {
179
+ // Only this viewer's own panels count: a second viewer on the page has its own (O-055).
180
+ const viewer = this.#root.closest(`.${VIEWER_ROOT_CLASS}`);
181
+ this.#occluders = [...(viewer?.querySelectorAll(FEATURE_OCCLUDER_SELECTOR) ?? [])].flatMap((element) => {
187
182
  if (this.#root.contains(element))
188
183
  return [];
189
184
  const box = element.getBoundingClientRect();
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { HudSection } from "./SettingControls.js";
2
3
  import { FRAME_BUDGET_MS, fpsTone, frameTone } from "./frameStats.js";
3
4
  /** Developer tools section: how smoothly this browser is drawing the scene. Presentation only. */
4
5
  const GRAPH_WIDTH = 300;
@@ -31,5 +32,5 @@ function overTone(frames) {
31
32
  return frames.overBudget === 0 ? "good" : frames.overBudget * 10 <= frames.frames ? "warn" : "bad";
32
33
  }
33
34
  export function FrameRateSection({ frames, fills, fpsHistory = [] }) {
34
- return (_jsxs("section", { className: "hud-section hud-section-frame", "aria-labelledby": "developer-frame-rate-heading", "data-testid": "frame-rate", children: [_jsx("h4", { id: "developer-frame-rate-heading", children: "Frame rate" }), _jsxs("div", { className: "frame-body", children: [frames === null || frames.frames === 0 ? _jsx("p", { children: "Measuring\u2026" }) : (_jsxs("dl", { className: "frame-readouts", "aria-label": "Frame timing", children: [_jsxs("div", { children: [_jsx("dt", { children: "Frames per second" }), _jsx("dd", { "data-frame-fps": true, className: `tone-${fpsTone(frames.fps)}`, children: frames.fps.toFixed(1) })] }), _jsxs("div", { children: [_jsx("dt", { children: "Longest recent frame" }), _jsxs("dd", { "data-frame-longest": true, className: `tone-${frameTone(frames.longestMs)}`, children: [frames.longestMs.toFixed(1), " ms"] })] }), _jsxs("div", { children: [_jsxs("dt", { children: ["Frames over ", FRAME_BUDGET_MS, " ms"] }), _jsxs("dd", { "data-frame-over": true, className: `tone-${overTone(frames)}`, children: [frames.overBudget, " of ", frames.frames] })] }), fills.map((fill) => _jsxs("div", { children: [_jsxs("dt", { children: ["Position fills: ", fill.id] }), _jsx("dd", { "data-fill-count": fill.id, children: fill.count })] }, fill.id))] })), fpsHistory.length > 1 && (_jsxs("div", { className: "frame-graph", children: [_jsx(FpsGraph, { history: fpsHistory }), _jsxs("p", { className: "fps-graph-key", children: [_jsx("span", { className: "tone-good", children: "\u25CF smooth, 50+" }), _jsx("span", { className: "tone-warn", children: "\u25CF uneven, 30\u201350" }), _jsx("span", { className: "tone-bad", children: "\u25CF rough, under 30" })] })] }))] }), _jsx("p", { children: "These figures are for this browser and machine, measured over the last second or so." })] }));
35
+ return (_jsxs(HudSection, { className: "hud-section hud-section-frame", level: 4, heading: "Frame rate", testId: "frame-rate", children: [_jsxs("div", { className: "frame-body", children: [frames === null || frames.frames === 0 ? _jsx("p", { children: "Measuring\u2026" }) : (_jsxs("dl", { className: "frame-readouts", "aria-label": "Frame timing", children: [_jsxs("div", { children: [_jsx("dt", { children: "Frames per second" }), _jsx("dd", { "data-frame-fps": true, className: `tone-${fpsTone(frames.fps)}`, children: frames.fps.toFixed(1) })] }), _jsxs("div", { children: [_jsx("dt", { children: "Longest recent frame" }), _jsxs("dd", { "data-frame-longest": true, className: `tone-${frameTone(frames.longestMs)}`, children: [frames.longestMs.toFixed(1), " ms"] })] }), _jsxs("div", { children: [_jsxs("dt", { children: ["Frames over ", FRAME_BUDGET_MS, " ms"] }), _jsxs("dd", { "data-frame-over": true, className: `tone-${overTone(frames)}`, children: [frames.overBudget, " of ", frames.frames] })] }), fills.map((fill) => _jsxs("div", { children: [_jsxs("dt", { children: ["Position fills: ", fill.id] }), _jsx("dd", { "data-fill-count": fill.id, children: fill.count })] }, fill.id))] })), fpsHistory.length > 1 && (_jsxs("div", { className: "frame-graph", children: [_jsx(FpsGraph, { history: fpsHistory }), _jsxs("p", { className: "fps-graph-key", children: [_jsx("span", { className: "tone-good", children: "\u25CF smooth, 50+" }), _jsx("span", { className: "tone-warn", children: "\u25CF uneven, 30\u201350" }), _jsx("span", { className: "tone-bad", children: "\u25CF rough, under 30" })] })] }))] }), _jsx("p", { children: "These figures are for this browser and machine, measured over the last second or so." })] }));
35
36
  }
@@ -436,7 +436,7 @@ export class OrbitSetView {
436
436
  uniforms.uFar.value = look.orbitZoomFarRatio;
437
437
  this.layer.families.forEach((family, index) => {
438
438
  uniforms.uColors.value[index].set(look.highlightFamily === family.id ? look.highlightColor : familyColorOf(this.layer, look, family.id));
439
- uniforms.uGains.value[index] = familyGainOf(look, family.id);
439
+ uniforms.uGains.value[index] = familyGainOf(look, family.id, family.brightness);
440
440
  });
441
441
  this.#material.depthTest = trueScale;
442
442
  }
@@ -1,10 +1,18 @@
1
- import type { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  /** A titled group of developer settings. The title names the group for assistive technology too. */
3
- export declare function SettingGroup({ id, title, children }: {
4
- readonly id: string;
3
+ export declare function SettingGroup({ name, title, children }: {
4
+ readonly name: string;
5
5
  readonly title: string;
6
6
  readonly children: ReactNode;
7
7
  }): import("react").JSX.Element;
8
+ /** A developer-drawer section named by its own heading; the heading id is made per viewer. */
9
+ export declare function HudSection({ className, level, heading, testId, children }: {
10
+ readonly className?: string;
11
+ readonly level: 3 | 4;
12
+ readonly heading: ReactNode;
13
+ readonly testId?: string;
14
+ readonly children: ReactNode;
15
+ }): import("react").JSX.Element;
8
16
  /** One slider setting on one row: label on the left, the control in the middle, the value on the right. */
9
17
  export declare function SettingSlider({ label, ariaLabel, testId, display, min, max, step, value, onChange }: {
10
18
  readonly label: string;
@@ -1,7 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from "react";
2
3
  /** A titled group of developer settings. The title names the group for assistive technology too. */
3
- export function SettingGroup({ id, title, children }) {
4
- return (_jsxs("div", { className: "setting-group", role: "group", "aria-labelledby": `setting-group-${id}`, children: [_jsx("h4", { id: `setting-group-${id}`, children: title }), children] }));
4
+ export function SettingGroup({ name, title, children }) {
5
+ const titleId = `${useId()}-title`;
6
+ return (_jsxs("div", { className: "setting-group", role: "group", "aria-labelledby": titleId, "data-setting-group": name, children: [_jsx("h4", { id: titleId, children: title }), children] }));
7
+ }
8
+ /** A developer-drawer section named by its own heading; the heading id is made per viewer. */
9
+ export function HudSection({ className = "hud-section", level, heading, testId, children }) {
10
+ const headingId = `${useId()}-heading`;
11
+ const Heading = level === 3 ? "h3" : "h4";
12
+ return (_jsxs("section", { className: className, "aria-labelledby": headingId, "data-testid": testId, children: [_jsx(Heading, { id: headingId, children: heading }), children] }));
5
13
  }
6
14
  /** One slider setting on one row: label on the left, the control in the middle, the value on the right. */
7
15
  export function SettingSlider({ label, ariaLabel, testId, display, min, max, step, value, onChange }) {
@@ -13,8 +13,10 @@ export interface SkyViewOptions {
13
13
  readonly milkyWay?: boolean;
14
14
  /** Legacy: ready textures, one per tile (a test may pass empty ones). Overrides `picture`. */
15
15
  readonly pictures?: readonly Texture[];
16
- /** The picture to draw, as a tile grid; defaults to the Milky Way picture. `null` draws none until `requestPicture` is called. */
16
+ /** The picture to draw, as a tile grid; defaults to `pictureSet`. `null` draws none until `requestPicture` is called. */
17
17
  readonly picture?: PictureSet | null;
18
+ /** The Milky Way picture of the pictures this viewer was given (`milkyWayPicture(pictures)`); defaults to none, so a sky given no pictures draws no picture. */
19
+ readonly pictureSet?: PictureSet;
18
20
  }
19
21
  /**
20
22
  * The sky: stars and the Milky Way picture at infinity. The group is put on the camera's position every frame, so what is drawn
@@ -52,12 +54,3 @@ export declare class SkyView {
52
54
  }
53
55
  /** The probe direction in the render frame, for tests and the browser check. */
54
56
  export declare const SKY_PROBE_DIRECTION: readonly [number, number, number];
55
- /** `?milkyway=off` or `?milkyway=on` overrides the experience's picture setting for a comparison; anything else is null (no override). */
56
- export declare function milkyWayFromSearch(search: string): boolean | null;
57
- /**
58
- * A brightness override from the address (`?stars=1.4`, `?milkywaybrightness=0.8`): null when absent. A value that is not a number
59
- * from 0 to 2 is ignored with a console warning, never thrown.
60
- */
61
- export declare function brightnessFromSearch(search: string, key: "stars" | "milkywaybrightness"): number | null;
62
- /** `?sky=off` hides the sky for a comparison; anything else keeps the experience's own setting. */
63
- export declare function skyHiddenBySearch(search: string): boolean;
@@ -1,5 +1,5 @@
1
1
  import { AdditiveBlending, BufferAttribute, BufferGeometry, DoubleSide, LinearFilter, LinearMipmapLinearFilter, Group, Mesh, Points, ShaderMaterial, NoColorSpace, TextureLoader, Vector3 } from "three";
2
- import { MILKY_WAY_PICTURE } from "../assets/sky.js";
2
+ import { milkyWayPicture } from "../assets/sky.js";
3
3
  import { buildPictureMesh, buildStarBuffers } from "./skyModel.js";
4
4
  // Both draws sit before everything else in the first pass (the layer-0 pass), ignore depth, and write none.
5
5
  const SKY_ORDER = -1000;
@@ -75,16 +75,18 @@ export class SkyView {
75
75
  #brightness;
76
76
  #maxAnisotropy;
77
77
  #held = false;
78
+ #set;
78
79
  /** `options.picture` is the tile set; the scene passes the one it resolved, a test may pass `pictures` (empty textures). */
79
80
  constructor(options) {
80
81
  const { starBrightness, milkyWayBrightness, pixelRatio, maxAnisotropy = 1 } = options;
81
82
  this.#pictureOn = options.milkyWay ?? false;
82
83
  this.#brightness = milkyWayBrightness;
83
84
  this.#maxAnisotropy = maxAnisotropy;
85
+ this.#set = options.pictureSet ?? milkyWayPicture({});
84
86
  if (options.pictures !== undefined)
85
- this.#build(MILKY_WAY_PICTURE, options.pictures);
87
+ this.#build(this.#set, options.pictures);
86
88
  else if (options.picture !== null)
87
- this.#build(options.picture ?? MILKY_WAY_PICTURE);
89
+ this.#build(options.picture ?? this.#set);
88
90
  this.#starMaterial = new ShaderMaterial({
89
91
  vertexShader: STAR_VERTEX,
90
92
  fragmentShader: STAR_FRAGMENT,
@@ -151,7 +153,7 @@ export class SkyView {
151
153
  /** Builds the Milky Way picture the first time it is wanted (nothing is decoded while the picture stays off); a no-op once a picture is held. */
152
154
  requestPicture() {
153
155
  if (!this.#held)
154
- this.#build(MILKY_WAY_PICTURE);
156
+ this.#build(this.#set);
155
157
  }
156
158
  /** Sets the star strength in place (0 to 2); no rebuild. */
157
159
  setStarBrightness(value) {
@@ -222,27 +224,3 @@ export class SkyView {
222
224
  }
223
225
  /** The probe direction in the render frame, for tests and the browser check. */
224
226
  export const SKY_PROBE_DIRECTION = [PROBE_DIRECTION.x, PROBE_DIRECTION.y, PROBE_DIRECTION.z];
225
- /** `?milkyway=off` or `?milkyway=on` overrides the experience's picture setting for a comparison; anything else is null (no override). */
226
- export function milkyWayFromSearch(search) {
227
- const value = new URLSearchParams(search).get("milkyway");
228
- return value === "off" ? false : value === "on" ? true : null;
229
- }
230
- /**
231
- * A brightness override from the address (`?stars=1.4`, `?milkywaybrightness=0.8`): null when absent. A value that is not a number
232
- * from 0 to 2 is ignored with a console warning, never thrown.
233
- */
234
- export function brightnessFromSearch(search, key) {
235
- const raw = new URLSearchParams(search).get(key);
236
- if (raw === null)
237
- return null;
238
- const value = raw.trim() === "" ? Number.NaN : Number(raw);
239
- if (!Number.isFinite(value) || value < 0 || value > 2) {
240
- console.warn(`?${key}=${raw} ignored: the value must be a number from 0 to 2`);
241
- return null;
242
- }
243
- return value;
244
- }
245
- /** `?sky=off` hides the sky for a comparison; anything else keeps the experience's own setting. */
246
- export function skyHiddenBySearch(search) {
247
- return new URLSearchParams(search).get("sky") === "off";
248
- }
@@ -33,6 +33,9 @@ export declare function panelForMarkerPress(group: StoryMarkerGroup, timeUtcMs:
33
33
  export declare class StoryMarkerLayer {
34
34
  #private;
35
35
  constructor(host: HTMLElement, specs: readonly StoryMarkerSpec[], onOpen: (panelId: string) => void);
36
- update(positionFor: (objectId: string) => RenderVector | null, camera: Camera, widthPx: number, heightPx: number, origin: FloatingOrigin, openPanelId: string | null, timeUtcMs: number): void;
36
+ update(positionFor: (objectId: string) => RenderVector | null, camera: Camera, widthPx: number, heightPx: number, origin: FloatingOrigin, openPanelId: string | null, timeUtcMs: number, hidden?: {
37
+ readonly objects: ReadonlySet<string>;
38
+ readonly panels: ReadonlySet<string>;
39
+ }): void;
37
40
  dispose(): void;
38
41
  }
@@ -61,12 +61,13 @@ export class StoryMarkerLayer {
61
61
  });
62
62
  host.appendChild(this.#root);
63
63
  }
64
- update(positionFor, camera, widthPx, heightPx, origin, openPanelId, timeUtcMs) {
64
+ update(positionFor, camera, widthPx, heightPx, origin, openPanelId, timeUtcMs, hidden) {
65
65
  this.#timeUtcMs = timeUtcMs;
66
66
  this.#openPanelId = openPanelId;
67
67
  camera.updateMatrixWorld(true);
68
68
  for (const { group, element } of this.#entries) {
69
- const absolute = positionFor(group.objectId);
69
+ // A marker the current view owns no panel of, or on an object the view hides, is not drawn.
70
+ const absolute = hidden?.objects.has(group.objectId) === true || group.panels.every((panel) => hidden?.panels.has(panel.panelId) === true) ? null : positionFor(group.objectId);
70
71
  const screen = absolute === null ? null : projectToScreen(this.#local.fromArray(origin.toLocal(absolute)), camera, widthPx, heightPx);
71
72
  element.hidden = screen === null;
72
73
  if (screen === null)
@@ -23,7 +23,7 @@ export declare function releaseAnchorSprite(): void;
23
23
  export declare class TrackedBodyView {
24
24
  #private;
25
25
  readonly body: TrackedBody;
26
- /** Every tracked body's path is one rule, a relative trail (`pathRules.ts`); the body it is drawn against is the path's own `lineFixedTo`, default the scene centre. */
26
+ /** Every tracked body's path is one rule, a relative trail (`pathRules.ts`); the body it is drawn against is the path's own `lineFixedTo` (one body or per-stretch), default the scene centre. */
27
27
  static readonly pathRule: PathRule;
28
28
  readonly group: Group<import("three").Object3DEventMap>;
29
29
  /** Anchor labels in anchor order, or null when the body has none. */
@@ -1,6 +1,6 @@
1
1
  import { BufferAttribute, BufferGeometry, DataTexture, Group, Line, LineBasicMaterial, Mesh, MeshBasicMaterial, Points, RGBAFormat, SphereGeometry, Vector3, } from "three";
2
2
  import { dotMaterial } from "./dotMaterial.js";
3
- import { anchorLabelsOf, markerRadiusUnits, sampleTrackedPositions, stateClampedToBounds, stateIfInBounds, travelledCount } from "./mission.js";
3
+ import { anchorLabelsOf, markerRadiusUnits, lineAgainstAt, lineBodies, sampleTrackedPositions, stateClampedToBounds, stateIfInBounds, travelledCount } from "./mission.js";
4
4
  import { mapPathKm, relativeTrailKm, shiftedBy } from "./pathRules.js";
5
5
  import { eqjToRenderVector } from "./renderCoordinates.js";
6
6
  import { sceneOffsetKm, trackedAbsolute } from "./sceneLayout.js";
@@ -55,7 +55,7 @@ export function releaseAnchorSprite() {
55
55
  */
56
56
  export class TrackedBodyView {
57
57
  body;
58
- /** Every tracked body's path is one rule, a relative trail (`pathRules.ts`); the body it is drawn against is the path's own `lineFixedTo`, default the scene centre. */
58
+ /** Every tracked body's path is one rule, a relative trail (`pathRules.ts`); the body it is drawn against is the path's own `lineFixedTo` (one body or per-stretch), default the scene centre. */
59
59
  static pathRule = Object.freeze({ kind: "trail", frame: "relative" });
60
60
  group = new Group();
61
61
  #marker;
@@ -131,7 +131,7 @@ export class TrackedBodyView {
131
131
  */
132
132
  #remap(policy, placement, timeUtcMs) {
133
133
  const placed = placement.center;
134
- const moves = this.#against(placement) !== placed;
134
+ const moves = lineBodies(this.body.lineFixedTo).some(({ body }) => body !== placed);
135
135
  if (this.#mappedFor === policy.id && this.#placedFor === placed && (!moves || this.#mappedAt === timeUtcMs))
136
136
  return;
137
137
  this.#mappedPath = mapPathKm(this.#relative(this.#samples, placement, timeUtcMs), policy);
@@ -140,16 +140,25 @@ export class TrackedBodyView {
140
140
  this.#placedFor = placed;
141
141
  this.#mappedAt = timeUtcMs;
142
142
  }
143
- #against(placement) {
144
- return this.body.lineFixedTo ?? placement.center;
145
- }
143
+ /** Each run of samples drawn against one body (a plain `lineFixedTo` is one run) is placed from that body at its own times, then carried to the scene centre at the display time. */
146
144
  #relative(samples, placement, timeUtcMs) {
147
- if (samples.timesUtcMs.length === 0)
145
+ const count = samples.timesUtcMs.length;
146
+ if (count === 0)
148
147
  return samples.positionsKm;
149
- const against = this.#against(placement);
150
- const drawn = relativeTrailKm(samples, this.body.trajectory.stateAt(samples.timesUtcMs[0]).center, placement, against);
151
- const carry = sceneOffsetKm(placement, against, timeUtcMs);
152
- return carry === null ? drawn : shiftedBy(drawn, carry);
148
+ const native = this.body.trajectory.stateAt(samples.timesUtcMs[0]).center;
149
+ const out = new Float64Array(samples.positionsKm.length);
150
+ for (let from = 0; from < count;) {
151
+ const against = lineAgainstAt(this.body.lineFixedTo, samples.timesUtcMs[from], placement.center);
152
+ let to = from + 1;
153
+ while (to < count && lineAgainstAt(this.body.lineFixedTo, samples.timesUtcMs[to], placement.center) === against)
154
+ to += 1;
155
+ const run = { timesUtcMs: samples.timesUtcMs.slice(from, to), positionsKm: samples.positionsKm.subarray(from * 3, to * 3) };
156
+ const drawn = relativeTrailKm(run, native, placement, against);
157
+ const carry = sceneOffsetKm(placement, against, timeUtcMs);
158
+ out.set(carry === null ? drawn : shiftedBy(drawn, carry), from * 3);
159
+ from = to;
160
+ }
161
+ return out;
153
162
  }
154
163
  /** Writes [leading?] samples [from, to) [trailing?] into the line and sets how much of it is drawn. */
155
164
  #fillPath(line, from, to, leading, trailing, origin) {
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The one place the viewer touches the page address (O-052 T-223). It reads or writes the address only when the host turned `address` on;
3
+ * every parameter reader takes the search text this gives, so a new parameter cannot bypass the switch (`tests/addressRule.test.ts`).
4
+ * The developer data switch navigates the page itself and is the only other reader, listed in that test.
5
+ */
6
+ import { type ViewLinkState } from "./viewLink.js";
7
+ /** The address search (`?a=b`) the viewer may read: the page's when `enabled`, else empty, as if the address carried nothing. */
8
+ export declare function addressSearch(enabled: boolean | undefined): string;
9
+ /**
10
+ * Writes the view link into the address (so a reload keeps the view), then copies the full link. `copied` is false when the clipboard refuses; the caller then shows the link to copy by hand.
11
+ * Only called with the address option on; the copy-link button is not offered otherwise.
12
+ */
13
+ export declare function shareViewLink(state: ViewLinkState): Promise<{
14
+ readonly url: string;
15
+ readonly copied: boolean;
16
+ }>;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The one place the viewer touches the page address (O-052 T-223). It reads or writes the address only when the host turned `address` on;
3
+ * every parameter reader takes the search text this gives, so a new parameter cannot bypass the switch (`tests/addressRule.test.ts`).
4
+ * The developer data switch navigates the page itself and is the only other reader, listed in that test.
5
+ */
6
+ import { viewLinkSearch } from "./viewLink.js";
7
+ /** The address search (`?a=b`) the viewer may read: the page's when `enabled`, else empty, as if the address carried nothing. */
8
+ export function addressSearch(enabled) {
9
+ return enabled === true ? window.location.search : "";
10
+ }
11
+ /**
12
+ * Writes the view link into the address (so a reload keeps the view), then copies the full link. `copied` is false when the clipboard refuses; the caller then shows the link to copy by hand.
13
+ * Only called with the address option on; the copy-link button is not offered otherwise.
14
+ */
15
+ export async function shareViewLink(state) {
16
+ const search = viewLinkSearch(window.location.search, state);
17
+ try {
18
+ window.history.replaceState(null, "", `${window.location.pathname}${search}${window.location.hash}`);
19
+ }
20
+ catch { /* the link below still works */ }
21
+ const url = `${window.location.origin}${window.location.pathname}${search}`;
22
+ let copied = false;
23
+ try {
24
+ await navigator.clipboard.writeText(url);
25
+ copied = true;
26
+ }
27
+ catch {
28
+ copied = false;
29
+ }
30
+ return { url, copied };
31
+ }