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
package/src/app/App.js
CHANGED
|
@@ -36,6 +36,7 @@ import { displaySwitchItems, hostReachable, orbitStart, skyLineStart } from "./d
|
|
|
36
36
|
import { TRACE_FADE_SECONDS } from "../core/skyTrace.js";
|
|
37
37
|
import { aimAtFigure, DEFAULT_SKY_LINES, prefersReducedMotion, skyColoursOf, skyFadeInSecondsOf } from "./skyFigures.js";
|
|
38
38
|
import { labelStyleOf } from "./labelStyle.js";
|
|
39
|
+
import { timeLookOf } from "./timeLook.js";
|
|
39
40
|
import { experienceInView, hiddenByView, hiddenWithShownSpans, viewById } from "./viewHiding.js";
|
|
40
41
|
import { cameraIdsOf } from "../core/storyPanels.js";
|
|
41
42
|
import { baseGlowOf, glowLookOf, markerSettingsOf } from "./bodyDraw.js";
|
|
@@ -104,6 +105,10 @@ function startViewUp(definition, search) {
|
|
|
104
105
|
function storyStartOf(storySet) {
|
|
105
106
|
return { autoOpen: storySet?.autoOpen ?? false, pauseSeconds: storySet?.pauseSeconds ?? 0 };
|
|
106
107
|
}
|
|
108
|
+
/** The story-panel settings in force: the two the Developer drawer changes live, and the close span the scene set. */
|
|
109
|
+
function liveStorySettings(storySet, autoOpen, pauseSeconds) {
|
|
110
|
+
return { autoOpen, pauseSeconds, ...(storySet?.closeAfterSeconds === undefined ? {} : { closeAfterSeconds: storySet.closeAfterSeconds }) };
|
|
111
|
+
}
|
|
107
112
|
/** Everything one mounted experience shares: clock, resolver, catalogue and the settings read from its definition and the address. */
|
|
108
113
|
function buildRuntime(definition, search) {
|
|
109
114
|
const adapter = createOrbAstronomyAdapter();
|
|
@@ -177,6 +182,8 @@ function initialSceneControls(definition, runtime, experience, startScale, glowB
|
|
|
177
182
|
skyTraces: [],
|
|
178
183
|
skyFadeInSeconds: skyFadeInSecondsOf(runtime.look),
|
|
179
184
|
labelStyle: labelStyleOf(runtime.look),
|
|
185
|
+
timeLook: timeLookOf(runtime.look),
|
|
186
|
+
sheetMaxPercent: runtime.look.sheetMaxPercent ?? DEFAULT_PHONE_LAYOUT.sheetMaxPercent,
|
|
180
187
|
skyVisible: runtime.sky.visible,
|
|
181
188
|
bodyMarker: markerSettingsOf(runtime.look),
|
|
182
189
|
...(glowBase === null ? {} : { glowLook: glowLookOf(runtime.look, glowBase) }),
|
|
@@ -262,11 +269,15 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
|
|
|
262
269
|
const [scale, setScale] = useState(startScale);
|
|
263
270
|
const [developerMode, setDeveloperMode] = useState(false);
|
|
264
271
|
const [timelineGlow, setTimelineGlow] = useState(DEFAULT_TIMELINE_GLOW);
|
|
265
|
-
const [
|
|
272
|
+
const [phoneLayoutOwn, setPhoneLayout] = useState(DEFAULT_PHONE_LAYOUT);
|
|
273
|
+
// The sheet cap is a look: the live controls hold it, so `setLook`, the handle's `look` and the Developer slider are one value (STYLE-07).
|
|
274
|
+
const [sheetShown, setSheetShown] = useState(controls.current.sheetMaxPercent);
|
|
275
|
+
const phoneLayout = { ...phoneLayoutOwn, sheetMaxPercent: sheetShown };
|
|
266
276
|
const [anchorLabels, setAnchorLabels] = useState(controls.current.showAnchorLabels);
|
|
267
277
|
const [skyLinesShown, setSkyLinesShown] = useState(controls.current.skyLines);
|
|
268
278
|
const [skyColoursShown, setSkyColoursShown] = useState(controls.current.skyColours);
|
|
269
279
|
const [labelStyleShown, setLabelStyleShown] = useState(controls.current.labelStyle);
|
|
280
|
+
const [timeLookShown, setTimeLookShown] = useState(controls.current.timeLook);
|
|
270
281
|
const [glowShown, setGlowShown] = useState(copyOfGlow(controls.current.glowLook));
|
|
271
282
|
const orbitPaths = orbitPathsOf(runtime);
|
|
272
283
|
const orbitDefault = useMemo(() => resolveOrbitLook(orbitPaths[0]?.look), [orbitPaths]);
|
|
@@ -335,7 +346,7 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
|
|
|
335
346
|
holdCamera();
|
|
336
347
|
}, [experience, holdCamera]);
|
|
337
348
|
const requestPanel = useCallback((id) => setPanelRequest((previous) => ({ id, serial: (previous?.serial ?? 0) + 1 })), []);
|
|
338
|
-
const requestPick = useCallback((id) => setPickRequest((previous) => ({ id, serial: (previous?.serial ?? 0) + 1 })), []);
|
|
349
|
+
const requestPick = useCallback((id, options) => setPickRequest((previous) => ({ id, serial: (previous?.serial ?? 0) + 1, ...(options?.keepSky === true ? { keepSky: true } : {}) })), []);
|
|
339
350
|
const requestFeature = useCallback((key) => setFeatureRequest((previous) => ({ key, serial: (previous?.serial ?? 0) + 1 })), []);
|
|
340
351
|
const markOpenFeature = useCallback((key) => { controls.current.openFeatureKey = key; }, []);
|
|
341
352
|
const setPlaying = useCallback((playing) => {
|
|
@@ -590,6 +601,8 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
|
|
|
590
601
|
setLoadFade(read.loadFadeSeconds);
|
|
591
602
|
setSkyColoursShown(controls.current.skyColours);
|
|
592
603
|
setLabelStyleShown(controls.current.labelStyle);
|
|
604
|
+
setTimeLookShown(controls.current.timeLook);
|
|
605
|
+
setSheetShown(read.sheetMaxPercent);
|
|
593
606
|
},
|
|
594
607
|
setScale: updateScale,
|
|
595
608
|
items: () => displaySwitchItems({ ...bindingsNow(), settings: hostReachable(definition.displaySwitches) }),
|
|
@@ -604,7 +617,7 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
|
|
|
604
617
|
shownKey.current = key;
|
|
605
618
|
if (changed)
|
|
606
619
|
host?.publish(state, "visitor");
|
|
607
|
-
}, [host, stateNow, scale, skyVisible, starBrightness, milkyWayBrightness, milkyWayOn, glowShown, markerPx, loadFade, orbitShown, setLook, hiddenLabels, anchorLabels, skyLinesShown, skyColoursShown, labelStyleShown]);
|
|
620
|
+
}, [host, stateNow, scale, skyVisible, starBrightness, milkyWayBrightness, milkyWayOn, glowShown, markerPx, loadFade, orbitShown, setLook, hiddenLabels, anchorLabels, skyLinesShown, skyColoursShown, labelStyleShown, timeLookShown, sheetShown]);
|
|
608
621
|
const hasStoryPanels = (storySet?.panels.length ?? 0) > 0;
|
|
609
622
|
const showDisplay = showsDisplayControls(definition, runtime, skyVisible, orbitPaths.length, storyMarkerSpecs.length);
|
|
610
623
|
// Orbit-line sliders: the first four stay in view, the rest sit in a nested "Fine-tune" fold (T-090).
|
|
@@ -666,7 +679,14 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
|
|
|
666
679
|
["timelineDrawerMaxPercent", "Timeline drawer height (% of screen)", "Phone timeline drawer height", "phone-timeline-height-value"],
|
|
667
680
|
["sheetMaxPercent", "Sheet height (% of screen)", "Phone sheet height", "phone-sheet-height-value"],
|
|
668
681
|
["swipeThresholdPx", "Swipe distance (px)", "Phone swipe distance", "phone-swipe-value"],
|
|
669
|
-
].map(([key, label, ariaLabel, testId]) => (_jsx(SettingSlider, { label: label, ariaLabel: ariaLabel, testId: testId, display: String(phoneLayout[key]), min: PHONE_LAYOUT_LIMITS[key].min, max: PHONE_LAYOUT_LIMITS[key].max, step: PHONE_LAYOUT_LIMITS[key].step, value: phoneLayout[key], onChange: (value) =>
|
|
682
|
+
].map(([key, label, ariaLabel, testId]) => (_jsx(SettingSlider, { label: label, ariaLabel: ariaLabel, testId: testId, display: String(phoneLayout[key]), min: PHONE_LAYOUT_LIMITS[key].min, max: PHONE_LAYOUT_LIMITS[key].max, step: PHONE_LAYOUT_LIMITS[key].step, value: phoneLayout[key], onChange: (value) => {
|
|
683
|
+
if (key === "sheetMaxPercent") {
|
|
684
|
+
controls.current.sheetMaxPercent = value;
|
|
685
|
+
setSheetShown(value);
|
|
686
|
+
}
|
|
687
|
+
else
|
|
688
|
+
setPhoneLayout({ ...phoneLayoutOwn, [key]: value });
|
|
689
|
+
} }, key))), _jsx(SettingButtons, { children: _jsx("button", { onClick: () => { setPhoneLayout(DEFAULT_PHONE_LAYOUT); controls.current.sheetMaxPercent = DEFAULT_PHONE_LAYOUT.sheetMaxPercent; setSheetShown(DEFAULT_PHONE_LAYOUT.sheetMaxPercent); }, children: "Reset phone layout" }) })] })),
|
|
670
690
|
},
|
|
671
691
|
{
|
|
672
692
|
id: "under-the-hood", title: "Under the hood",
|
|
@@ -675,7 +695,7 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
|
|
|
675
695
|
];
|
|
676
696
|
const presentGroups = groups.filter((group) => group !== null);
|
|
677
697
|
const drawer = (_jsx(PanelLoadBoundary, { children: _jsx(Suspense, { fallback: _jsx("p", { className: "developer-loading", role: "status", children: "Loading developer tools..." }), children: _jsxs("div", { className: "hud", children: [_jsxs("header", { className: "developer-heading", children: [_jsx("h2", { children: "Developer tools" }), _jsx("p", { children: "Live readouts, controls and diagnostics for this scene." })] }), presentGroups.map((group, index) => (_jsx(Collapsible, { fold: group.id, title: group.title, defaultOpen: index === 0, className: `dev-group${group.className === undefined ? "" : ` ${group.className}`}`, children: group.body }, group.id)))] }) }) }));
|
|
678
|
-
return (_jsx(AstraeusShell, { experience: shellExperience, snapshot: clockSnapshot, paceAuto: runtime.pacing === undefined ? undefined : paceAuto, developerMode: developerMode, labelStyle: labelStyleShown, onDeveloperModeChange: setDeveloperMode, onTogglePlayback: () => {
|
|
698
|
+
return (_jsx(AstraeusShell, { experience: shellExperience, snapshot: clockSnapshot, paceAuto: runtime.pacing === undefined ? undefined : paceAuto, developerMode: developerMode, labelStyle: labelStyleShown, timeLook: timeLookShown, onDeveloperModeChange: setDeveloperMode, onTogglePlayback: () => {
|
|
679
699
|
if (runtime.clock.playing)
|
|
680
700
|
runtime.clock.pause();
|
|
681
701
|
else
|
|
@@ -688,5 +708,5 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
|
|
|
688
708
|
}, onSeek: (timeUtcMs) => {
|
|
689
709
|
seekTo(timeUtcMs);
|
|
690
710
|
host?.publish(stateNow(), "visitor");
|
|
691
|
-
}, onCameraRequest: updateCameraRequest, onTurnToFigure: turnToFigure, onCameraHold: holdCamera, onTimeShown: holdCameraOffShown, hostCameraSet: hostCameraSet, storySeekNote: storySeekNote, onSelectionChange: updateSelectedObject, scaleId: scale, onScaleChange: updateScale, scaleChoices: scaleChoices, switcher: definition.picker === undefined ? undefined : pickerSwitch(definition.picker, hostPick ?? definition.picker.value, choosePick), displaySwitches: displaySwitches, viewChoice: viewChoice, viewCamera: currentView === undefined ? undefined : { id: currentView.id, rule: currentView.camera }, metricsFor: metricsFor, developerTools: drawerWhen(developerTools, drawer), storyPanelSettings:
|
|
711
|
+
}, onCameraRequest: updateCameraRequest, onTurnToFigure: turnToFigure, onCameraHold: holdCamera, onTimeShown: holdCameraOffShown, hostCameraSet: hostCameraSet, storySeekNote: storySeekNote, onSelectionChange: updateSelectedObject, scaleId: scale, onScaleChange: updateScale, scaleChoices: scaleChoices, switcher: definition.picker === undefined ? undefined : pickerSwitch(definition.picker, hostPick ?? definition.picker.value, choosePick), displaySwitches: displaySwitches, viewChoice: viewChoice, viewCamera: currentView === undefined ? undefined : { id: currentView.id, rule: currentView.camera }, metricsFor: metricsFor, developerTools: drawerWhen(developerTools, drawer), storyPanelSettings: liveStorySettings(storySet, storyAutoOpen, storyPauseSeconds), timelineGlow: timelineGlow, phoneLayout: phoneLayout, highlightedFamily: setLook.highlightFamily, onHighlightFamily: highlightFamily, onSetPlaying: setPlaying, panelRequest: panelRequest, onOpenPanelChange: markOpenPanel, featureRequest: featureRequest, pickRequest: pickRequest, selectRequest: selectRequest, onSelectRequestApplied: hostSelectApplied, onOpenFeatureChange: markOpenFeature, children: _jsx("div", { className: "canvas-host", children: _jsx(AstraeusScene, { runtime: runtime, controls: controls.current, readout: readout, scaleId: scale, onFirstDraw: host === undefined ? undefined : told }) }) }));
|
|
692
712
|
}
|
package/src/app/App.node.js
CHANGED
|
@@ -36,6 +36,7 @@ import { displaySwitchItems, hostReachable, orbitStart, skyLineStart } from "./d
|
|
|
36
36
|
import { TRACE_FADE_SECONDS } from "../core/skyTrace.js";
|
|
37
37
|
import { aimAtFigure, DEFAULT_SKY_LINES, prefersReducedMotion, skyColoursOf, skyFadeInSecondsOf } from "./skyFigures.js";
|
|
38
38
|
import { labelStyleOf } from "./labelStyle.js";
|
|
39
|
+
import { timeLookOf } from "./timeLook.js";
|
|
39
40
|
import { experienceInView, hiddenByView, hiddenWithShownSpans, viewById } from "./viewHiding.js";
|
|
40
41
|
import { cameraIdsOf } from "../core/storyPanels.js";
|
|
41
42
|
import { baseGlowOf, glowLookOf, markerSettingsOf } from "./bodyDraw.js";
|
|
@@ -104,6 +105,10 @@ function startViewUp(definition, search) {
|
|
|
104
105
|
function storyStartOf(storySet) {
|
|
105
106
|
return { autoOpen: storySet?.autoOpen ?? false, pauseSeconds: storySet?.pauseSeconds ?? 0 };
|
|
106
107
|
}
|
|
108
|
+
/** The story-panel settings in force: the two the Developer drawer changes live, and the close span the scene set. */
|
|
109
|
+
function liveStorySettings(storySet, autoOpen, pauseSeconds) {
|
|
110
|
+
return { autoOpen, pauseSeconds, ...(storySet?.closeAfterSeconds === undefined ? {} : { closeAfterSeconds: storySet.closeAfterSeconds }) };
|
|
111
|
+
}
|
|
107
112
|
/** Everything one mounted experience shares: clock, resolver, catalogue and the settings read from its definition and the address. */
|
|
108
113
|
function buildRuntime(definition, search) {
|
|
109
114
|
const adapter = createOrbAstronomyAdapter();
|
|
@@ -177,6 +182,8 @@ function initialSceneControls(definition, runtime, experience, startScale, glowB
|
|
|
177
182
|
skyTraces: [],
|
|
178
183
|
skyFadeInSeconds: skyFadeInSecondsOf(runtime.look),
|
|
179
184
|
labelStyle: labelStyleOf(runtime.look),
|
|
185
|
+
timeLook: timeLookOf(runtime.look),
|
|
186
|
+
sheetMaxPercent: runtime.look.sheetMaxPercent ?? DEFAULT_PHONE_LAYOUT.sheetMaxPercent,
|
|
180
187
|
skyVisible: runtime.sky.visible,
|
|
181
188
|
bodyMarker: markerSettingsOf(runtime.look),
|
|
182
189
|
...(glowBase === null ? {} : { glowLook: glowLookOf(runtime.look, glowBase) }),
|
|
@@ -262,11 +269,15 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
|
|
|
262
269
|
const [scale, setScale] = useState(startScale);
|
|
263
270
|
const [developerMode, setDeveloperMode] = useState(false);
|
|
264
271
|
const [timelineGlow, setTimelineGlow] = useState(DEFAULT_TIMELINE_GLOW);
|
|
265
|
-
const [
|
|
272
|
+
const [phoneLayoutOwn, setPhoneLayout] = useState(DEFAULT_PHONE_LAYOUT);
|
|
273
|
+
// The sheet cap is a look: the live controls hold it, so `setLook`, the handle's `look` and the Developer slider are one value (STYLE-07).
|
|
274
|
+
const [sheetShown, setSheetShown] = useState(controls.current.sheetMaxPercent);
|
|
275
|
+
const phoneLayout = { ...phoneLayoutOwn, sheetMaxPercent: sheetShown };
|
|
266
276
|
const [anchorLabels, setAnchorLabels] = useState(controls.current.showAnchorLabels);
|
|
267
277
|
const [skyLinesShown, setSkyLinesShown] = useState(controls.current.skyLines);
|
|
268
278
|
const [skyColoursShown, setSkyColoursShown] = useState(controls.current.skyColours);
|
|
269
279
|
const [labelStyleShown, setLabelStyleShown] = useState(controls.current.labelStyle);
|
|
280
|
+
const [timeLookShown, setTimeLookShown] = useState(controls.current.timeLook);
|
|
270
281
|
const [glowShown, setGlowShown] = useState(copyOfGlow(controls.current.glowLook));
|
|
271
282
|
const orbitPaths = orbitPathsOf(runtime);
|
|
272
283
|
const orbitDefault = useMemo(() => resolveOrbitLook(orbitPaths[0]?.look), [orbitPaths]);
|
|
@@ -335,7 +346,7 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
|
|
|
335
346
|
holdCamera();
|
|
336
347
|
}, [experience, holdCamera]);
|
|
337
348
|
const requestPanel = useCallback((id) => setPanelRequest((previous) => ({ id, serial: (previous?.serial ?? 0) + 1 })), []);
|
|
338
|
-
const requestPick = useCallback((id) => setPickRequest((previous) => ({ id, serial: (previous?.serial ?? 0) + 1 })), []);
|
|
349
|
+
const requestPick = useCallback((id, options) => setPickRequest((previous) => ({ id, serial: (previous?.serial ?? 0) + 1, ...(options?.keepSky === true ? { keepSky: true } : {}) })), []);
|
|
339
350
|
const requestFeature = useCallback((key) => setFeatureRequest((previous) => ({ key, serial: (previous?.serial ?? 0) + 1 })), []);
|
|
340
351
|
const markOpenFeature = useCallback((key) => { controls.current.openFeatureKey = key; }, []);
|
|
341
352
|
const setPlaying = useCallback((playing) => {
|
|
@@ -590,6 +601,8 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
|
|
|
590
601
|
setLoadFade(read.loadFadeSeconds);
|
|
591
602
|
setSkyColoursShown(controls.current.skyColours);
|
|
592
603
|
setLabelStyleShown(controls.current.labelStyle);
|
|
604
|
+
setTimeLookShown(controls.current.timeLook);
|
|
605
|
+
setSheetShown(read.sheetMaxPercent);
|
|
593
606
|
},
|
|
594
607
|
setScale: updateScale,
|
|
595
608
|
items: () => displaySwitchItems({ ...bindingsNow(), settings: hostReachable(definition.displaySwitches) }),
|
|
@@ -604,7 +617,7 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
|
|
|
604
617
|
shownKey.current = key;
|
|
605
618
|
if (changed)
|
|
606
619
|
host?.publish(state, "visitor");
|
|
607
|
-
}, [host, stateNow, scale, skyVisible, starBrightness, milkyWayBrightness, milkyWayOn, glowShown, markerPx, loadFade, orbitShown, setLook, hiddenLabels, anchorLabels, skyLinesShown, skyColoursShown, labelStyleShown]);
|
|
620
|
+
}, [host, stateNow, scale, skyVisible, starBrightness, milkyWayBrightness, milkyWayOn, glowShown, markerPx, loadFade, orbitShown, setLook, hiddenLabels, anchorLabels, skyLinesShown, skyColoursShown, labelStyleShown, timeLookShown, sheetShown]);
|
|
608
621
|
const hasStoryPanels = (storySet?.panels.length ?? 0) > 0;
|
|
609
622
|
const showDisplay = showsDisplayControls(definition, runtime, skyVisible, orbitPaths.length, storyMarkerSpecs.length);
|
|
610
623
|
// Orbit-line sliders: the first four stay in view, the rest sit in a nested "Fine-tune" fold (T-090).
|
|
@@ -666,7 +679,14 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
|
|
|
666
679
|
["timelineDrawerMaxPercent", "Timeline drawer height (% of screen)", "Phone timeline drawer height", "phone-timeline-height-value"],
|
|
667
680
|
["sheetMaxPercent", "Sheet height (% of screen)", "Phone sheet height", "phone-sheet-height-value"],
|
|
668
681
|
["swipeThresholdPx", "Swipe distance (px)", "Phone swipe distance", "phone-swipe-value"],
|
|
669
|
-
].map(([key, label, ariaLabel, testId]) => (_jsx(SettingSlider, { label: label, ariaLabel: ariaLabel, testId: testId, display: String(phoneLayout[key]), min: PHONE_LAYOUT_LIMITS[key].min, max: PHONE_LAYOUT_LIMITS[key].max, step: PHONE_LAYOUT_LIMITS[key].step, value: phoneLayout[key], onChange: (value) =>
|
|
682
|
+
].map(([key, label, ariaLabel, testId]) => (_jsx(SettingSlider, { label: label, ariaLabel: ariaLabel, testId: testId, display: String(phoneLayout[key]), min: PHONE_LAYOUT_LIMITS[key].min, max: PHONE_LAYOUT_LIMITS[key].max, step: PHONE_LAYOUT_LIMITS[key].step, value: phoneLayout[key], onChange: (value) => {
|
|
683
|
+
if (key === "sheetMaxPercent") {
|
|
684
|
+
controls.current.sheetMaxPercent = value;
|
|
685
|
+
setSheetShown(value);
|
|
686
|
+
}
|
|
687
|
+
else
|
|
688
|
+
setPhoneLayout({ ...phoneLayoutOwn, [key]: value });
|
|
689
|
+
} }, key))), _jsx(SettingButtons, { children: _jsx("button", { onClick: () => { setPhoneLayout(DEFAULT_PHONE_LAYOUT); controls.current.sheetMaxPercent = DEFAULT_PHONE_LAYOUT.sheetMaxPercent; setSheetShown(DEFAULT_PHONE_LAYOUT.sheetMaxPercent); }, children: "Reset phone layout" }) })] })),
|
|
670
690
|
},
|
|
671
691
|
{
|
|
672
692
|
id: "under-the-hood", title: "Under the hood",
|
|
@@ -675,7 +695,7 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
|
|
|
675
695
|
];
|
|
676
696
|
const presentGroups = groups.filter((group) => group !== null);
|
|
677
697
|
const drawer = (_jsx(PanelLoadBoundary, { children: _jsx(Suspense, { fallback: _jsx("p", { className: "developer-loading", role: "status", children: "Loading developer tools..." }), children: _jsxs("div", { className: "hud", children: [_jsxs("header", { className: "developer-heading", children: [_jsx("h2", { children: "Developer tools" }), _jsx("p", { children: "Live readouts, controls and diagnostics for this scene." })] }), presentGroups.map((group, index) => (_jsx(Collapsible, { fold: group.id, title: group.title, defaultOpen: index === 0, className: `dev-group${group.className === undefined ? "" : ` ${group.className}`}`, children: group.body }, group.id)))] }) }) }));
|
|
678
|
-
return (_jsx(AstraeusShell, { experience: shellExperience, snapshot: clockSnapshot, paceAuto: runtime.pacing === undefined ? undefined : paceAuto, developerMode: developerMode, labelStyle: labelStyleShown, onDeveloperModeChange: setDeveloperMode, onTogglePlayback: () => {
|
|
698
|
+
return (_jsx(AstraeusShell, { experience: shellExperience, snapshot: clockSnapshot, paceAuto: runtime.pacing === undefined ? undefined : paceAuto, developerMode: developerMode, labelStyle: labelStyleShown, timeLook: timeLookShown, onDeveloperModeChange: setDeveloperMode, onTogglePlayback: () => {
|
|
679
699
|
if (runtime.clock.playing)
|
|
680
700
|
runtime.clock.pause();
|
|
681
701
|
else
|
|
@@ -688,5 +708,5 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
|
|
|
688
708
|
}, onSeek: (timeUtcMs) => {
|
|
689
709
|
seekTo(timeUtcMs);
|
|
690
710
|
host?.publish(stateNow(), "visitor");
|
|
691
|
-
}, onCameraRequest: updateCameraRequest, onTurnToFigure: turnToFigure, onCameraHold: holdCamera, onTimeShown: holdCameraOffShown, hostCameraSet: hostCameraSet, storySeekNote: storySeekNote, onSelectionChange: updateSelectedObject, scaleId: scale, onScaleChange: updateScale, scaleChoices: scaleChoices, switcher: definition.picker === undefined ? undefined : pickerSwitch(definition.picker, hostPick ?? definition.picker.value, choosePick), displaySwitches: displaySwitches, viewChoice: viewChoice, viewCamera: currentView === undefined ? undefined : { id: currentView.id, rule: currentView.camera }, metricsFor: metricsFor, developerTools: drawerWhen(developerTools, drawer), storyPanelSettings:
|
|
711
|
+
}, onCameraRequest: updateCameraRequest, onTurnToFigure: turnToFigure, onCameraHold: holdCamera, onTimeShown: holdCameraOffShown, hostCameraSet: hostCameraSet, storySeekNote: storySeekNote, onSelectionChange: updateSelectedObject, scaleId: scale, onScaleChange: updateScale, scaleChoices: scaleChoices, switcher: definition.picker === undefined ? undefined : pickerSwitch(definition.picker, hostPick ?? definition.picker.value, choosePick), displaySwitches: displaySwitches, viewChoice: viewChoice, viewCamera: currentView === undefined ? undefined : { id: currentView.id, rule: currentView.camera }, metricsFor: metricsFor, developerTools: drawerWhen(developerTools, drawer), storyPanelSettings: liveStorySettings(storySet, storyAutoOpen, storyPauseSeconds), timelineGlow: timelineGlow, phoneLayout: phoneLayout, highlightedFamily: setLook.highlightFamily, onHighlightFamily: highlightFamily, onSetPlaying: setPlaying, panelRequest: panelRequest, onOpenPanelChange: markOpenPanel, featureRequest: featureRequest, pickRequest: pickRequest, selectRequest: selectRequest, onSelectRequestApplied: hostSelectApplied, onOpenFeatureChange: markOpenFeature, children: _jsx("div", { className: "canvas-host", children: _jsx(AstraeusScene, { runtime: runtime, controls: controls.current, readout: readout, scaleId: scale, onFirstDraw: host === undefined ? undefined : told }) }) }));
|
|
692
712
|
}
|
|
@@ -19,6 +19,7 @@ import type { FrameStats } from "./frameStats.js";
|
|
|
19
19
|
import type { GroupFill } from "./FrameRateSection.js";
|
|
20
20
|
import { type BodySetLayer, type BodySetLook } from "./bodySet.js";
|
|
21
21
|
import type { LabelStyle } from "./labelStyle.js";
|
|
22
|
+
import type { TimeLook } from "./timeLook.js";
|
|
22
23
|
import type { SkyColours, SkyClearRequest, SkyFigureLayer, SkyLineSwitches, SkyTraceRequest } from "./skyFigures.js";
|
|
23
24
|
import type { RingLook } from "../assets/rings.js";
|
|
24
25
|
import type { Pictures } from "../assets/pictures.js";
|
|
@@ -96,6 +97,10 @@ export interface SceneControls {
|
|
|
96
97
|
skyFadeInSeconds: number;
|
|
97
98
|
/** Presentation only: the label font and size (the look `labels`; live). The viewer root carries it to every label as CSS variables. */
|
|
98
99
|
labelStyle: LabelStyle;
|
|
100
|
+
/** Presentation only: the zone and precision of every visitor-facing time (the look `time`; live). */
|
|
101
|
+
timeLook: TimeLook;
|
|
102
|
+
/** Presentation only: the phone sheet's height cap, percent of the screen (the look `sheetMaxPercent`; live). The Developer drawer's slider and the look are this one value. */
|
|
103
|
+
sheetMaxPercent: number;
|
|
99
104
|
/** Presentation only: when a sphere is too small to see it is drawn as a marker (see `drawsAsMarker`). */
|
|
100
105
|
bodyMarker: BodyMarkerSettings;
|
|
101
106
|
/** Presentation only: the live halo settings of a body whose record has a glow (the Sun). */
|
|
@@ -135,7 +140,9 @@ export interface SceneControls {
|
|
|
135
140
|
/** The story panel now open, so its marker reads as pressed. */
|
|
136
141
|
openStoryPanelId?: string | null;
|
|
137
142
|
/** Called with an object's id when a tap or click lands on a body, a body-set member or a shown name. The shell flies to it like its picker does. */
|
|
138
|
-
onPickObject?: (id: string
|
|
143
|
+
onPickObject?: (id: string, options?: {
|
|
144
|
+
readonly keepSky?: boolean;
|
|
145
|
+
}) => void;
|
|
139
146
|
/** Tagged places on bodies (a body package's features); each gets a marker drawn on its body that opens the place's information. */
|
|
140
147
|
readonly featureMarkers?: readonly FeatureMarkerSpec[];
|
|
141
148
|
/** Called with the place's key when a feature marker is pressed. */
|
|
@@ -51,6 +51,8 @@ export interface OrbitCameraState {
|
|
|
51
51
|
transition: [number, number, number];
|
|
52
52
|
/** Set while the camera stands inside `focus` looking out: the field of view, with azimuth and elevation as the look direction. Null is the orbit camera. */
|
|
53
53
|
lookOut: LookOutState | null;
|
|
54
|
+
/** A look-out field of view the camera is easing toward; null when none is pending (a visitor's zoom clears it). */
|
|
55
|
+
targetFovDeg: number | null;
|
|
54
56
|
/** Scaled absolute camera/target positions (Float64, render axes) for the latest frame. */
|
|
55
57
|
cameraAbsolute: [number, number, number];
|
|
56
58
|
targetAbsolute: [number, number, number];
|
|
@@ -14,6 +14,7 @@ export function createOrbitCameraState(distance, focus) {
|
|
|
14
14
|
fixedPoint: null,
|
|
15
15
|
transition: [0, 0, 0],
|
|
16
16
|
lookOut: null,
|
|
17
|
+
targetFovDeg: null,
|
|
17
18
|
cameraAbsolute: [0, 0, 0],
|
|
18
19
|
targetAbsolute: [0, 0, 0],
|
|
19
20
|
};
|
|
@@ -110,8 +111,10 @@ export function attachOrbitGestures(element, state, getLimits, onTap) {
|
|
|
110
111
|
}
|
|
111
112
|
/** A wheel or pinch step: the distance in orbit, the field of view while looking out. */
|
|
112
113
|
function zoomBy(state, factor, limits) {
|
|
113
|
-
if (state.lookOut !== null)
|
|
114
|
+
if (state.lookOut !== null) {
|
|
115
|
+
state.targetFovDeg = null;
|
|
114
116
|
zoomLookOut(state.lookOut, factor);
|
|
117
|
+
}
|
|
115
118
|
else
|
|
116
119
|
state.distance = clampDistance(state.distance * factor, limits);
|
|
117
120
|
cancelCameraTransition(state);
|
|
@@ -151,6 +154,13 @@ export function resolveCamera(state, focusAbsolute, origin, deltaSeconds, rebase
|
|
|
151
154
|
state.distance = state.targetDistance;
|
|
152
155
|
state.azimuth += shortestAngleDelta(state.azimuth, state.targetAzimuth) * blend;
|
|
153
156
|
state.elevation += (state.targetElevation - state.elevation) * blend;
|
|
157
|
+
if (state.lookOut !== null && state.targetFovDeg !== null) {
|
|
158
|
+
state.lookOut.fovDeg += (state.targetFovDeg - state.lookOut.fovDeg) * blend;
|
|
159
|
+
if (Math.abs(state.targetFovDeg - state.lookOut.fovDeg) < 1e-6) {
|
|
160
|
+
state.lookOut.fovDeg = state.targetFovDeg;
|
|
161
|
+
state.targetFovDeg = null;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
154
164
|
for (let i = 0; i < 3; i += 1) {
|
|
155
165
|
state.transition[i] *= decay;
|
|
156
166
|
if (Math.abs(state.transition[i]) < 1e-9)
|
|
@@ -36,8 +36,8 @@ export declare class SkyFiguresView {
|
|
|
36
36
|
}): readonly SkyPickFigure[];
|
|
37
37
|
/** Begins tracing the figure `request.id` (a trace already on it restarts). The trace is a separate set of lines drawn over the figure (the whole drawing of a figure shown only when traced); the figure itself is untouched. An id the view does not hold does nothing. */
|
|
38
38
|
startTrace(request: SkyTraceRequest): void;
|
|
39
|
-
/** Removes the trace of `request.id` over `request.seconds` (at once for 0 or reduced motion), keeping what it had drawn; a figure with no trace, or an id the view does not hold, is left alone. */
|
|
40
|
-
clearTrace(request: SkyClearRequest):
|
|
39
|
+
/** Removes the trace of `request.id` over `request.seconds` (at once for 0 or reduced motion), keeping what it had drawn; a figure with no trace, or an id the view does not hold, is left alone. Returns true when it removed the trace at once, so the caller wakes the draw rule (a timed clear wakes through `advanceTraces`). */
|
|
40
|
+
clearTrace(request: SkyClearRequest): boolean;
|
|
41
41
|
/**
|
|
42
42
|
* Moves every trace on by `deltaSeconds` of real time (the scene clock never enters): draws the segments reached so far, the last one part-grown from its first end, in the traced colour (the faded colour while fading),
|
|
43
43
|
* shows each with its figure's switch, and removes finished ones. Returns true while anything changed, so the caller wakes the draw rule.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BufferAttribute, BufferGeometry, Color, Group, LineBasicMaterial, LineSegments, Vector3 } from "three";
|
|
2
2
|
import { celestialEquatorSegments, eclipticSegments } from "./skyFigures.js";
|
|
3
|
+
import { splitColourAlpha } from "../core/lookValues.js";
|
|
3
4
|
import { stepFadeIn, stepHide, stepTrace } from "../core/skyTrace.js";
|
|
4
5
|
import { eqjToRenderVector } from "./renderCoordinates.js";
|
|
5
6
|
import { TRACK_LAYER } from "./TrackedBodyView.js";
|
|
@@ -10,6 +11,12 @@ const TRACE_OPACITY = 0.85;
|
|
|
10
11
|
const TRACE_LABEL_IN_SHARE = 0.5;
|
|
11
12
|
/** The opacity of an always-shown line once it has faded in. */
|
|
12
13
|
const LINE_OPACITY = 0.85;
|
|
14
|
+
/** Paints a material in a CSS colour's opaque part and returns the colour's alpha for the caller to multiply into the opacity. */
|
|
15
|
+
function paint(material, colour) {
|
|
16
|
+
const { colour: opaque, alpha } = splitColourAlpha(colour);
|
|
17
|
+
material.color.set(opaque);
|
|
18
|
+
return alpha;
|
|
19
|
+
}
|
|
13
20
|
function lines(segments, color, key) {
|
|
14
21
|
const positions = new Float32Array(segments.length * 6);
|
|
15
22
|
segments.forEach(([from, to], i) => positions.set([...eqjToRenderVector(from), ...eqjToRenderVector(to)], i * 6));
|
|
@@ -17,8 +24,9 @@ function lines(segments, color, key) {
|
|
|
17
24
|
geometry.setAttribute("position", new BufferAttribute(positions, 3));
|
|
18
25
|
// Depth is tested (a body in front of the sky hides the line) but never written. The lines are on the last render pass (TRACK_LAYER), after every body's pass, so the Sun's halo
|
|
19
26
|
// (drawn earlier, without depth) never covers them (owner decision 3, O-065).
|
|
20
|
-
const material = new LineBasicMaterial({
|
|
27
|
+
const material = new LineBasicMaterial({ transparent: true, opacity: LINE_OPACITY, depthTest: true, depthWrite: false });
|
|
21
28
|
const object = new LineSegments(geometry, material);
|
|
29
|
+
object.userData.alpha = paint(material, color);
|
|
22
30
|
object.name = key;
|
|
23
31
|
object.layers.set(TRACK_LAYER);
|
|
24
32
|
object.frustumCulled = false;
|
|
@@ -47,7 +55,7 @@ export class SkyFiguresView {
|
|
|
47
55
|
if (segments.length === 0)
|
|
48
56
|
return;
|
|
49
57
|
const object = lines(segments, own ?? "#ffffff", key);
|
|
50
|
-
this.#drawn.push({ object, shows, colour, own: own !== undefined });
|
|
58
|
+
this.#drawn.push({ object, shows, colour, own: own !== undefined, alpha: object.userData.alpha });
|
|
51
59
|
this.group.add(object);
|
|
52
60
|
};
|
|
53
61
|
// Figures that take the look's colour share one set of lines per kind; a figure with its own colour is drawn on its own so a live look change leaves it alone.
|
|
@@ -71,7 +79,7 @@ export class SkyFiguresView {
|
|
|
71
79
|
for (const [shows, colour, make, key] of [["ecliptic", "ecliptic", eclipticSegments, "sky-ecliptic"], ["celestialEquator", "equator", celestialEquatorSegments, "sky-celestial-equator"]]) {
|
|
72
80
|
if (on[shows] && !this.#drawn.some((entry) => entry.shows === shows)) {
|
|
73
81
|
const object = lines(make(), "#ffffff", key);
|
|
74
|
-
this.#drawn.push({ object, shows, colour, own: false });
|
|
82
|
+
this.#drawn.push({ object, shows, colour, own: false, alpha: 1 });
|
|
75
83
|
this.group.add(object);
|
|
76
84
|
this.#applied = null;
|
|
77
85
|
}
|
|
@@ -79,7 +87,7 @@ export class SkyFiguresView {
|
|
|
79
87
|
if (this.#applied === null || Object.keys(colours).some((name) => colours[name] !== this.#applied[name])) {
|
|
80
88
|
for (const entry of this.#drawn)
|
|
81
89
|
if (!entry.own)
|
|
82
|
-
entry.object.material
|
|
90
|
+
entry.alpha = paint(entry.object.material, colours[entry.colour]);
|
|
83
91
|
this.#applied = { ...colours };
|
|
84
92
|
}
|
|
85
93
|
for (const entry of this.#drawn)
|
|
@@ -113,8 +121,7 @@ export class SkyFiguresView {
|
|
|
113
121
|
this.#selected = { id: layer.id, object };
|
|
114
122
|
}
|
|
115
123
|
const material = this.#selected.object.material;
|
|
116
|
-
material.
|
|
117
|
-
material.opacity = LINE_OPACITY * (layer.whenTraced === true ? 1 : this.#shownShare[layer.kind === "figure" ? "figures" : "boundaries"]);
|
|
124
|
+
material.opacity = paint(material, colours.selected) * LINE_OPACITY * (layer.whenTraced === true ? 1 : this.#shownShare[layer.kind === "figure" ? "figures" : "boundaries"]);
|
|
118
125
|
// While the figure's trace is still drawing, the trace itself grows in the selected colour (`advanceTraces`) and the whole-figure emphasis waits, so it never covers the growing line (owner, T-306).
|
|
119
126
|
this.#selected.object.visible = this.#tappable(layer, on) && !this.#drawing(layer.id);
|
|
120
127
|
}
|
|
@@ -147,15 +154,17 @@ export class SkyFiguresView {
|
|
|
147
154
|
this.group.add(object);
|
|
148
155
|
this.#traces.set(request.id, { object, full, kind: layer.kind, run: { seconds: request.seconds, after: request.after, reduced: request.reduced, elapsed: 0 }, drawn: 0, fade: 0 });
|
|
149
156
|
}
|
|
150
|
-
/** Removes the trace of `request.id` over `request.seconds` (at once for 0 or reduced motion), keeping what it had drawn; a figure with no trace, or an id the view does not hold, is left alone. */
|
|
157
|
+
/** Removes the trace of `request.id` over `request.seconds` (at once for 0 or reduced motion), keeping what it had drawn; a figure with no trace, or an id the view does not hold, is left alone. Returns true when it removed the trace at once, so the caller wakes the draw rule (a timed clear wakes through `advanceTraces`). */
|
|
151
158
|
clearTrace(request) {
|
|
152
159
|
const trace = this.#traces.get(request.id);
|
|
153
160
|
if (trace === undefined)
|
|
154
|
-
return;
|
|
155
|
-
if (request.reduced || request.seconds <= 0)
|
|
161
|
+
return false;
|
|
162
|
+
if (request.reduced || request.seconds <= 0) {
|
|
156
163
|
this.#removeTrace(request.id);
|
|
157
|
-
|
|
158
|
-
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
trace.hide = { seconds: request.seconds, from: trace.fade, elapsed: 0 };
|
|
167
|
+
return false;
|
|
159
168
|
}
|
|
160
169
|
/**
|
|
161
170
|
* Moves every trace on by `deltaSeconds` of real time (the scene clock never enters): draws the segments reached so far, the last one part-grown from its first end, in the traced colour (the faded colour while fading),
|
|
@@ -185,8 +194,10 @@ export class SkyFiguresView {
|
|
|
185
194
|
positions.needsUpdate = true;
|
|
186
195
|
trace.object.geometry.setDrawRange(0, (last + 1) * 2);
|
|
187
196
|
const material = trace.object.material;
|
|
188
|
-
|
|
189
|
-
|
|
197
|
+
const base = splitColourAlpha(id === selectedId && frame.drawn < 1 && trace.hide === undefined ? colours.selected : colours.traced);
|
|
198
|
+
const faded = splitColourAlpha(colours.faded);
|
|
199
|
+
material.color.set(base.colour).lerp(FADED.set(faded.colour), frame.fade);
|
|
200
|
+
material.opacity = TRACE_OPACITY * (1 - frame.fade) * (base.alpha + (faded.alpha - base.alpha) * frame.fade);
|
|
190
201
|
trace.object.visible = on[trace.kind === "figure" ? "figures" : "boundaries"];
|
|
191
202
|
}
|
|
192
203
|
return moving;
|
|
@@ -205,7 +216,7 @@ export class SkyFiguresView {
|
|
|
205
216
|
moving = true;
|
|
206
217
|
}
|
|
207
218
|
for (const entry of this.#drawn)
|
|
208
|
-
entry.object.material.opacity = LINE_OPACITY * this.#shownShare[entry.shows];
|
|
219
|
+
entry.object.material.opacity = LINE_OPACITY * entry.alpha * this.#shownShare[entry.shows];
|
|
209
220
|
return moving;
|
|
210
221
|
}
|
|
211
222
|
/** How much of a label shows, 0 to 1: for a figure that is always shown, how far its kind has faded in; for one shown only when traced, 0 until a trace starts, then rising with the trace to 1 at half drawn (fading to 0 with a `fade` trace; 0 again once the trace is removed). */
|
|
@@ -14,6 +14,8 @@ export type DisplaySwitchPlace = (typeof DISPLAY_SWITCH_PLACES)[number];
|
|
|
14
14
|
export interface DisplaySwitchSetting {
|
|
15
15
|
readonly place: DisplaySwitchPlace;
|
|
16
16
|
readonly on?: boolean;
|
|
17
|
+
/** The switch's own name in the top bar and the switch panel; absent: the built-in one. */
|
|
18
|
+
readonly label?: string;
|
|
17
19
|
}
|
|
18
20
|
export type DisplaySwitchSettings = Readonly<Partial<Record<DisplaySwitchId, DisplaySwitchSetting>>>;
|
|
19
21
|
export declare const DISPLAY_SWITCH_LABELS: Readonly<Record<DisplaySwitchId, string>>;
|
|
@@ -57,7 +57,7 @@ export function displaySwitchItems(bindings) {
|
|
|
57
57
|
const place = settings[id]?.place;
|
|
58
58
|
if ((place !== "top-bar" && place !== "panel") || !state[id].applies)
|
|
59
59
|
return [];
|
|
60
|
-
return [{ id, label: DISPLAY_SWITCH_LABELS[id], place, on: state[id].on, onToggle: state[id].toggle }];
|
|
60
|
+
return [{ id, label: settings[id]?.label ?? DISPLAY_SWITCH_LABELS[id], place, on: state[id].on, onToggle: state[id].toggle }];
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
/** The settings with every placed switch counted as shown: a host reads and sets a switch placed only in the Developer drawer too. */
|
package/src/app/liveLook.d.ts
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
* (the one place the Developer drawer, the host's `setLook` and the page address all end up), every one filled in; `applyLook` replaces the whole look. Presentation only (ARCH-02).
|
|
4
4
|
*/
|
|
5
5
|
import type { LookInput, LookRead } from "../api/look.js";
|
|
6
|
+
import type { BodyAsset } from "../assets/catalogue.js";
|
|
6
7
|
import type { SceneControls } from "./AstraeusScene.js";
|
|
7
8
|
import { type GlowLook } from "./bodyDraw.js";
|
|
8
9
|
import type { ExperienceDefinition } from "./experienceDefinition.js";
|
|
9
10
|
import type { DisplaySwitchItem } from "../shell/DisplaySwitches.js";
|
|
10
11
|
/** The sky settings in force: the experience's own, then the look (the scene's `setLook`, with the address over it). The Milky Way switch's start sits between the two. */
|
|
11
|
-
export declare function skySettingsOf(definition: ExperienceDefinition, look: LookInput): {
|
|
12
|
+
export declare function skySettingsOf(definition: Pick<ExperienceDefinition, "sky" | "displaySwitches">, look: LookInput): {
|
|
12
13
|
milkyWay: boolean;
|
|
13
14
|
starBrightness: number;
|
|
14
15
|
milkyWayBrightness: number;
|
|
@@ -19,6 +20,8 @@ export declare function skySettingsOf(definition: ExperienceDefinition, look: Lo
|
|
|
19
20
|
export declare function desktopPicturesOf(definition: Pick<ExperienceDefinition, "desktopTextures">, look: LookInput): boolean;
|
|
20
21
|
/** The looks the scene's live controls hold now, every one filled in. */
|
|
21
22
|
export declare function lookReadOf(controls: SceneControls): LookRead;
|
|
23
|
+
/** The looks a fresh viewer opens with, every one filled in, from the resolved look alone (no browser, no controls): the same resolvers `initialSceneControls` uses. `bodies` are the scene's mounted bodies, whose first halo (the Sun's) sets `sunGlow`. */
|
|
24
|
+
export declare function lookReadFrom(look: LookInput, definition: Pick<ExperienceDefinition, "sky" | "displaySwitches">, bodies: readonly BodyAsset[]): LookRead;
|
|
22
25
|
/**
|
|
23
26
|
* Replaces the whole look in the live controls with `input` (a look not named takes its default) and returns the looks now in force. The one resolver (`resolveLook`) takes it with no page address:
|
|
24
27
|
* a host's live set wins over the address, which only starts the viewer.
|
package/src/app/liveLook.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { DEFAULT_PHONE_LAYOUT } from "../shell/phoneLayout.js";
|
|
1
2
|
import { bootFadeSeconds } from "../shell/bootLoader.js";
|
|
2
|
-
import { glowLookOf, markerSettingsOf } from "./bodyDraw.js";
|
|
3
|
+
import { baseGlowOf, glowLookOf, markerSettingsOf } from "./bodyDraw.js";
|
|
3
4
|
import { featureMinBodyPxOf } from "./FeatureMarkers.js";
|
|
4
5
|
import { resolveLook } from "./look.js";
|
|
5
6
|
import { resolveSkySettings } from "./skyModel.js";
|
|
6
7
|
import { labelStyleOf } from "./labelStyle.js";
|
|
8
|
+
import { timeLookOf } from "./timeLook.js";
|
|
7
9
|
import { skyColoursOf, skyFadeInSecondsOf } from "./skyFigures.js";
|
|
8
10
|
/** The sky settings in force: the experience's own, then the look (the scene's `setLook`, with the address over it). The Milky Way switch's start sits between the two. */
|
|
9
11
|
export function skySettingsOf(definition, look) {
|
|
@@ -36,6 +38,30 @@ export function lookReadOf(controls) {
|
|
|
36
38
|
desktopPictures: controls.desktopPictures,
|
|
37
39
|
skyLines: { ...controls.skyColours },
|
|
38
40
|
labels: { ...controls.labelStyle },
|
|
41
|
+
time: { ...controls.timeLook },
|
|
42
|
+
sheetMaxPercent: controls.sheetMaxPercent,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** The looks a fresh viewer opens with, every one filled in, from the resolved look alone (no browser, no controls): the same resolvers `initialSceneControls` uses. `bodies` are the scene's mounted bodies, whose first halo (the Sun's) sets `sunGlow`. */
|
|
46
|
+
export function lookReadFrom(look, definition, bodies) {
|
|
47
|
+
const glowBase = baseGlowOf(bodies);
|
|
48
|
+
const sky = skySettingsOf(definition, look);
|
|
49
|
+
const glow = glowBase === null ? undefined : glowLookOf(look, glowBase);
|
|
50
|
+
return {
|
|
51
|
+
starBrightness: sky.starBrightness,
|
|
52
|
+
milkyWay: sky.milkyWay,
|
|
53
|
+
milkyWayBrightness: sky.milkyWayBrightness,
|
|
54
|
+
skyVisible: sky.visible,
|
|
55
|
+
...(glow === undefined ? {} : { sunGlow: { sizePx: glow.sizePx, brightness: glow.brightness, scale: glow.scale } }),
|
|
56
|
+
markerSwapRadiusPx: markerSettingsOf(look).minSpherePx,
|
|
57
|
+
featureMinBodyPx: featureMinBodyPxOf(look),
|
|
58
|
+
loadFadeSeconds: bootFadeSeconds(look),
|
|
59
|
+
skyFadeInSeconds: skyFadeInSecondsOf(look),
|
|
60
|
+
desktopPictures: desktopPicturesOf({ desktopTextures: undefined }, look),
|
|
61
|
+
skyLines: { ...skyColoursOf(look) },
|
|
62
|
+
labels: { ...labelStyleOf(look) },
|
|
63
|
+
time: { ...timeLookOf(look) },
|
|
64
|
+
sheetMaxPercent: look.sheetMaxPercent ?? DEFAULT_PHONE_LAYOUT.sheetMaxPercent,
|
|
39
65
|
};
|
|
40
66
|
}
|
|
41
67
|
/**
|
|
@@ -57,6 +83,8 @@ export function applyLook(controls, definition, glowBase, input) {
|
|
|
57
83
|
controls.skyColours = skyColoursOf(look);
|
|
58
84
|
controls.skyFadeInSeconds = skyFadeInSecondsOf(look);
|
|
59
85
|
controls.labelStyle = labelStyleOf(look);
|
|
86
|
+
controls.timeLook = timeLookOf(look);
|
|
87
|
+
controls.sheetMaxPercent = look.sheetMaxPercent ?? DEFAULT_PHONE_LAYOUT.sheetMaxPercent;
|
|
60
88
|
return lookReadOf(controls);
|
|
61
89
|
}
|
|
62
90
|
/** The host's view of the presentation: `items` (read fresh each time) are the display switches the scene placed (those with something to act on), so a switch is read and set exactly as its visible button does. */
|
package/src/app/look.d.ts
CHANGED
|
@@ -20,6 +20,11 @@ export type LookKind = {
|
|
|
20
20
|
readonly kind: "colour";
|
|
21
21
|
} | {
|
|
22
22
|
readonly kind: "font";
|
|
23
|
+
} | {
|
|
24
|
+
readonly kind: "zone";
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: "choice";
|
|
27
|
+
readonly values: readonly string[];
|
|
23
28
|
};
|
|
24
29
|
/** One look: where it sits in `LookInput` (`["sunGlow", "sizePx"]` for a nested one), its address parameter (null: the look has none, it is set only with `setLook`) and how it is written. */
|
|
25
30
|
export interface LookField {
|
package/src/app/look.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PHONE_LAYOUT_LIMITS } from "../shell/phoneLayout.js";
|
|
2
|
+
import { LABEL_SIZE_LIMITS, TIME_PRECISIONS } from "../core/lookValues.js";
|
|
2
3
|
const range = (path, param, min, max) => ({ path, param, spec: { kind: "range", min, max } });
|
|
3
4
|
const colour = (name) => ({ path: ["skyLines", name], param: null, spec: { kind: "colour" } });
|
|
4
5
|
/** Every look. The one table; the order is the order of `LookInput`. */
|
|
@@ -19,6 +20,11 @@ export const LOOK_FIELDS = [
|
|
|
19
20
|
colour("figure"), colour("label"), colour("boundary"), colour("ecliptic"), colour("equator"), colour("traced"), colour("faded"), colour("selected"),
|
|
20
21
|
{ path: ["labels", "fontFamily"], param: null, spec: { kind: "font" } },
|
|
21
22
|
range(["labels", "sizePx"], null, LABEL_SIZE_LIMITS.min, LABEL_SIZE_LIMITS.max),
|
|
23
|
+
// The zone and precision of the viewer's times (O-074 T-316) have no address parameter either: the address `t` stays UTC.
|
|
24
|
+
{ path: ["time", "zone"], param: null, spec: { kind: "zone" } },
|
|
25
|
+
{ path: ["time", "precision"], param: null, spec: { kind: "choice", values: TIME_PRECISIONS } },
|
|
26
|
+
// The tallest a phone's information or story sheet grows (O-075 T-317, review F-18): no address parameter; the Developer drawer's "Sheet height" slider is this same value.
|
|
27
|
+
range(["sheetMaxPercent"], null, PHONE_LAYOUT_LIMITS.sheetMaxPercent.min, PHONE_LAYOUT_LIMITS.sheetMaxPercent.max),
|
|
22
28
|
];
|
|
23
29
|
/** The name a look is called in a message: `sunGlow.sizePx`. */
|
|
24
30
|
export const lookName = (field) => field.path.join(".");
|
|
@@ -47,7 +53,7 @@ function fromAddress(search, field) {
|
|
|
47
53
|
if (raw === null)
|
|
48
54
|
return undefined;
|
|
49
55
|
const { spec } = field;
|
|
50
|
-
if (spec.kind === "colour" || spec.kind === "font")
|
|
56
|
+
if (spec.kind === "colour" || spec.kind === "font" || spec.kind === "zone" || spec.kind === "choice")
|
|
51
57
|
return undefined;
|
|
52
58
|
if (spec.kind === "onoff")
|
|
53
59
|
return raw === "on" ? true : raw === "off" ? false : undefined;
|
package/src/app/sceneCamera.js
CHANGED
|
@@ -113,17 +113,29 @@ function applyLookOut(input, request) {
|
|
|
113
113
|
camState.focus = request.body;
|
|
114
114
|
camState.fixedPoint = null;
|
|
115
115
|
camState.transition.fill(0);
|
|
116
|
-
|
|
116
|
+
const fovDeg = clampFov(request.fovDeg ?? camState.targetFovDeg ?? camState.lookOut?.fovDeg ?? LOOK_OUT_OPENING_FOV_DEG);
|
|
117
|
+
if (camState.lookOut !== null) {
|
|
118
|
+
// Already looking out: only the targets move, and resolveCamera eases the turn and the zoom (at once under reduced motion).
|
|
119
|
+
if (angles !== null && !keep) {
|
|
120
|
+
camState.targetAzimuth = angles.azimuth;
|
|
121
|
+
camState.targetElevation = clampLookElevation(angles.elevation);
|
|
122
|
+
}
|
|
123
|
+
camState.targetFovDeg = fovDeg;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (angles !== null) {
|
|
117
127
|
camState.azimuth = camState.targetAzimuth = angles.azimuth;
|
|
118
128
|
camState.elevation = camState.targetElevation = clampLookElevation(angles.elevation);
|
|
119
129
|
}
|
|
120
|
-
camState.
|
|
130
|
+
camState.targetFovDeg = null;
|
|
131
|
+
camState.lookOut = { fovDeg };
|
|
121
132
|
}
|
|
122
133
|
/** Back to the orbit camera: the target tween starts from where the camera stood, not from the aiming point one unit out. */
|
|
123
134
|
function leaveLookOut(camState) {
|
|
124
135
|
if (camState.lookOut === null)
|
|
125
136
|
return;
|
|
126
137
|
camState.lookOut = null;
|
|
138
|
+
camState.targetFovDeg = null;
|
|
127
139
|
for (let i = 0; i < 3; i += 1)
|
|
128
140
|
camState.targetAbsolute[i] = camState.cameraAbsolute[i];
|
|
129
141
|
}
|
|
@@ -79,7 +79,7 @@ export function useOverlayLayers(canvas, controls, trackedViews, bodySetViews, s
|
|
|
79
79
|
export function useScenePointer(canvas, runtime, controls, catalogue, orbit, state) {
|
|
80
80
|
useEffect(() => {
|
|
81
81
|
const limits = () => focusLimits(bodyIdOf(runtime, catalogue, orbit.current.focus) ?? orbit.current.focus, { centre: runtime.sceneCenter, span: state.current.spanScaled, bodies: catalogue }, controls.policy, liveReach(runtime.cameraReach, controls.policy, canvas.clientHeight > 0 ? canvas.clientWidth / canvas.clientHeight : 1));
|
|
82
|
-
return attachScenePointer(canvas, orbit.current, state.current, limits, (id) => controls.onPickObject?.(id));
|
|
82
|
+
return attachScenePointer(canvas, orbit.current, state.current, limits, (id, options) => (options === undefined ? controls.onPickObject?.(id) : controls.onPickObject?.(id, options)));
|
|
83
83
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
84
|
}, [canvas, controls]);
|
|
85
85
|
}
|
package/src/app/sceneFrame.js
CHANGED
|
@@ -164,8 +164,8 @@ export function advanceSkyTraces(ctx) {
|
|
|
164
164
|
for (const request of controls.skyTraces.splice(0)) {
|
|
165
165
|
if ("after" in request)
|
|
166
166
|
views.skyFiguresView.startTrace(request);
|
|
167
|
-
else
|
|
168
|
-
|
|
167
|
+
else if (views.skyFiguresView.clearTrace(request))
|
|
168
|
+
state.wakes += 1;
|
|
169
169
|
}
|
|
170
170
|
if (views.skyFiguresView.advanceTraces(delta, controls.skyColours, controls.skyLines, controls.selectedObjectId))
|
|
171
171
|
state.wakes += 1;
|