astraeus 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +22 -15
- package/package.json +1 -1
- package/src/api/assembleScene.js +4 -4
- package/src/api/errors.d.ts +1 -1
- package/src/api/group.d.ts +12 -9
- package/src/api/group.js +26 -5
- package/src/api/index.d.ts +2 -2
- package/src/api/look.d.ts +14 -0
- package/src/api/lookInput.d.ts +1 -1
- package/src/api/lookInput.js +6 -2
- package/src/api/planCamera.d.ts +19 -2
- package/src/api/planCamera.js +45 -6
- package/src/api/planPaths.js +2 -2
- package/src/api/planStory.d.ts +3 -1
- package/src/api/planStory.js +5 -0
- package/src/api/planTimeline.d.ts +1 -1
- package/src/api/planTimeline.js +10 -1
- package/src/api/planViews.d.ts +3 -1
- package/src/api/planViews.js +4 -0
- package/src/api/scene.d.ts +11 -5
- package/src/api/scene.js +16 -2
- package/src/api/sceneReads.d.ts +32 -2
- package/src/api/story.d.ts +9 -2
- package/src/api/story.js +10 -3
- package/src/api/switches.d.ts +1 -0
- package/src/api/switches.js +3 -1
- package/src/api/time.d.ts +1 -1
- package/src/api/time.js +4 -1
- package/src/app/App.js +26 -6
- package/src/app/App.node.js +26 -6
- package/src/app/AstraeusScene.d.ts +8 -1
- package/src/app/CameraController.d.ts +2 -0
- package/src/app/CameraController.js +11 -1
- package/src/app/SkyFiguresView.d.ts +2 -2
- package/src/app/SkyFiguresView.js +25 -14
- package/src/app/displaySwitches.d.ts +2 -0
- package/src/app/displaySwitches.js +1 -1
- package/src/app/liveLook.d.ts +4 -1
- package/src/app/liveLook.js +29 -1
- package/src/app/look.d.ts +5 -0
- package/src/app/look.js +8 -2
- package/src/app/sceneCamera.js +14 -2
- package/src/app/sceneContentsHooks.js +1 -1
- package/src/app/sceneFrame.js +2 -2
- package/src/app/scenePointer.d.ts +5 -1
- package/src/app/scenePointer.js +8 -3
- package/src/app/timeLook.d.ts +7 -0
- package/src/app/timeLook.js +8 -0
- package/src/core/clock.js +2 -1
- package/src/core/listedOrbitGroup.d.ts +24 -10
- package/src/core/listedOrbitGroup.js +65 -13
- package/src/core/lookValues.d.ts +13 -0
- package/src/core/lookValues.js +39 -0
- package/src/core/state.d.ts +2 -0
- package/src/core/state.js +5 -1
- package/src/core/storyPanels.d.ts +8 -4
- package/src/core/storyPanels.js +17 -5
- package/src/shell/AstraeusShell.d.ts +5 -1
- package/src/shell/AstraeusShell.js +15 -8
- package/src/shell/AstraeusShell.node.js +15 -8
- package/src/shell/ObjectControls.js +1 -1
- package/src/shell/TimelineBar.d.ts +6 -2
- package/src/shell/TimelineBar.js +17 -12
- package/src/shell/TimelineBar.node.js +17 -12
- package/src/shell/experience.d.ts +2 -0
- package/src/shell/infoModel.d.ts +2 -1
- package/src/shell/infoModel.js +10 -10
- package/src/shell/storyPanels.d.ts +19 -1
- package/src/shell/storyPanels.js +34 -2
- package/src/shell/timelineModel.d.ts +11 -0
- package/src/shell/timelineModel.js +28 -0
- package/src/shell/useStoryPanels.d.ts +4 -0
- package/src/shell/useStoryPanels.js +27 -6
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type DistanceLimits, type OrbitCameraState } from "./CameraController.js";
|
|
2
2
|
import { type PickCandidate, type SkyPickFigure } from "./scenePicking.js";
|
|
3
|
+
/** `keepSky`: the tap came from a look-out camera, so the shell selects a body without flying away from the sky. */
|
|
4
|
+
export interface PickOptions {
|
|
5
|
+
readonly keepSky?: boolean;
|
|
6
|
+
}
|
|
3
7
|
/** The slice of the frame state the pointer listeners read and write. */
|
|
4
8
|
export interface PointerState {
|
|
5
9
|
readonly pickables: readonly PickCandidate[];
|
|
@@ -14,4 +18,4 @@ export interface PointerState {
|
|
|
14
18
|
* Wires orbit gestures, the mouse hover point and tap picking to the canvas. `state` is read live (the frame rebuilds `pickables`);
|
|
15
19
|
* returns the detach function, which also clears the cursor and the hover readout.
|
|
16
20
|
*/
|
|
17
|
-
export declare function attachScenePointer(canvas: HTMLCanvasElement, orbit: OrbitCameraState, state: PointerState, limits: () => DistanceLimits, onPickObject: ((id: string) => void) | undefined): () => void;
|
|
21
|
+
export declare function attachScenePointer(canvas: HTMLCanvasElement, orbit: OrbitCameraState, state: PointerState, limits: () => DistanceLimits, onPickObject: ((id: string, options?: PickOptions) => void) | undefined): () => void;
|
package/src/app/scenePointer.js
CHANGED
|
@@ -7,12 +7,17 @@ import { pickSkyFigure, pickTarget } from "./scenePicking.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export function attachScenePointer(canvas, orbit, state, limits, onPickObject) {
|
|
9
9
|
const onTap = (x, y, pointer) => {
|
|
10
|
-
//
|
|
11
|
-
const
|
|
10
|
+
// Orbiting, bodies first: a body hit wins over any sky figure behind it. Looking out the sky is the subject, so a figure's name or line wins and a body pick keeps the sky view.
|
|
11
|
+
const lookingOut = orbit.lookOut !== null;
|
|
12
|
+
const figure = () => pickSkyFigure(state.skyFigures?.() ?? [], x, y);
|
|
13
|
+
const id = lookingOut ? figure() ?? pickTarget(state.pickables, x, y, pointer) : pickTarget(state.pickables, x, y, pointer) ?? figure();
|
|
12
14
|
if (id === null)
|
|
13
15
|
return;
|
|
14
16
|
canvas.dataset.pickTarget = id;
|
|
15
|
-
|
|
17
|
+
if (lookingOut)
|
|
18
|
+
onPickObject?.(id, { keepSky: true });
|
|
19
|
+
else
|
|
20
|
+
onPickObject?.(id);
|
|
16
21
|
};
|
|
17
22
|
const onHoverMove = (event) => {
|
|
18
23
|
if (event.pointerType !== "mouse") {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DEFAULT_TIME_LOOK, type TimeLook } from "../shell/timelineModel.js";
|
|
2
|
+
export { DEFAULT_TIME_LOOK };
|
|
3
|
+
export type { TimeLook };
|
|
4
|
+
/** The time look in force: the look's `time`, every part not named at its default. */
|
|
5
|
+
export declare function timeLookOf(look: {
|
|
6
|
+
readonly time?: Partial<TimeLook>;
|
|
7
|
+
}): TimeLook;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// The zone and precision of the viewer's times: one look for every visitor-facing time (clock bar, slider text, bound dates, event list, event and window cards). It reaches them as a prop
|
|
2
|
+
// of the shell, with no address parameter, the way the label style does (T-316).
|
|
3
|
+
import { DEFAULT_TIME_LOOK } from "../shell/timelineModel.js";
|
|
4
|
+
export { DEFAULT_TIME_LOOK };
|
|
5
|
+
/** The time look in force: the look's `time`, every part not named at its default. */
|
|
6
|
+
export function timeLookOf(look) {
|
|
7
|
+
return { ...DEFAULT_TIME_LOOK, ...look.time };
|
|
8
|
+
}
|
package/src/core/clock.js
CHANGED
|
@@ -81,8 +81,9 @@ export class SimulationClock {
|
|
|
81
81
|
const now = this.now();
|
|
82
82
|
if (now >= window.startUtcMs && now <= window.endUtcMs)
|
|
83
83
|
return false;
|
|
84
|
-
|
|
84
|
+
// Pause first: a seek while playing re-anchors on a second monotonic read, so pausing after it would carry the time past the edge.
|
|
85
85
|
this.pause();
|
|
86
|
+
this.seek(now > window.endUtcMs ? window.endUtcMs : window.startUtcMs);
|
|
86
87
|
return true;
|
|
87
88
|
}
|
|
88
89
|
setRate(rate) {
|
|
@@ -12,12 +12,17 @@ export interface ListedElements {
|
|
|
12
12
|
readonly raanDeg: number;
|
|
13
13
|
readonly argumentOfPeriapsisDeg: number;
|
|
14
14
|
}
|
|
15
|
-
/** One record of a measured list: its own source id, the time its elements were measured, and the
|
|
15
|
+
/** One record of a measured list: its own source id, the time its elements were measured, the elements, and optionally its position along the orbit. */
|
|
16
16
|
export interface ListedMember {
|
|
17
17
|
readonly recordId: string;
|
|
18
|
-
/** The record's own time.
|
|
18
|
+
/** The record's own time (its epoch). With `meanAnomalyDeg` it fixes where the dot is; without, it is kept with the record and does not place the dot (see ListedPhase). */
|
|
19
19
|
readonly epochUtcMs: number;
|
|
20
20
|
readonly elements: ListedElements;
|
|
21
|
+
/**
|
|
22
|
+
* The record's mean anomaly in degrees at `epochUtcMs`; finite, any value (it wraps to 0 to 360). All members give it or none do:
|
|
23
|
+
* with it the group is measured-phase (each dot at its record's position, advanced by two-body motion); without it the phase is a drawing choice.
|
|
24
|
+
*/
|
|
25
|
+
readonly meanAnomalyDeg?: number;
|
|
21
26
|
}
|
|
22
27
|
/** A stated share of the members drawn near a reference body's position along its orbit. A model, not a measurement. */
|
|
23
28
|
export interface ListedConcentration {
|
|
@@ -29,10 +34,14 @@ export interface ListedConcentration {
|
|
|
29
34
|
readonly widthDeg: number;
|
|
30
35
|
}
|
|
31
36
|
export interface ListedPhase {
|
|
32
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* The instant from which members move by two-body motion. For an illustrative group, each member's mean anomaly here is the drawing choice below;
|
|
39
|
+
* for a measured-phase group (every member gives `meanAnomalyDeg`), it is the record's mean anomaly advanced from its epoch to this instant.
|
|
40
|
+
*/
|
|
33
41
|
readonly referenceUtcMs: number;
|
|
34
|
-
/** Unsigned 32-bit integer picking which member takes which slot; defaults to 0. */
|
|
42
|
+
/** Unsigned 32-bit integer picking which member takes which slot; defaults to 0. Illustrative groups only: a measured-phase group with a seed throws. */
|
|
35
43
|
readonly seed?: number;
|
|
44
|
+
/** Illustrative groups only: a measured-phase group with a concentration throws. */
|
|
36
45
|
readonly concentration?: ListedConcentration;
|
|
37
46
|
}
|
|
38
47
|
export interface ListedOrbitGroupInput {
|
|
@@ -43,13 +52,13 @@ export interface ListedOrbitGroupInput {
|
|
|
43
52
|
readonly members: readonly ListedMember[];
|
|
44
53
|
readonly phase: ListedPhase;
|
|
45
54
|
readonly bounds?: TimeBounds;
|
|
46
|
-
/** Where the elements came from.
|
|
55
|
+
/** Where the elements came from. An illustrative group restates the position along each orbit as illustrative; a measured-phase group keeps this `sourceType`. */
|
|
47
56
|
readonly provenance: Provenance;
|
|
48
57
|
}
|
|
49
58
|
export interface ListedOrbitGroup extends PointGroup {
|
|
50
59
|
/** The source record id of member `index`; also the suffix of that member's State body id. */
|
|
51
60
|
recordIdAt(index: number): string;
|
|
52
|
-
/** Member `index`'s mean anomaly (degrees, 0 to 360) at the reference time: the drawing choice. */
|
|
61
|
+
/** Member `index`'s mean anomaly (degrees, 0 to 360) at the reference time: the record's own, advanced from its epoch, for a measured-phase group; the drawing choice otherwise. */
|
|
53
62
|
meanAnomalyDegAt(index: number): number;
|
|
54
63
|
}
|
|
55
64
|
/** Solves Kepler's equation M = E - e sin E for E (Newton; bound orbits only). */
|
|
@@ -57,10 +66,15 @@ export declare function eccentricAnomalyRad(meanAnomalyRad: number, e: number):
|
|
|
57
66
|
export declare function trueAnomalyFromMeanRad(meanAnomalyRad: number, e: number): number;
|
|
58
67
|
/** Mean anomaly (radians, 0 to 2π) of a body with the given position and velocity about a centre of gravitational parameter `mu`. */
|
|
59
68
|
export declare function meanAnomalyFromStateRad(r: ArrayLike<number>, v: ArrayLike<number>, mu: number): number;
|
|
60
|
-
/** The provenance a group's own card carries: always illustrative, since the position along each orbit is a drawing choice; the source's type stays in the accuracy line. */
|
|
61
|
-
export declare function listedGroupProvenance(source: Provenance, concentrated: boolean): Provenance;
|
|
62
69
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
70
|
+
* The provenance a group's own card carries. Illustrative (the default): `sourceType` "illustrative", since the position along each orbit is a drawing
|
|
71
|
+
* choice; the source's type stays in the accuracy line. Measured-phase: the source's `sourceType`, `sources` and `accuracy` as given, with a note that
|
|
72
|
+
* each position comes from its record's mean anomaly.
|
|
73
|
+
*/
|
|
74
|
+
export declare function listedGroupProvenance(source: Provenance, concentrated: boolean, measured?: boolean): Provenance;
|
|
75
|
+
/**
|
|
76
|
+
* A group drawn from a list of measured orbits: each member has its own elements, record time and source record id. The position along
|
|
77
|
+
* each orbit is the record's own when every member gives `meanAnomalyDeg` (measured-phase), else chosen here (see ListedPhase); every
|
|
78
|
+
* member then moves on its own ellipse by two-body motion.
|
|
65
79
|
*/
|
|
66
80
|
export declare function createListedOrbitGroup(input: ListedOrbitGroupInput, adapter: TwoBodyAdapter): ListedOrbitGroup;
|
|
@@ -11,10 +11,14 @@ const VELOCITY_STEP_MS = 1000;
|
|
|
11
11
|
function describe(member, index) {
|
|
12
12
|
return `member ${index} (record "${String(member.recordId)}")`;
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* The rejection rule: a record must give a finite, bound orbit; unbound records are for the loader to drop. Mean anomalies are all or none.
|
|
16
|
+
* Returns whether the group is measured-phase (every member gives `meanAnomalyDeg`).
|
|
17
|
+
*/
|
|
15
18
|
function assertMembers(members) {
|
|
16
19
|
if (members.length === 0)
|
|
17
20
|
throw new GroupCountError("a listed group needs at least one member; the list is empty");
|
|
21
|
+
const measured = members[0]?.meanAnomalyDeg !== undefined;
|
|
18
22
|
const seen = new Set();
|
|
19
23
|
members.forEach((member, index) => {
|
|
20
24
|
const who = describe(member, index);
|
|
@@ -43,10 +47,22 @@ function assertMembers(members) {
|
|
|
43
47
|
if (!(e.inclinationDeg >= 0 && e.inclinationDeg <= 180)) {
|
|
44
48
|
throw new GroupElementsError(`${who}: inclinationDeg must be from 0 to 180, got ${e.inclinationDeg}`);
|
|
45
49
|
}
|
|
50
|
+
const m = member.meanAnomalyDeg;
|
|
51
|
+
if (m !== undefined && !(typeof m === "number" && Number.isFinite(m)))
|
|
52
|
+
throw new GroupElementsError(`${who}: meanAnomalyDeg must be finite, got ${String(m)}`);
|
|
53
|
+
if ((m !== undefined) !== measured) {
|
|
54
|
+
const missing = measured ? who : describe(members[0], 0);
|
|
55
|
+
throw new GroupElementsError(`${missing} gives no meanAnomalyDeg: give it for every member (measured positions) or for none (illustrative positions)`);
|
|
56
|
+
}
|
|
46
57
|
});
|
|
58
|
+
return measured;
|
|
47
59
|
}
|
|
48
|
-
function assertPhase(phase) {
|
|
60
|
+
function assertPhase(phase, measured) {
|
|
49
61
|
assertUtcUnixMs(phase.referenceUtcMs);
|
|
62
|
+
if (measured && phase.seed !== undefined)
|
|
63
|
+
throw new GroupElementsError("a seed only shuffles illustrative positions; the members give meanAnomalyDeg, so their positions are measured: drop the seed");
|
|
64
|
+
if (measured && phase.concentration !== undefined)
|
|
65
|
+
throw new GroupElementsError("a concentration only shapes illustrative positions; the members give meanAnomalyDeg, so their positions are measured: drop the concentration");
|
|
50
66
|
const seed = phase.seed ?? 0;
|
|
51
67
|
if (!Number.isInteger(seed) || seed < 0 || seed > 0xffffffff)
|
|
52
68
|
throw new GroupElementsError("phase seed must be an unsigned 32-bit integer");
|
|
@@ -144,11 +160,40 @@ function assignMeanAnomaliesDeg(count, phase, referenceDeg) {
|
|
|
144
160
|
}
|
|
145
161
|
return result;
|
|
146
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Mean anomalies in degrees (0 to 360) at the reference time, one per member, from each record's own mean anomaly at its epoch:
|
|
165
|
+
* M = M_epoch + n·Δt with n = √(μ / a³), the same μ the group propagates with, so placement and later motion agree.
|
|
166
|
+
*/
|
|
167
|
+
function measuredMeanAnomaliesDeg(members, referenceUtcMs, mu) {
|
|
168
|
+
const result = new Float64Array(members.length);
|
|
169
|
+
for (let i = 0; i < members.length; i++) {
|
|
170
|
+
const member = members[i];
|
|
171
|
+
const a = member.elements.semiMajorAxisKm;
|
|
172
|
+
const epochDeg = ((member.meanAnomalyDeg % 360) + 360) % 360;
|
|
173
|
+
const m = epochDeg * RADIANS + Math.sqrt(mu / (a * a * a)) * ((referenceUtcMs - member.epochUtcMs) / 1000);
|
|
174
|
+
const wrapped = ((m % TWO_PI) + TWO_PI) % TWO_PI;
|
|
175
|
+
result[i] = wrapped / RADIANS;
|
|
176
|
+
}
|
|
177
|
+
return result;
|
|
178
|
+
}
|
|
147
179
|
const PHASE_NOTE = "Each orbit's shape and orientation come from its record, but the records give no position along the orbit: "
|
|
148
180
|
+ "that position is an even spread of mean anomaly at the reference time, a drawing choice (illustrative), advanced by unperturbed two-body motion about the centre.";
|
|
181
|
+
const MEASURED_PHASE_NOTE = "Each dot's position along its orbit comes from its record's mean anomaly at the record's epoch, advanced by unperturbed two-body motion about the centre.";
|
|
149
182
|
const CONCENTRATION_NOTE = "A stated share of the dots is placed near the reference body's position along the orbit: a model, not a measurement. No orbit is added.";
|
|
150
|
-
/**
|
|
151
|
-
|
|
183
|
+
/**
|
|
184
|
+
* The provenance a group's own card carries. Illustrative (the default): `sourceType` "illustrative", since the position along each orbit is a drawing
|
|
185
|
+
* choice; the source's type stays in the accuracy line. Measured-phase: the source's `sourceType`, `sources` and `accuracy` as given, with a note that
|
|
186
|
+
* each position comes from its record's mean anomaly.
|
|
187
|
+
*/
|
|
188
|
+
export function listedGroupProvenance(source, concentrated, measured = false) {
|
|
189
|
+
if (measured) {
|
|
190
|
+
return createProvenance({
|
|
191
|
+
sourceType: source.sourceType,
|
|
192
|
+
sources: source.sources,
|
|
193
|
+
accuracy: source.accuracy,
|
|
194
|
+
notes: `${source.notes} ${MEASURED_PHASE_NOTE}`.trim(),
|
|
195
|
+
});
|
|
196
|
+
}
|
|
152
197
|
return createProvenance({
|
|
153
198
|
sourceType: "illustrative",
|
|
154
199
|
sources: source.sources,
|
|
@@ -157,20 +202,27 @@ export function listedGroupProvenance(source, concentrated) {
|
|
|
157
202
|
});
|
|
158
203
|
}
|
|
159
204
|
/**
|
|
160
|
-
* A group drawn from a list of measured orbits: each member has its own elements, record time and source record id.
|
|
161
|
-
*
|
|
205
|
+
* A group drawn from a list of measured orbits: each member has its own elements, record time and source record id. The position along
|
|
206
|
+
* each orbit is the record's own when every member gives `meanAnomalyDeg` (measured-phase), else chosen here (see ListedPhase); every
|
|
207
|
+
* member then moves on its own ellipse by two-body motion.
|
|
162
208
|
*/
|
|
163
209
|
export function createListedOrbitGroup(input, adapter) {
|
|
164
|
-
assertMembers(input.members);
|
|
165
|
-
assertPhase(input.phase);
|
|
210
|
+
const measured = assertMembers(input.members);
|
|
211
|
+
assertPhase(input.phase, measured);
|
|
166
212
|
const count = input.members.length;
|
|
167
213
|
assertGroupCount(count);
|
|
168
214
|
const { center, bounds } = input;
|
|
169
215
|
const { referenceUtcMs, concentration } = input.phase;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
216
|
+
let anomaliesDeg;
|
|
217
|
+
if (measured) {
|
|
218
|
+
anomaliesDeg = measuredMeanAnomaliesDeg(input.members, referenceUtcMs, gravitationalParameterOf(adapter, center));
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
const referenceDeg = concentration === undefined
|
|
222
|
+
? null
|
|
223
|
+
: referenceMeanAnomalyRad(concentration.around, center, referenceUtcMs, adapter) / RADIANS;
|
|
224
|
+
anomaliesDeg = assignMeanAnomaliesDeg(count, input.phase, referenceDeg);
|
|
225
|
+
}
|
|
174
226
|
const states = memberStatesOf(input.members.map(({ elements }, member) => ({
|
|
175
227
|
semiMajorAxisKm: elements.semiMajorAxisKm,
|
|
176
228
|
eccentricity: elements.eccentricity,
|
|
@@ -180,7 +232,7 @@ export function createListedOrbitGroup(input, adapter) {
|
|
|
180
232
|
trueAnomalyRad: trueAnomalyFromMeanRad(anomaliesDeg[member] * RADIANS, elements.eccentricity),
|
|
181
233
|
})), input.plane, center, adapter);
|
|
182
234
|
const recordIds = input.members.map((member) => member.recordId);
|
|
183
|
-
const provenance = listedGroupProvenance(input.provenance, concentration !== undefined);
|
|
235
|
+
const provenance = listedGroupProvenance(input.provenance, concentration !== undefined, measured);
|
|
184
236
|
let kepler = null;
|
|
185
237
|
const group = {
|
|
186
238
|
id: input.id,
|
package/src/core/lookValues.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/** True for a hex colour, a comma-form `rgb()`, `rgba()`, `hsl()` or `hsla()` or a named colour. */
|
|
2
2
|
export declare function isCssColour(value: unknown): value is string;
|
|
3
|
+
/** A CSS colour split into its opaque part (what the drawing library can take) and its alpha, 0 to 1 (1 for a colour with none): `#rrggbbaa`, `#rgba`, `rgba()` and `hsla()` carry one. The drawing library ignores an alpha in a colour, so a line multiplies it into its opacity. */
|
|
4
|
+
export declare function splitColourAlpha(colour: string): {
|
|
5
|
+
readonly colour: string;
|
|
6
|
+
readonly alpha: number;
|
|
7
|
+
};
|
|
3
8
|
/** True for a non-blank font family text (any CSS font-family list, or `inherit`). */
|
|
4
9
|
export declare function isFontFamily(value: unknown): value is string;
|
|
5
10
|
/** Label size range in pixels: small enough for a crowded sky, large enough to read on a phone. */
|
|
@@ -7,3 +12,11 @@ export declare const LABEL_SIZE_LIMITS: Readonly<{
|
|
|
7
12
|
min: 8;
|
|
8
13
|
max: 24;
|
|
9
14
|
}>;
|
|
15
|
+
/** The precisions a time can be shown to. */
|
|
16
|
+
export declare const TIME_PRECISIONS: readonly ["day", "minute", "second"];
|
|
17
|
+
/** How precisely a time reads: `"day"`, `"minute"` or `"second"`. */
|
|
18
|
+
export type TimePrecision = (typeof TIME_PRECISIONS)[number];
|
|
19
|
+
/** True for a time precision name. */
|
|
20
|
+
export declare function isTimePrecision(value: unknown): value is TimePrecision;
|
|
21
|
+
/** True for a zone the time look takes: `"UTC"`, `"local"` (the visitor's own) or an IANA name the runtime's `Intl` accepts. */
|
|
22
|
+
export declare function isTimeZone(value: unknown): value is string;
|
package/src/core/lookValues.js
CHANGED
|
@@ -16,9 +16,48 @@ export function isCssColour(value) {
|
|
|
16
16
|
const text = value.trim();
|
|
17
17
|
return HEX.test(text) || FUNCTION.test(text) || NAMED.has(text.toLowerCase());
|
|
18
18
|
}
|
|
19
|
+
const FUNCTION_PARTS = /^(rgb|hsl)a?\(\s*([\d.]+%?)\s*,\s*([\d.]+%?)\s*,\s*([\d.]+%?)\s*(?:,\s*([\d.]+%?)\s*)?\)$/i;
|
|
20
|
+
function alphaOf(text) {
|
|
21
|
+
if (text === undefined)
|
|
22
|
+
return 1;
|
|
23
|
+
const value = text.endsWith("%") ? Number.parseFloat(text) / 100 : Number.parseFloat(text);
|
|
24
|
+
return Number.isFinite(value) ? Math.min(1, Math.max(0, value)) : 1;
|
|
25
|
+
}
|
|
26
|
+
/** A CSS colour split into its opaque part (what the drawing library can take) and its alpha, 0 to 1 (1 for a colour with none): `#rrggbbaa`, `#rgba`, `rgba()` and `hsla()` carry one. The drawing library ignores an alpha in a colour, so a line multiplies it into its opacity. */
|
|
27
|
+
export function splitColourAlpha(colour) {
|
|
28
|
+
const text = colour.trim();
|
|
29
|
+
if (/^#[0-9a-f]{4}$/i.test(text))
|
|
30
|
+
return { colour: `#${text[1]}${text[2]}${text[3]}`, alpha: Number.parseInt(text[4] + text[4], 16) / 255 };
|
|
31
|
+
if (/^#[0-9a-f]{8}$/i.test(text))
|
|
32
|
+
return { colour: text.slice(0, 7), alpha: Number.parseInt(text.slice(7), 16) / 255 };
|
|
33
|
+
const parts = FUNCTION_PARTS.exec(text);
|
|
34
|
+
if (parts === null || parts[5] === undefined)
|
|
35
|
+
return { colour: text, alpha: 1 };
|
|
36
|
+
return { colour: `${parts[1].toLowerCase()}(${parts[2]}, ${parts[3]}, ${parts[4]})`, alpha: alphaOf(parts[5]) };
|
|
37
|
+
}
|
|
19
38
|
/** True for a non-blank font family text (any CSS font-family list, or `inherit`). */
|
|
20
39
|
export function isFontFamily(value) {
|
|
21
40
|
return typeof value === "string" && value.trim() !== "" && !/[;{}]/.test(value);
|
|
22
41
|
}
|
|
23
42
|
/** Label size range in pixels: small enough for a crowded sky, large enough to read on a phone. */
|
|
24
43
|
export const LABEL_SIZE_LIMITS = Object.freeze({ min: 8, max: 24 });
|
|
44
|
+
/** The precisions a time can be shown to. */
|
|
45
|
+
export const TIME_PRECISIONS = Object.freeze(["day", "minute", "second"]);
|
|
46
|
+
/** True for a time precision name. */
|
|
47
|
+
export function isTimePrecision(value) {
|
|
48
|
+
return typeof value === "string" && TIME_PRECISIONS.includes(value);
|
|
49
|
+
}
|
|
50
|
+
/** True for a zone the time look takes: `"UTC"`, `"local"` (the visitor's own) or an IANA name the runtime's `Intl` accepts. */
|
|
51
|
+
export function isTimeZone(value) {
|
|
52
|
+
if (typeof value !== "string" || value.trim() === "")
|
|
53
|
+
return false;
|
|
54
|
+
if (value === "UTC" || value === "local")
|
|
55
|
+
return true;
|
|
56
|
+
try {
|
|
57
|
+
new Intl.DateTimeFormat(undefined, { timeZone: value });
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
package/src/core/state.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export interface StateInput {
|
|
|
28
28
|
readonly velocityKmS?: ArrayLike<number>;
|
|
29
29
|
readonly orientation: Quaternion | null;
|
|
30
30
|
}
|
|
31
|
+
/** True for a whole-millisecond JavaScript UTC Unix time inside the Date range. */
|
|
32
|
+
export declare function isUtcUnixMs(timeUtcMs: number): boolean;
|
|
31
33
|
export declare function assertUtcUnixMs(timeUtcMs: number): void;
|
|
32
34
|
export declare function createCenteredPosition(input: Omit<StateInput, "orientation">): CenteredPosition;
|
|
33
35
|
/** Whether a body's definition says its State must carry a modelled orientation. */
|
package/src/core/state.js
CHANGED
|
@@ -4,8 +4,12 @@ import { MOON } from "./bodies/moon.js";
|
|
|
4
4
|
import { SUN } from "./bodies/sun.js";
|
|
5
5
|
export const EQJ = "EQJ";
|
|
6
6
|
const MAX_DATE_MS = 8.64e15;
|
|
7
|
+
/** True for a whole-millisecond JavaScript UTC Unix time inside the Date range. */
|
|
8
|
+
export function isUtcUnixMs(timeUtcMs) {
|
|
9
|
+
return Number.isSafeInteger(timeUtcMs) && Math.abs(timeUtcMs) <= MAX_DATE_MS;
|
|
10
|
+
}
|
|
7
11
|
export function assertUtcUnixMs(timeUtcMs) {
|
|
8
|
-
if (!
|
|
12
|
+
if (!isUtcUnixMs(timeUtcMs)) {
|
|
9
13
|
throw new RangeError("timeUtcMs must be an integer JavaScript UTC Unix-millisecond value");
|
|
10
14
|
}
|
|
11
15
|
}
|
|
@@ -48,9 +48,11 @@ export interface StoryPanel extends PanelActions {
|
|
|
48
48
|
readonly provenance: Provenance;
|
|
49
49
|
/** A shell object this panel is about; the scene draws a marker on it that reopens the panel. */
|
|
50
50
|
readonly objectId?: string;
|
|
51
|
+
/** This panel's own span, in simulated seconds: forward playback closes it once the clock passes its time plus this. Overrides the playback setting; absent, the playback setting (or none) applies. */
|
|
52
|
+
readonly closeAfterSeconds?: number;
|
|
51
53
|
}
|
|
52
|
-
/** A story step: a panel with no moment, shown in the order added with Back and Next. */
|
|
53
|
-
export type StoryStep = Omit<StoryPanel, "timeUtcMs"> & {
|
|
54
|
+
/** A story step: a panel with no moment, shown in the order added with Back and Next. A step never closes by itself. */
|
|
55
|
+
export type StoryStep = Omit<StoryPanel, "timeUtcMs" | "closeAfterSeconds"> & {
|
|
54
56
|
/** The step's place among the steps, counting from 1 in the order added. */
|
|
55
57
|
readonly step: number;
|
|
56
58
|
};
|
|
@@ -64,11 +66,13 @@ export interface StoryPanelSet {
|
|
|
64
66
|
readonly pauseSeconds: number;
|
|
65
67
|
/** Whether panels open by themselves as forward playback reaches them. */
|
|
66
68
|
readonly autoOpen: boolean;
|
|
69
|
+
/** Simulated seconds after a moment panel's time at which forward playback closes it; absent: never (a panel's own span wins). */
|
|
70
|
+
readonly closeAfterSeconds?: number;
|
|
67
71
|
}
|
|
68
72
|
export declare const DEFAULT_PANEL_PAUSE_SECONDS = 6;
|
|
69
73
|
export declare const MAX_PANEL_PAUSE_SECONDS = 20;
|
|
70
|
-
/** The
|
|
71
|
-
export type PanelPlayback = Pick<StoryPanelSet, "pauseSeconds" | "autoOpen">;
|
|
74
|
+
/** The playback settings of a scene's story panels. */
|
|
75
|
+
export type PanelPlayback = Pick<StoryPanelSet, "pauseSeconds" | "autoOpen" | "closeAfterSeconds">;
|
|
72
76
|
export declare const DEFAULT_PANEL_PLAYBACK: PanelPlayback;
|
|
73
77
|
/** A panel whose own shape is sound and whose moment is converted. What it names (an event, an anchor, an object) is left for `resolveStoryPanels`, because those may be added later. */
|
|
74
78
|
export interface CheckedPanel extends Omit<StoryPanel, "timeUtcMs" | "objectId"> {
|
package/src/core/storyPanels.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createProvenance, PROVENANCE_SOURCE_TYPES } from "./provenance.js";
|
|
2
|
+
import { isUtcUnixMs } from "./state.js";
|
|
2
3
|
import { timeInputMs } from "./timeInput.js";
|
|
3
4
|
/** The ids a camera request names: the bodies it points at, and the id a look-out turns toward (a body or a sky figure). */
|
|
4
5
|
export function cameraIdsOf(request) {
|
|
@@ -45,7 +46,7 @@ function atOf(panel, at) {
|
|
|
45
46
|
if (keys[0] === "anchor")
|
|
46
47
|
return { anchor: text(panel, "at.anchor", at.anchor) };
|
|
47
48
|
const timeUtcMs = timeInputMs(at.time);
|
|
48
|
-
if (!
|
|
49
|
+
if (!isUtcUnixMs(timeUtcMs))
|
|
49
50
|
throw new StoryPanelError(panel, "at.time", `must be a valid moment (ISO text, a Date or Unix milliseconds), got ${JSON.stringify(at.time)}`);
|
|
50
51
|
return { timeUtcMs };
|
|
51
52
|
}
|
|
@@ -62,6 +63,12 @@ function provenanceOf(panel, value) {
|
|
|
62
63
|
throw new StoryPanelError(panel, "provenance.notes", "must be text");
|
|
63
64
|
return createProvenance(value);
|
|
64
65
|
}
|
|
66
|
+
/** A close span: finite and above 0, in simulated seconds. */
|
|
67
|
+
function spanOf(panel, field, value) {
|
|
68
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0)
|
|
69
|
+
throw new StoryPanelError(panel, field, `must be a number of seconds above 0, got ${JSON.stringify(value)}`);
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
65
72
|
/** Checks the shape of one panel, the `index`th of the list it came in. Nothing here looks at the scene: links are `resolveStoryPanels`' job. */
|
|
66
73
|
export function checkStoryPanel(raw, index) {
|
|
67
74
|
if (!isRecord(raw))
|
|
@@ -69,6 +76,9 @@ export function checkStoryPanel(raw, index) {
|
|
|
69
76
|
const id = text(`#${index + 1}`, "id", raw.id);
|
|
70
77
|
const object = raw.object === undefined ? undefined : text(id, "object", raw.object);
|
|
71
78
|
const at = atOf(id, raw.at);
|
|
79
|
+
if (at === undefined && raw.closeAfterSeconds !== undefined)
|
|
80
|
+
throw new StoryPanelError(id, "closeAfterSeconds", "is for a moment panel: a step never closes by itself");
|
|
81
|
+
const closeAfterSeconds = raw.closeAfterSeconds === undefined ? undefined : spanOf(id, "closeAfterSeconds", raw.closeAfterSeconds);
|
|
72
82
|
return {
|
|
73
83
|
id,
|
|
74
84
|
...(at === undefined ? {} : { at }),
|
|
@@ -77,12 +87,13 @@ export function checkStoryPanel(raw, index) {
|
|
|
77
87
|
details: raw.details === undefined ? [] : lines(id, "details", raw.details),
|
|
78
88
|
provenance: provenanceOf(id, raw.provenance),
|
|
79
89
|
...(object === undefined ? {} : { object }),
|
|
90
|
+
...(closeAfterSeconds === undefined ? {} : { closeAfterSeconds }),
|
|
80
91
|
};
|
|
81
92
|
}
|
|
82
93
|
/** Checks the two playback settings; a setting left out takes its default, so the result is the whole setting. */
|
|
83
94
|
export function checkPanelPlayback(raw) {
|
|
84
95
|
if (!isRecord(raw))
|
|
85
|
-
throw new StoryPanelError("settings", "playback", "must be an object: { pauseSeconds?, autoOpen? }");
|
|
96
|
+
throw new StoryPanelError("settings", "playback", "must be an object: { pauseSeconds?, autoOpen?, closeAfterSeconds? }");
|
|
86
97
|
const pauseSeconds = raw.pauseSeconds ?? DEFAULT_PANEL_PLAYBACK.pauseSeconds;
|
|
87
98
|
if (typeof pauseSeconds !== "number" || !Number.isFinite(pauseSeconds) || pauseSeconds < 0 || pauseSeconds > MAX_PANEL_PAUSE_SECONDS) {
|
|
88
99
|
throw new StoryPanelError("settings", "pauseSeconds", `must be between 0 and ${MAX_PANEL_PAUSE_SECONDS}, got ${JSON.stringify(pauseSeconds)}`);
|
|
@@ -90,7 +101,8 @@ export function checkPanelPlayback(raw) {
|
|
|
90
101
|
const autoOpen = raw.autoOpen ?? DEFAULT_PANEL_PLAYBACK.autoOpen;
|
|
91
102
|
if (typeof autoOpen !== "boolean")
|
|
92
103
|
throw new StoryPanelError("settings", "autoOpen", "must be true or false");
|
|
93
|
-
|
|
104
|
+
const closeAfterSeconds = raw.closeAfterSeconds === undefined ? undefined : spanOf("settings", "closeAfterSeconds", raw.closeAfterSeconds);
|
|
105
|
+
return { pauseSeconds, autoOpen, ...(closeAfterSeconds === undefined ? {} : { closeAfterSeconds }) };
|
|
94
106
|
}
|
|
95
107
|
function timeOf(id, at, lookup) {
|
|
96
108
|
if ("timeUtcMs" in at)
|
|
@@ -126,13 +138,13 @@ function checkLinks({ id, object, camera, trace }, lookup) {
|
|
|
126
138
|
/** The actions a panel carries, in the order they apply. */
|
|
127
139
|
const actionsOf = ({ camera, select, trace }) => ({ ...(camera === undefined ? {} : { camera }), ...(select === undefined ? {} : { select }), ...(trace === undefined ? {} : { trace }) });
|
|
128
140
|
function resolvePanel(panel, lookup) {
|
|
129
|
-
const { id, at, title, body, details, provenance, object } = panel;
|
|
141
|
+
const { id, at, title, body, details, provenance, object, closeAfterSeconds } = panel;
|
|
130
142
|
const timeUtcMs = timeOf(id, at, lookup);
|
|
131
143
|
if (lookup.window !== undefined && (timeUtcMs < lookup.window.startUtcMs || timeUtcMs > lookup.window.endUtcMs)) {
|
|
132
144
|
throw new StoryPanelError(id, "at", "falls outside the timeline window");
|
|
133
145
|
}
|
|
134
146
|
checkLinks(panel, lookup);
|
|
135
|
-
return { id, timeUtcMs, title, body, details, provenance, ...(object === undefined ? {} : { objectId: object }), ...actionsOf(panel) };
|
|
147
|
+
return { id, timeUtcMs, title, body, details, provenance, ...(object === undefined ? {} : { objectId: object }), ...(closeAfterSeconds === undefined ? {} : { closeAfterSeconds }), ...actionsOf(panel) };
|
|
136
148
|
}
|
|
137
149
|
function resolveStep(panel, lookup, step) {
|
|
138
150
|
const { id, title, body, details, provenance, object } = panel;
|
|
@@ -3,6 +3,7 @@ import type { ClockSnapshot } from "../core/clock.js";
|
|
|
3
3
|
import { type PanelCause, type StoryPanelSettings } from "./useStoryPanels.js";
|
|
4
4
|
import type { TimelineGlowLook } from "./timelineGlow.js";
|
|
5
5
|
import { type ExperienceCameraPreset, type ExperienceConfig } from "./experience.js";
|
|
6
|
+
import type { TimeLook } from "./timelineModel.js";
|
|
6
7
|
import type { Metric } from "./metrics.js";
|
|
7
8
|
import { type PhoneLayoutSettings } from "./phoneLayout.js";
|
|
8
9
|
import type { DisplaySwitchItem, ViewChoice } from "./DisplaySwitches.js";
|
|
@@ -71,6 +72,8 @@ interface Props {
|
|
|
71
72
|
readonly fontFamily: string;
|
|
72
73
|
readonly sizePx: number;
|
|
73
74
|
};
|
|
75
|
+
/** The zone and precision of every visitor-facing time (the look `time`); absent: UTC to the second. */
|
|
76
|
+
readonly timeLook?: TimeLook;
|
|
74
77
|
/** The family of moons lit up in the scene now (the moon panel's choice), or null; the app draws it. */
|
|
75
78
|
readonly highlightedFamily?: string | null;
|
|
76
79
|
readonly onHighlightFamily?: (familyId: string | null) => void;
|
|
@@ -102,9 +105,10 @@ interface Props {
|
|
|
102
105
|
readonly pickRequest?: {
|
|
103
106
|
readonly id: string;
|
|
104
107
|
readonly serial: number;
|
|
108
|
+
readonly keepSky?: boolean;
|
|
105
109
|
} | null;
|
|
106
110
|
readonly children: ReactNode;
|
|
107
111
|
}
|
|
108
112
|
/** Canvas-first layout shared by astronomy experiences. Scene and diagnostics stay app-owned. */
|
|
109
|
-
export declare function AstraeusShell({ experience, snapshot, developerMode, onDeveloperModeChange, onTogglePlayback, onRateChange, paceAuto, onSeek, onCameraRequest, onTurnToFigure, onCameraHold, onTimeShown, hostCameraSet, storySeekNote, onSelectionChange, scaleId, onScaleChange, scaleChoices, switcher, displaySwitches, viewChoice, viewCamera, metricsFor, developerTools, storyPanelSettings, timelineGlow, phoneLayout, labelStyle, highlightedFamily, onHighlightFamily, onSetPlaying, panelRequest, onOpenPanelChange, featureRequest, onOpenFeatureChange, pickRequest, selectRequest, onSelectRequestApplied, children, }: Props): import("react").JSX.Element;
|
|
113
|
+
export declare function AstraeusShell({ experience, snapshot, developerMode, onDeveloperModeChange, onTogglePlayback, onRateChange, paceAuto, onSeek, onCameraRequest, onTurnToFigure, onCameraHold, onTimeShown, hostCameraSet, storySeekNote, onSelectionChange, scaleId, onScaleChange, scaleChoices, switcher, displaySwitches, viewChoice, viewCamera, metricsFor, developerTools, storyPanelSettings, timelineGlow, phoneLayout, labelStyle, timeLook, highlightedFamily, onHighlightFamily, onSetPlaying, panelRequest, onOpenPanelChange, featureRequest, onOpenFeatureChange, pickRequest, selectRequest, onSelectRequestApplied, children, }: Props): import("react").JSX.Element;
|
|
110
114
|
export {};
|
|
@@ -46,7 +46,7 @@ export function initialObjectId(experience, timeUtcMs) {
|
|
|
46
46
|
}
|
|
47
47
|
/** The story-panel settings the experience carries itself, used when the app gives none live. */
|
|
48
48
|
function ownStorySettings(storySet) {
|
|
49
|
-
return { autoOpen: storySet?.autoOpen ?? false, pauseSeconds: storySet?.pauseSeconds ?? 0 };
|
|
49
|
+
return { autoOpen: storySet?.autoOpen ?? false, pauseSeconds: storySet?.pauseSeconds ?? 0, ...(storySet?.closeAfterSeconds === undefined ? {} : { closeAfterSeconds: storySet.closeAfterSeconds }) };
|
|
50
50
|
}
|
|
51
51
|
/** The timeline bar, or nothing when the experience says it has no timeline. */
|
|
52
52
|
function ShellTimeline({ hidden, ...bar }) {
|
|
@@ -121,17 +121,17 @@ function objectLabelOr(experience, objectId, fallback) {
|
|
|
121
121
|
return experience.objects.find((object) => object.id === objectId)?.label ?? skyFigureById(experience, objectId)?.label ?? fallback;
|
|
122
122
|
}
|
|
123
123
|
/** The information panel's content and, for an object, its live measurements. */
|
|
124
|
-
function infoContent(experience, info, selectedObjectId, timeUtcMs, metricsFor) {
|
|
124
|
+
function infoContent(experience, info, selectedObjectId, timeUtcMs, metricsFor, timeLook) {
|
|
125
125
|
const view = info === null
|
|
126
126
|
? null
|
|
127
|
-
: infoView(experience, info.kind === "object" ? { kind: "object", id: selectedObjectId } : info, timeUtcMs);
|
|
127
|
+
: infoView(experience, info.kind === "object" ? { kind: "object", id: selectedObjectId } : info, timeUtcMs, timeLook);
|
|
128
128
|
const metrics = view?.target.kind === "object" && metricsFor !== undefined && skyFigureById(experience, view.target.id) === undefined ? metricsFor(view.target.id, timeUtcMs) : [];
|
|
129
129
|
return { view, metrics };
|
|
130
130
|
}
|
|
131
131
|
/** The moon families load on demand: only an experience with `moonFamilies` draws them (I-089). */
|
|
132
132
|
const MoonFamilyPanel = lazy(() => import("./MoonFamilyPanel.js").then((module) => ({ default: module.MoonFamilyPanel })));
|
|
133
133
|
/** Canvas-first layout shared by astronomy experiences. Scene and diagnostics stay app-owned. */
|
|
134
|
-
export function AstraeusShell({ experience, snapshot, developerMode, onDeveloperModeChange, onTogglePlayback, onRateChange, paceAuto, onSeek, onCameraRequest, onTurnToFigure, onCameraHold, onTimeShown, hostCameraSet, storySeekNote, onSelectionChange, scaleId, onScaleChange, scaleChoices, switcher, displaySwitches, viewChoice, viewCamera, metricsFor, developerTools, storyPanelSettings, timelineGlow, phoneLayout = DEFAULT_PHONE_LAYOUT, labelStyle, highlightedFamily = null, onHighlightFamily, onSetPlaying, panelRequest, onOpenPanelChange, featureRequest, onOpenFeatureChange, pickRequest, selectRequest, onSelectRequestApplied, children, }) {
|
|
134
|
+
export function AstraeusShell({ experience, snapshot, developerMode, onDeveloperModeChange, onTogglePlayback, onRateChange, paceAuto, onSeek, onCameraRequest, onTurnToFigure, onCameraHold, onTimeShown, hostCameraSet, storySeekNote, onSelectionChange, scaleId, onScaleChange, scaleChoices, switcher, displaySwitches, viewChoice, viewCamera, metricsFor, developerTools, storyPanelSettings, timelineGlow, phoneLayout = DEFAULT_PHONE_LAYOUT, labelStyle, timeLook, highlightedFamily = null, onHighlightFamily, onSetPlaying, panelRequest, onOpenPanelChange, featureRequest, onOpenFeatureChange, pickRequest, selectRequest, onSelectRequestApplied, children, }) {
|
|
135
135
|
const infoPanelId = `${useId()}-info-panel`;
|
|
136
136
|
const [selectedObjectId, setSelectedObjectId] = useState(() => initialObjectId(experience, snapshot.timeUtcMs));
|
|
137
137
|
const phone = usePhone();
|
|
@@ -283,11 +283,18 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
283
283
|
setInfo({ kind: "object" });
|
|
284
284
|
};
|
|
285
285
|
/** An object tapped or clicked in the scene: the picker's focus; on a wide screen it also opens the card, on a phone it does not (T-138). A tapped body-set member that is no listed object just flies there. */
|
|
286
|
-
const pickObject = (id) => {
|
|
286
|
+
const pickObject = (id, keepSky = false) => {
|
|
287
287
|
const object = availableObjectById(experience, id, snapshot.timeUtcMs);
|
|
288
288
|
if (skyFigureById(experience, id) !== undefined) {
|
|
289
289
|
selectFigure(id, pickOpensInfo(phone));
|
|
290
290
|
}
|
|
291
|
+
else if (object !== undefined && keepSky) {
|
|
292
|
+
// A tap from a look-out camera: select it and stay in the sky (owner, 2026-11-15); the menu's Focus and Follow still fly there.
|
|
293
|
+
setSelectedObjectId(object.id);
|
|
294
|
+
onSelectionChange(object.id, "visitor");
|
|
295
|
+
if (pickOpensInfo(phone))
|
|
296
|
+
setInfo({ kind: "object" });
|
|
297
|
+
}
|
|
291
298
|
else if (object !== undefined) {
|
|
292
299
|
activatePreset(focusPresetFor(experience, object));
|
|
293
300
|
if (pickOpensInfo(phone))
|
|
@@ -299,7 +306,7 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
299
306
|
const requestedPickSerial = serialOf(pickRequest);
|
|
300
307
|
useEffect(() => {
|
|
301
308
|
if (pickRequest !== null && pickRequest !== undefined)
|
|
302
|
-
pickObject(pickRequest.id);
|
|
309
|
+
pickObject(pickRequest.id, pickRequest.keepSky === true);
|
|
303
310
|
// Only a new request flies; the handler reads the current time and experience.
|
|
304
311
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
305
312
|
}, [requestedPickSerial]);
|
|
@@ -368,7 +375,7 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
368
375
|
if (info?.kind === "window")
|
|
369
376
|
setInfo({ kind: "window", id: window.id });
|
|
370
377
|
};
|
|
371
|
-
const { view, metrics } = infoContent(experience, info, selectedObjectId, snapshot.timeUtcMs, metricsFor);
|
|
378
|
+
const { view, metrics } = infoContent(experience, info, selectedObjectId, snapshot.timeUtcMs, metricsFor, timeLook);
|
|
372
379
|
// On a wide screen the moons sheet and the information panel share the left column under the toolbar: opening one closes the other.
|
|
373
380
|
const toggleMoons = () => {
|
|
374
381
|
if (!moonsOpen)
|
|
@@ -380,5 +387,5 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
380
387
|
const selectedLabel = objectLabelOr(experience, selectedObjectId, "Controls");
|
|
381
388
|
const topBar = (_jsx(TopBar, { experience: experience, timeUtcMs: snapshot.timeUtcMs, selectedObjectId: selectedObjectId, activePresetId: activePresetId, onSelectObject: selectObject, onCameraPreset: activatePreset, infoOpen: info?.kind === "object", onToggleInfo: () => setInfo(info?.kind === "object" ? null : { kind: "object" }), infoPanelId: infoPanelId, scaleId: scaleId, onScaleChange: onScaleChange, scaleChoices: scaleChoices, switcher: switcher, displaySwitches: displaySwitches, viewChoice: viewChoice }));
|
|
382
389
|
const moonPanel = experience.moonFamilies === undefined ? null : (_jsx(PanelLoadBoundary, { message: "The moon list could not load. Reload the page to try again.", children: _jsx(Suspense, { fallback: null, children: _jsx(MoonFamilyPanel, { list: experience.moonFamilies, highlightedFamily: highlightedFamily, onHighlight: (id) => onHighlightFamily?.(id), onSelectMoon: chooseMoon }) }) }));
|
|
383
|
-
return (_jsxs("main", { className: "astraeus-shell", ref: root, "data-phone": phone, "data-timeline-hidden": experience.hideTimeline === true, "data-embedded": embedded, style: { ...phoneLayoutStyle(phoneLayout), ...labelStyleVars(labelStyle) }, children: [_jsx("div", { className: "shell-canvas", children: children }), phone && _jsxs(ControlsDrawer, { label: selectedLabel, open: controlsOpen, onOpenChange: openControls, swipeThresholdPx: phoneLayout.swipeThresholdPx, children: [topBar, moonPanel] }), _jsxs("div", { className: "shell-top", children: [!phone && topBar, !phone && moonPanel !== null && _jsx(MoonsSheet, { planetLabel: experience.moonFamilies?.planetLabel, open: moonsOpen, onToggle: toggleMoons, onClose: () => setMoonsOpen(false), children: moonPanel }), view !== null && _jsx(InfoPanel, { view: view, metrics: metrics, onClose: () => setInfo(null), id: infoPanelId })] }), story.openPanel !== null && (_jsx(StoryPanelView, { panel: story.openPanel, holding: story.holding, onClose: closePanel, onContinue: story.continuePlayback, step: stepNav })), _jsx(DeveloperDrawer, { developerMode: developerMode, onDeveloperModeChange: onDeveloperModeChange, children: developerTools }), _jsx(ShellTimeline, { hidden: experience.hideTimeline === true, experience: experience, snapshot: snapshot, onTogglePlayback: onTogglePlayback, onRateChange: onRateChange, paceAuto: paceAuto, onSeek: seek, panels: storyPanels, openPanelId: openPanelId, onPanelOpen: openPanelFromTimeline, onEventSeek: seekToEvent, onEventInfo: (event) => setInfo({ kind: "event", id: event.id }), onWindowSeek: seekToWindow, onWindowInfo: (window) => setInfo({ kind: "window", id: window.id }), glowLook: timelineGlow, infoPanelId: infoPanelId, drawer: phone ? { open: timelineOpen, onOpenChange: openTimeline, swipeThresholdPx: phoneLayout.swipeThresholdPx } : undefined })] }));
|
|
390
|
+
return (_jsxs("main", { className: "astraeus-shell", ref: root, "data-phone": phone, "data-timeline-hidden": experience.hideTimeline === true, "data-embedded": embedded, style: { ...phoneLayoutStyle(phoneLayout), ...labelStyleVars(labelStyle) }, children: [_jsx("div", { className: "shell-canvas", children: children }), phone && _jsxs(ControlsDrawer, { label: selectedLabel, open: controlsOpen, onOpenChange: openControls, swipeThresholdPx: phoneLayout.swipeThresholdPx, children: [topBar, moonPanel] }), _jsxs("div", { className: "shell-top", children: [!phone && topBar, !phone && moonPanel !== null && _jsx(MoonsSheet, { planetLabel: experience.moonFamilies?.planetLabel, open: moonsOpen, onToggle: toggleMoons, onClose: () => setMoonsOpen(false), children: moonPanel }), view !== null && _jsx(InfoPanel, { view: view, metrics: metrics, onClose: () => setInfo(null), id: infoPanelId })] }), story.openPanel !== null && (_jsx(StoryPanelView, { panel: story.openPanel, holding: story.holding, onClose: closePanel, onContinue: story.continuePlayback, step: stepNav })), _jsx(DeveloperDrawer, { developerMode: developerMode, onDeveloperModeChange: onDeveloperModeChange, children: developerTools }), _jsx(ShellTimeline, { hidden: experience.hideTimeline === true, experience: experience, snapshot: snapshot, timeLook: timeLook, onTogglePlayback: onTogglePlayback, onRateChange: onRateChange, paceAuto: paceAuto, onSeek: seek, panels: storyPanels, openPanelId: openPanelId, onPanelOpen: openPanelFromTimeline, onEventSeek: seekToEvent, onEventInfo: (event) => setInfo({ kind: "event", id: event.id }), onWindowSeek: seekToWindow, onWindowInfo: (window) => setInfo({ kind: "window", id: window.id }), glowLook: timelineGlow, infoPanelId: infoPanelId, drawer: phone ? { open: timelineOpen, onOpenChange: openTimeline, swipeThresholdPx: phoneLayout.swipeThresholdPx } : undefined })] }));
|
|
384
391
|
}
|