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,8 +1,10 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
-
import { CrossingTracker } from "./storyPanels.js";
|
|
2
|
+
import { CrossingTracker, panelArmedAt, panelSpanPassed } from "./storyPanels.js";
|
|
3
3
|
/**
|
|
4
4
|
* Which story panel is open and whether playback is held for it. A panel opens by itself only when forward playback
|
|
5
5
|
* carries the clock across its time; a seek (slider, Previous, Next, a link) re-bases the crossing check and opens nothing.
|
|
6
|
+
* An open moment panel closes by itself on the first forward-playing tick after it opened whose clock ends at or past its time plus its span (`closeAfterSeconds`), if it opened while the clock was before that moment
|
|
7
|
+
* (a panel opened at or past it stays open until closed); a seek, rewind or pause never closes it.
|
|
6
8
|
* Only one panel is open at a time: the newest replaces the one before. A step never opens from playback; with steps and no moment panel the first step is open at the start.
|
|
7
9
|
*/
|
|
8
10
|
export function useStoryPanels(panels, steps, settings, snapshot, setPlaying) {
|
|
@@ -10,14 +12,24 @@ export function useStoryPanels(panels, steps, settings, snapshot, setPlaying) {
|
|
|
10
12
|
const cause = useRef("visitor");
|
|
11
13
|
const [holding, setHolding] = useState(false);
|
|
12
14
|
const tracker = useRef(new CrossingTracker(snapshot.timeUtcMs));
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
/** The panel the close applies to: the one that opened while the clock was before its close moment (null: none open, or one opened at or past it). */
|
|
16
|
+
const armedId = useRef(null);
|
|
17
|
+
const latest = useRef({ panels, settings, snapshot, setPlaying, holding, openId });
|
|
18
|
+
latest.current = { panels, settings, snapshot, setPlaying, holding, openId };
|
|
15
19
|
useEffect(() => {
|
|
16
|
-
const { panels: list, settings: now, snapshot: shot, setPlaying: control } = latest.current;
|
|
20
|
+
const { panels: list, settings: now, snapshot: shot, setPlaying: control, openId: shownId } = latest.current;
|
|
21
|
+
const shown = list.find((panel) => panel.id === shownId);
|
|
22
|
+
const spanPassed = shown !== undefined && armedId.current === shown.id && panelSpanPassed(shown, now.closeAfterSeconds, tracker.current.previousMs, shot.timeUtcMs, shot.playing || tracker.current.wasPlaying);
|
|
17
23
|
const newest = tracker.current.advance(list, shot.timeUtcMs, shot.playing, now.autoOpen);
|
|
18
|
-
if (newest === null)
|
|
24
|
+
if (newest === null) {
|
|
25
|
+
if (spanPassed) {
|
|
26
|
+
cause.current = "playback";
|
|
27
|
+
setOpenId(null);
|
|
28
|
+
}
|
|
19
29
|
return;
|
|
30
|
+
}
|
|
20
31
|
cause.current = "playback";
|
|
32
|
+
armedId.current = newest.id;
|
|
21
33
|
setOpenId(newest.id);
|
|
22
34
|
if (now.pauseSeconds > 0 && control !== undefined) {
|
|
23
35
|
control(false);
|
|
@@ -40,9 +52,18 @@ export function useStoryPanels(panels, steps, settings, snapshot, setPlaying) {
|
|
|
40
52
|
}, [holding, openId, settings.pauseSeconds]);
|
|
41
53
|
const noteSeek = useCallback((timeUtcMs) => {
|
|
42
54
|
tracker.current.rebase(timeUtcMs);
|
|
55
|
+
const { panels: list, settings: now, openId: shownId } = latest.current;
|
|
56
|
+
const shown = list.find((panel) => panel.id === shownId);
|
|
57
|
+
armedId.current = shown !== undefined && panelArmedAt(shown, now.closeAfterSeconds, timeUtcMs) ? shown.id : null;
|
|
43
58
|
setHolding(false);
|
|
44
59
|
}, []);
|
|
45
|
-
const open = useCallback((id, by = "visitor") => {
|
|
60
|
+
const open = useCallback((id, by = "visitor") => {
|
|
61
|
+
const { panels: list, settings: now } = latest.current;
|
|
62
|
+
const target = list.find((panel) => panel.id === id);
|
|
63
|
+
armedId.current = target !== undefined && panelArmedAt(target, now.closeAfterSeconds, tracker.current.timeUtcMs) ? id : null;
|
|
64
|
+
cause.current = by;
|
|
65
|
+
setOpenId(id);
|
|
66
|
+
}, []);
|
|
46
67
|
const close = useCallback((by = "visitor") => {
|
|
47
68
|
cause.current = by;
|
|
48
69
|
setOpenId(null);
|