astraeus 0.9.0 → 0.9.1
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 +18 -0
- package/README.md +87 -27
- package/package.json +1 -1
- package/src/api/assembleScene.js +1 -1
- package/src/api/index.d.ts +1 -1
- package/src/api/planBodies.d.ts +2 -1
- package/src/api/planBodies.js +6 -1
- package/src/api/planPaths.d.ts +2 -0
- package/src/api/planPaths.js +14 -9
- package/src/api/providerPathTimes.d.ts +10 -0
- package/src/api/providerPathTimes.js +109 -0
- package/src/api/scene.d.ts +6 -0
- package/src/api/shownDuring.d.ts +12 -0
- package/src/api/shownDuring.js +30 -0
- package/src/api/story.d.ts +1 -1
- package/src/api/story.js +1 -1
- package/src/app/App.js +33 -16
- package/src/app/App.node.js +33 -16
- package/src/app/CameraController.d.ts +2 -1
- package/src/app/CameraController.js +4 -2
- package/src/app/sceneFrame.d.ts +14 -5
- package/src/app/sceneFrame.js +29 -19
- package/src/app/viewHiding.d.ts +8 -1
- package/src/app/viewHiding.js +23 -0
- package/src/core/pacing.d.ts +38 -6
- package/src/core/pacing.js +141 -21
- package/src/shell/AstraeusShell.d.ts +3 -1
- package/src/shell/AstraeusShell.js +25 -7
- package/src/shell/AstraeusShell.node.js +25 -7
- package/src/shell/ObjectControls.js +1 -1
- package/src/shell/experience.d.ts +7 -0
- package/src/shell/objectModel.d.ts +3 -2
- package/src/shell/objectModel.js +6 -4
|
@@ -5,12 +5,19 @@ import type { TimeBounds } from "../core/trajectory.js";
|
|
|
5
5
|
import type { BodyFeatureSet } from "./bodyFeatures.js";
|
|
6
6
|
import type { MoonFamilyList } from "./moonFamilies.js";
|
|
7
7
|
import type { StoryPanelSet } from "./storyPanels.js";
|
|
8
|
+
/** When an object is shown, in Unix milliseconds: `startUtcMs <= t < endUtcMs`; an absent end is unbounded. Presentation only (`shownDuring`); not the object's `availability`. */
|
|
9
|
+
export interface ShownSpan {
|
|
10
|
+
readonly startUtcMs?: number;
|
|
11
|
+
readonly endUtcMs?: number;
|
|
12
|
+
}
|
|
8
13
|
export interface ExperienceObject {
|
|
9
14
|
readonly id: string;
|
|
10
15
|
readonly label: string;
|
|
11
16
|
readonly color?: string;
|
|
12
17
|
/** Omit for objects that are always available. */
|
|
13
18
|
readonly availability?: TimeBounds;
|
|
19
|
+
/** Omit to show the object at every time. Outside the span the scene draws none of it (marker, line, label) and it cannot be picked; its state is unchanged. */
|
|
20
|
+
readonly shownDuring?: ShownSpan;
|
|
14
21
|
/** Higher values win when projected labels would overlap. */
|
|
15
22
|
readonly labelPriority?: number;
|
|
16
23
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ExperienceCameraPreset, type ExperienceConfig, type ExperienceObject, type SkyFigureCard } from "./experience.js";
|
|
2
2
|
export type CameraMode = "overview" | "focus" | "follow" | "lookOut";
|
|
3
|
+
/** Whether the object can be used at `timeUtcMs`: shown by its `shownDuring` span (the one rule, `shownAt`) and inside its `availability`. */
|
|
3
4
|
export declare function isObjectAvailable(object: ExperienceObject, timeUtcMs: number): boolean;
|
|
4
5
|
export declare function availableObjectById(experience: ExperienceConfig, id: string, timeUtcMs: number): ExperienceObject | undefined;
|
|
5
6
|
export declare function firstAvailableObject(experience: ExperienceConfig, timeUtcMs: number): ExperienceObject | undefined;
|
|
@@ -12,8 +13,8 @@ export declare function focusPresetFor(experience: ExperienceConfig, object: {
|
|
|
12
13
|
readonly label: string;
|
|
13
14
|
}): ExperienceCameraPreset;
|
|
14
15
|
export declare function findCameraPreset(experience: ExperienceConfig, mode: CameraMode, target?: string): ExperienceCameraPreset | undefined;
|
|
15
|
-
/** The objects the Object list offers: the listed ones, and the selected one even when unlisted so the list never shows a blank. */
|
|
16
|
-
export declare function listedObjects(experience: ExperienceConfig, selectedId: string): readonly ExperienceObject[];
|
|
16
|
+
/** The objects the Object list offers: the listed ones shown at `timeUtcMs` (an object outside its `shownDuring` span is absent), and the selected one even when unlisted so the list never shows a blank. */
|
|
17
|
+
export declare function listedObjects(experience: ExperienceConfig, selectedId: string, timeUtcMs?: number): readonly ExperienceObject[];
|
|
17
18
|
/** Unlisted objects that belong to `id` (an orbit line to its body), for the related buttons in the top bar. */
|
|
18
19
|
export declare function relatedObjects(experience: ExperienceConfig, id: string): readonly ExperienceObject[];
|
|
19
20
|
/** The sky figure a selected id names, or undefined (object ids and figure ids never collide: the scene checks it). */
|
package/src/shell/objectModel.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { shownAt } from "../app/viewHiding.js";
|
|
1
2
|
import { requestObjectId } from "./experience.js";
|
|
3
|
+
/** Whether the object can be used at `timeUtcMs`: shown by its `shownDuring` span (the one rule, `shownAt`) and inside its `availability`. */
|
|
2
4
|
export function isObjectAvailable(object, timeUtcMs) {
|
|
3
5
|
const bounds = object.availability;
|
|
4
|
-
return bounds === undefined || (timeUtcMs >= bounds.startUtcMs && timeUtcMs <= bounds.endUtcMs);
|
|
6
|
+
return shownAt(object, timeUtcMs) && (bounds === undefined || (timeUtcMs >= bounds.startUtcMs && timeUtcMs <= bounds.endUtcMs));
|
|
5
7
|
}
|
|
6
8
|
export function availableObjectById(experience, id, timeUtcMs) {
|
|
7
9
|
const object = experience.objects.find((candidate) => candidate.id === id);
|
|
@@ -25,9 +27,9 @@ export function findCameraPreset(experience, mode, target) {
|
|
|
25
27
|
return request.kind === mode && requestObjectId(request) === target;
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
|
-
/** The objects the Object list offers: the listed ones, and the selected one even when unlisted so the list never shows a blank. */
|
|
29
|
-
export function listedObjects(experience, selectedId) {
|
|
30
|
-
return experience.objects.filter((object) => object.listed !== false || object
|
|
30
|
+
/** The objects the Object list offers: the listed ones shown at `timeUtcMs` (an object outside its `shownDuring` span is absent), and the selected one even when unlisted so the list never shows a blank. */
|
|
31
|
+
export function listedObjects(experience, selectedId, timeUtcMs) {
|
|
32
|
+
return experience.objects.filter((object) => object.id === selectedId || (object.listed !== false && (timeUtcMs === undefined || shownAt(object, timeUtcMs))));
|
|
31
33
|
}
|
|
32
34
|
/** Unlisted objects that belong to `id` (an orbit line to its body), for the related buttons in the top bar. */
|
|
33
35
|
export function relatedObjects(experience, id) {
|