astraeus 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -0
- package/README.md +28 -15
- package/package.json +1 -1
- package/src/api/AstraeusScene.d.ts +1 -1
- package/src/api/AstraeusScene.js +4 -1
- package/src/api/AstraeusScene.node.js +4 -1
- package/src/api/assembleScene.d.ts +2 -0
- package/src/api/assembleScene.js +27 -5
- package/src/api/cameraRequest.d.ts +15 -0
- package/src/api/cameraRequest.js +89 -0
- package/src/api/errors.d.ts +9 -1
- package/src/api/index.d.ts +6 -3
- package/src/api/look.d.ts +49 -0
- package/src/api/lookInput.d.ts +1 -1
- package/src/api/lookInput.js +6 -1
- package/src/api/planCamera.d.ts +35 -7
- package/src/api/planCamera.js +94 -11
- package/src/api/planSkyFigures.d.ts +22 -0
- package/src/api/planSkyFigures.js +145 -0
- package/src/api/planStory.d.ts +2 -2
- package/src/api/planStory.js +14 -9
- package/src/api/planViews.js +1 -1
- package/src/api/scene.d.ts +17 -4
- package/src/api/scene.js +23 -5
- package/src/api/sceneReads.d.ts +21 -2
- package/src/api/skyFigureInput.d.ts +45 -0
- package/src/api/skyFigureInput.js +1 -0
- package/src/api/skyTraceInput.d.ts +33 -0
- package/src/api/skyTraceInput.js +45 -0
- package/src/api/story.d.ts +12 -3
- package/src/api/story.js +44 -1
- package/src/api/viewerCamera.d.ts +4 -3
- package/src/api/viewerCamera.js +10 -32
- package/src/api/viewerHandle.d.ts +27 -4
- package/src/api/viewerHandle.js +6 -0
- package/src/api/viewerLink.d.ts +49 -4
- package/src/api/viewerLink.js +25 -0
- package/src/api/viewerPanels.d.ts +26 -0
- package/src/api/viewerPanels.js +42 -0
- package/src/api/viewerSelection.d.ts +1 -1
- package/src/api/viewerSelection.js +3 -3
- package/src/app/App.js +100 -18
- package/src/app/App.node.js +100 -18
- package/src/app/AstraeusScene.d.ts +20 -5
- package/src/app/AstraeusScene.js +3 -3
- package/src/app/CameraController.d.ts +17 -0
- package/src/app/CameraController.js +34 -9
- package/src/app/DeveloperSettings.d.ts +11 -3
- package/src/app/DeveloperSettings.js +13 -3
- package/src/app/SceneLabels.d.ts +20 -2
- package/src/app/SceneLabels.js +46 -6
- package/src/app/SkyFiguresView.d.ts +56 -0
- package/src/app/SkyFiguresView.js +242 -0
- package/src/app/StoryMarkers.d.ts +2 -2
- package/src/app/StoryMarkers.js +2 -2
- package/src/app/displaySwitches.d.ts +13 -3
- package/src/app/displaySwitches.js +17 -3
- package/src/app/experienceDefinition.d.ts +9 -3
- package/src/app/experienceDefinition.js +4 -2
- package/src/app/labelStyle.d.ts +17 -0
- package/src/app/labelStyle.js +13 -0
- package/src/app/liveLook.js +8 -0
- package/src/app/look.d.ts +9 -5
- package/src/app/look.js +11 -0
- package/src/app/lookOut.d.ts +32 -0
- package/src/app/lookOut.js +50 -0
- package/src/app/sceneCamera.d.ts +5 -3
- package/src/app/sceneCamera.js +66 -3
- package/src/app/sceneContentsHooks.d.ts +2 -1
- package/src/app/sceneContentsHooks.js +3 -2
- package/src/app/sceneFrame.d.ts +10 -1
- package/src/app/sceneFrame.js +45 -10
- package/src/app/sceneFraming.d.ts +7 -0
- package/src/app/sceneFraming.js +12 -0
- package/src/app/sceneHooks.d.ts +2 -0
- package/src/app/sceneHooks.js +4 -1
- package/src/app/scenePicking.d.ts +20 -0
- package/src/app/scenePicking.js +49 -0
- package/src/app/scenePointer.d.ts +3 -1
- package/src/app/scenePointer.js +3 -2
- package/src/app/skyFigures.d.ts +73 -0
- package/src/app/skyFigures.js +50 -0
- package/src/app/style.css +2 -1
- package/src/app/viewHiding.d.ts +2 -0
- package/src/app/viewHiding.js +7 -1
- package/src/app/viewLink.d.ts +8 -8
- package/src/app/viewLink.js +24 -4
- package/src/app/viewerPort.d.ts +30 -3
- package/src/assets/sky.d.ts +13 -4
- package/src/assets/sky.js +33 -8
- package/src/assets/stars/hyg-v42-naked-eye.json +1 -1
- package/src/core/bodies/moonSystem.js +1 -15
- package/src/core/lookValues.d.ts +9 -0
- package/src/core/lookValues.js +24 -0
- package/src/core/readBytes.d.ts +1 -0
- package/src/core/readBytes.js +15 -0
- package/src/core/skyTrace.d.ts +49 -0
- package/src/core/skyTrace.js +39 -0
- package/src/core/startView.d.ts +39 -0
- package/src/core/startView.js +56 -0
- package/src/core/storyPanels.d.ts +51 -3
- package/src/core/storyPanels.js +52 -12
- package/src/shell/AstraeusShell.d.ts +15 -6
- package/src/shell/AstraeusShell.js +76 -20
- package/src/shell/AstraeusShell.node.js +76 -20
- package/src/shell/ObjectControls.js +11 -8
- package/src/shell/StoryPanelView.d.ts +12 -3
- package/src/shell/StoryPanelView.js +2 -2
- package/src/shell/experience.d.ts +24 -0
- package/src/shell/experience.js +4 -1
- package/src/shell/infoModel.js +9 -1
- package/src/shell/objectModel.d.ts +6 -2
- package/src/shell/objectModel.js +10 -1
- package/src/shell/phone.css +1 -1
- package/src/shell/storyPanels.d.ts +1 -1
- package/src/shell/storyPanels.js +1 -1
- package/src/shell/style.css +9 -1
- package/src/shell/topBarIcons.d.ts +1 -0
- package/src/shell/topBarIcons.js +1 -0
- package/src/shell/useStoryPanels.d.ts +9 -6
- package/src/shell/useStoryPanels.js +10 -6
package/src/app/AstraeusScene.js
CHANGED
|
@@ -33,14 +33,14 @@ function SceneContents({ runtime, controls, readout, layers, frameState }) {
|
|
|
33
33
|
const orbit = useRef(createOrbitCameraState(START_CAMERA_DISTANCE, runtime.sceneCenter));
|
|
34
34
|
const { placement, readoutPair, pairLabels, assets, bodyFamilies } = useSceneDerived(runtime, catalogue);
|
|
35
35
|
const views = useSceneViews(runtime, gl);
|
|
36
|
-
const { trackedViews, groupViews, compositionPaths, skyView, bodySetViews, orbitSetViews, sunCentredViews } = views;
|
|
36
|
+
const { trackedViews, groupViews, compositionPaths, skyView, skyFiguresView, bodySetViews, orbitSetViews, sunCentredViews } = views;
|
|
37
37
|
useSkyStars(gl.domElement, skyView);
|
|
38
38
|
useDrawWakes(gl.domElement, frameState);
|
|
39
39
|
useReleaseSharedTextures();
|
|
40
|
-
const layerRefs = useOverlayLayers(gl.domElement, controls, trackedViews, bodySetViews);
|
|
40
|
+
const layerRefs = useOverlayLayers(gl.domElement, controls, trackedViews, bodySetViews, skyFiguresView.labels);
|
|
41
41
|
useScenePointer(gl.domElement, runtime, controls, catalogue, orbit, frameState);
|
|
42
42
|
useSceneFrame(rootRef, { runtime, controls, readout, catalogue, origin, orbit, state: frameState, assets, bodyRefs, lightRefs, placement, views, layers: layerRefs, bodyFamilies, readoutPair, pairLabels });
|
|
43
|
-
return (_jsxs("group", { ref: rootRef, children: [assets.map((asset) => (_jsx(SceneBody, { asset: asset, layer: layers.get(asset.definition.id), controls: controls, desktopTextures: runtime.desktopTextures === true, pictures: runtime.pictures, ringLookOf: ringLookOf, onParts: partsFor.get(asset.definition.id), groupRef: refFor(groupRefs.current, asset.definition.id), orientRef: refFor(orientRefs.current, asset.definition.id), lightRef: refFor(lightRefs.current, asset.definition.id) }, asset.definition.id))), skyView !== null && _jsx("primitive", { object: skyView.group }), compositionPaths.map((view) => _jsx("primitive", { object: view.group }, view.id)), trackedViews.map((view) => _jsx("primitive", { object: view.group }, view.body.id)), groupViews.map((view) => _jsx("primitive", { object: view.group }, view.id)), sunCentredViews.map((view) => _jsx("primitive", { object: view.group }, view.id)), bodySetViews.map((view) => _jsx("primitive", { object: view.group }, view.id)), orbitSetViews.map((view) => _jsx("primitive", { object: view.group }, view.id))] }));
|
|
43
|
+
return (_jsxs("group", { ref: rootRef, children: [assets.map((asset) => (_jsx(SceneBody, { asset: asset, layer: layers.get(asset.definition.id), controls: controls, desktopTextures: runtime.desktopTextures === true, pictures: runtime.pictures, ringLookOf: ringLookOf, onParts: partsFor.get(asset.definition.id), groupRef: refFor(groupRefs.current, asset.definition.id), orientRef: refFor(orientRefs.current, asset.definition.id), lightRef: refFor(lightRefs.current, asset.definition.id) }, asset.definition.id))), skyView !== null && _jsx("primitive", { object: skyView.group }), _jsx("primitive", { object: skyFiguresView.group }), compositionPaths.map((view) => _jsx("primitive", { object: view.group }, view.id)), trackedViews.map((view) => _jsx("primitive", { object: view.group }, view.body.id)), groupViews.map((view) => _jsx("primitive", { object: view.group }, view.id)), sunCentredViews.map((view) => _jsx("primitive", { object: view.group }, view.id)), bodySetViews.map((view) => _jsx("primitive", { object: view.group }, view.id)), orbitSetViews.map((view) => _jsx("primitive", { object: view.group }, view.id))] }));
|
|
44
44
|
}
|
|
45
45
|
/** One catalogued body: its view and, when its record has a light, the ambient and directional light on its layer. */
|
|
46
46
|
function SceneBody({ asset, layer, controls, desktopTextures, pictures, ringLookOf, onParts, groupRef, orientRef, lightRef }) {
|
|
@@ -2,6 +2,7 @@ import { PerspectiveCamera } from "three";
|
|
|
2
2
|
import type { FloatingOrigin } from "./floatingOrigin.js";
|
|
3
3
|
import type { RenderVector } from "./renderCoordinates.js";
|
|
4
4
|
import { type PickPointer } from "./scenePicking.js";
|
|
5
|
+
import { type LookOutState } from "./lookOut.js";
|
|
5
6
|
import type { StartView } from "./viewLink.js";
|
|
6
7
|
/** The id of a catalogued body, or of any tracked trajectory body, group or path. */
|
|
7
8
|
export type FocusId = string;
|
|
@@ -16,11 +17,25 @@ export type CameraRequest = {
|
|
|
16
17
|
| {
|
|
17
18
|
readonly kind: "hold";
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Stands the camera at the centre of `body` looking out: the direction is a unit vector in EQJ or an object id to turn toward (absent: the direction already looked along, else right ascension 0, declination 0), and `fovDeg` (default: the current one, else 60) is the zoom.
|
|
22
|
+
* Camera-only. A focus, follow, overview or pose request puts the orbit camera back; a hold is ignored while looking out.
|
|
23
|
+
*/
|
|
24
|
+
| {
|
|
25
|
+
readonly kind: "lookOut";
|
|
26
|
+
readonly body: FocusId;
|
|
27
|
+
readonly direction?: readonly [number, number, number] | FocusId;
|
|
28
|
+
readonly fovDeg?: number;
|
|
29
|
+
}
|
|
19
30
|
/** Puts the camera back on a pose read earlier: it follows the pose's object and eases to its angles and distance (the offset is the object's own, so a moving object is followed from where it is now). */
|
|
20
31
|
| {
|
|
21
32
|
readonly kind: "pose";
|
|
22
33
|
readonly view: StartView;
|
|
23
34
|
};
|
|
35
|
+
/** A look-out request: what `setCamera`, a story panel camera and an opening look-out toward an id all run (`sceneCamera.ts` `applyLookOut`). */
|
|
36
|
+
export type LookOutRequest = Extract<CameraRequest, {
|
|
37
|
+
readonly kind: "lookOut";
|
|
38
|
+
}>;
|
|
24
39
|
export interface OrbitCameraState {
|
|
25
40
|
azimuth: number;
|
|
26
41
|
targetAzimuth: number;
|
|
@@ -34,6 +49,8 @@ export interface OrbitCameraState {
|
|
|
34
49
|
fixedPoint: [number, number, number] | null;
|
|
35
50
|
/** Decaying offset that tweens the displayed target from the previous focus to the new one. */
|
|
36
51
|
transition: [number, number, number];
|
|
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
|
+
lookOut: LookOutState | null;
|
|
37
54
|
/** Scaled absolute camera/target positions (Float64, render axes) for the latest frame. */
|
|
38
55
|
cameraAbsolute: [number, number, number];
|
|
39
56
|
targetAbsolute: [number, number, number];
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { TapTracker } from "./scenePicking.js";
|
|
2
2
|
import { EQUATORIAL_UP, orbitBasis } from "./viewUp.js";
|
|
3
|
+
import { CAMERA_FOV_DEG } from "./sceneFraming.js";
|
|
4
|
+
import { directionAt, LOOK_OUT_NEAR, panLookOut, zoomLookOut } from "./lookOut.js";
|
|
3
5
|
export function createOrbitCameraState(distance, focus) {
|
|
4
6
|
return {
|
|
5
7
|
azimuth: Math.PI * 1.2,
|
|
@@ -11,6 +13,7 @@ export function createOrbitCameraState(distance, focus) {
|
|
|
11
13
|
focus,
|
|
12
14
|
fixedPoint: null,
|
|
13
15
|
transition: [0, 0, 0],
|
|
16
|
+
lookOut: null,
|
|
14
17
|
cameraAbsolute: [0, 0, 0],
|
|
15
18
|
targetAbsolute: [0, 0, 0],
|
|
16
19
|
};
|
|
@@ -57,12 +60,16 @@ export function attachOrbitGestures(element, state, getLimits, onTap) {
|
|
|
57
60
|
if (pointers.size >= 2) {
|
|
58
61
|
const spread = pointerSpread(pointers);
|
|
59
62
|
if (pinchDistance !== null) {
|
|
60
|
-
|
|
61
|
-
cancelCameraTransition(state);
|
|
63
|
+
zoomBy(state, Math.exp(-(spread - pinchDistance) * PINCH_SENSITIVITY), getLimits());
|
|
62
64
|
}
|
|
63
65
|
pinchDistance = spread;
|
|
64
66
|
return;
|
|
65
67
|
}
|
|
68
|
+
if (state.lookOut !== null) {
|
|
69
|
+
panLookOut(state, state.lookOut.fovDeg, next.x - previous.x, next.y - previous.y, window.innerHeight);
|
|
70
|
+
cancelCameraTransition(state);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
66
73
|
const sensitivity = event.pointerType === "touch" ? TOUCH_DRAG_SENSITIVITY : DRAG_SENSITIVITY;
|
|
67
74
|
state.azimuth -= ((next.x - previous.x) / window.innerWidth) * Math.PI * 2 * sensitivity;
|
|
68
75
|
state.elevation = Math.max(-MAX_ELEVATION, Math.min(MAX_ELEVATION, state.elevation + ((next.y - previous.y) / window.innerHeight) * Math.PI * sensitivity));
|
|
@@ -86,8 +93,7 @@ export function attachOrbitGestures(element, state, getLimits, onTap) {
|
|
|
86
93
|
};
|
|
87
94
|
const onWheel = (event) => {
|
|
88
95
|
event.preventDefault();
|
|
89
|
-
|
|
90
|
-
cancelCameraTransition(state);
|
|
96
|
+
zoomBy(state, Math.exp(event.deltaY * WHEEL_SENSITIVITY), getLimits());
|
|
91
97
|
};
|
|
92
98
|
element.addEventListener("pointerdown", onPointerDown);
|
|
93
99
|
element.addEventListener("pointermove", onPointerMove);
|
|
@@ -102,6 +108,14 @@ export function attachOrbitGestures(element, state, getLimits, onTap) {
|
|
|
102
108
|
element.removeEventListener("wheel", onWheel);
|
|
103
109
|
};
|
|
104
110
|
}
|
|
111
|
+
/** A wheel or pinch step: the distance in orbit, the field of view while looking out. */
|
|
112
|
+
function zoomBy(state, factor, limits) {
|
|
113
|
+
if (state.lookOut !== null)
|
|
114
|
+
zoomLookOut(state.lookOut, factor);
|
|
115
|
+
else
|
|
116
|
+
state.distance = clampDistance(state.distance * factor, limits);
|
|
117
|
+
cancelCameraTransition(state);
|
|
118
|
+
}
|
|
105
119
|
/** Stops any scripted framing while keeping the viewer's current manual pose. */
|
|
106
120
|
export function cancelCameraTransition(state) {
|
|
107
121
|
state.transition.fill(0);
|
|
@@ -141,14 +155,24 @@ export function resolveCamera(state, focusAbsolute, origin, deltaSeconds, rebase
|
|
|
141
155
|
state.transition[i] = 0;
|
|
142
156
|
state.targetAbsolute[i] = focusAbsolute[i] + state.transition[i];
|
|
143
157
|
}
|
|
144
|
-
const cosEl = Math.cos(state.elevation);
|
|
145
158
|
const { east, south } = orbitBasis(up);
|
|
146
|
-
const
|
|
147
|
-
|
|
159
|
+
const direction = directionAt(state.azimuth, state.elevation, east, south, up);
|
|
160
|
+
if (state.lookOut !== null) {
|
|
161
|
+
placeLookOut(state, focusAbsolute, direction);
|
|
162
|
+
origin.rebaseIfFar(state.cameraAbsolute, rebaseThreshold);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
148
165
|
for (let i = 0; i < 3; i += 1)
|
|
149
|
-
state.cameraAbsolute[i] = state.targetAbsolute[i] +
|
|
166
|
+
state.cameraAbsolute[i] = state.targetAbsolute[i] + state.distance * direction[i];
|
|
150
167
|
origin.rebaseIfFar(state.targetAbsolute, rebaseThreshold);
|
|
151
168
|
}
|
|
169
|
+
/** Looking out: the camera is at the body's centre and its target one unit along the look direction (a point to aim at, not a place). */
|
|
170
|
+
function placeLookOut(state, bodyAbsolute, direction) {
|
|
171
|
+
for (let i = 0; i < 3; i += 1) {
|
|
172
|
+
state.cameraAbsolute[i] = bodyAbsolute[i];
|
|
173
|
+
state.targetAbsolute[i] = bodyAbsolute[i] + direction[i];
|
|
174
|
+
}
|
|
175
|
+
}
|
|
152
176
|
function shortestAngleDelta(from, to) {
|
|
153
177
|
return Math.atan2(Math.sin(to - from), Math.cos(to - from));
|
|
154
178
|
}
|
|
@@ -159,7 +183,8 @@ export function poseCamera(camera, state, focusRadius, origin, far = 5_000, up =
|
|
|
159
183
|
camera.position.set(cx, cy, cz);
|
|
160
184
|
camera.up.set(up[0], up[1], up[2]);
|
|
161
185
|
camera.lookAt(tx, ty, tz);
|
|
162
|
-
camera.near = Math.max(1e-3, 0.1 * (state.distance - focusRadius));
|
|
186
|
+
camera.near = state.lookOut === null ? Math.max(1e-3, 0.1 * (state.distance - focusRadius)) : LOOK_OUT_NEAR;
|
|
187
|
+
camera.fov = state.lookOut?.fovDeg ?? CAMERA_FOV_DEG;
|
|
163
188
|
camera.far = far;
|
|
164
189
|
camera.updateProjectionMatrix();
|
|
165
190
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { MutableRefObject } from "react";
|
|
2
|
+
import { type LabelStyle } from "./labelStyle.js";
|
|
3
|
+
import type { SkyColours } from "./skyFigures.js";
|
|
2
4
|
import type { GlowLook } from "./bodyDraw.js";
|
|
3
5
|
import { type BodySetLayer, type BodySetLook } from "./bodySet.js";
|
|
4
6
|
import { type RingLook, type RingSystem } from "../assets/rings.js";
|
|
@@ -6,7 +8,7 @@ import type { SceneControls } from "./AstraeusScene.js";
|
|
|
6
8
|
import { type DebugReadout } from "./DebugOverlay.js";
|
|
7
9
|
import { type GroupFill } from "./FrameRateSection.js";
|
|
8
10
|
import type { FrameSnapshot } from "./frameStats.js";
|
|
9
|
-
import { type
|
|
11
|
+
import { type CameraView } from "./viewLink.js";
|
|
10
12
|
import type { ViewUp } from "./viewUp.js";
|
|
11
13
|
/** The Developer tools' settings bodies that App.tsx hands whole to its folds; each only reads its props and writes the scene's live controls. */
|
|
12
14
|
type Controls = MutableRefObject<SceneControls>;
|
|
@@ -45,8 +47,14 @@ export declare function SkyAndSunSettings({ illuminateAll, setIlluminateAll, vis
|
|
|
45
47
|
readonly milkyWayBrightness: number;
|
|
46
48
|
readonly setMilkyWayBrightness: (value: number) => void;
|
|
47
49
|
}): import("react").JSX.Element;
|
|
48
|
-
export declare function LabelSettings({ controls, hoverBrightness, setHoverBrightness, labelToggles, trackedCount, anchorLabels, setAnchorLabels, hiddenLabels, setHiddenLabels }: {
|
|
50
|
+
export declare function LabelSettings({ controls, hoverBrightness, setHoverBrightness, labelToggles, trackedCount, anchorLabels, setAnchorLabels, hiddenLabels, setHiddenLabels, labelStyle, setLabelStyle, skyColours, setSkyColours, hasSky }: {
|
|
49
51
|
readonly controls: Controls;
|
|
52
|
+
readonly labelStyle: LabelStyle;
|
|
53
|
+
readonly setLabelStyle: (style: LabelStyle) => void;
|
|
54
|
+
readonly skyColours: SkyColours;
|
|
55
|
+
readonly setSkyColours: (colours: SkyColours) => void;
|
|
56
|
+
/** Whether the sky is drawn, so its line colours have something to act on. */
|
|
57
|
+
readonly hasSky: boolean;
|
|
50
58
|
readonly hoverBrightness: number;
|
|
51
59
|
readonly setHoverBrightness: (value: number) => void;
|
|
52
60
|
readonly labelToggles: readonly {
|
|
@@ -60,7 +68,7 @@ export declare function LabelSettings({ controls, hoverBrightness, setHoverBrigh
|
|
|
60
68
|
readonly setHiddenLabels: (hidden: ReadonlySet<string>) => void;
|
|
61
69
|
}): import("react").JSX.Element;
|
|
62
70
|
export declare function ViewLinkReadout({ viewNow, viewLink, scale, upChoice }: {
|
|
63
|
-
readonly viewNow:
|
|
71
|
+
readonly viewNow: CameraView | null;
|
|
64
72
|
readonly viewLink: {
|
|
65
73
|
readonly url: string;
|
|
66
74
|
readonly copied: boolean;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Color } from "three";
|
|
3
|
+
import { isFontFamily } from "../core/lookValues.js";
|
|
4
|
+
import { LABEL_SIZE_LIMITS } from "./labelStyle.js";
|
|
2
5
|
import { GLOW_LIMITS } from "./bodyDraw.js";
|
|
3
6
|
import { BODY_SET_LOOK_LIMITS, DEFAULT_BODY_SET_LOOK, familyColorOf } from "./bodySet.js";
|
|
4
7
|
import { ringBandsWithLook } from "../assets/rings.js";
|
|
@@ -7,6 +10,7 @@ import { MAX_PANEL_PAUSE_SECONDS } from "../shell/storyPanels.js";
|
|
|
7
10
|
import { DebugOverlay } from "./DebugOverlay.js";
|
|
8
11
|
import { FrameRateSection } from "./FrameRateSection.js";
|
|
9
12
|
import { formatView } from "./viewLink.js";
|
|
13
|
+
import { isSkyView } from "../core/startView.js";
|
|
10
14
|
import { HudSection, SettingButtons, SettingColor, SettingGroup, SettingSlider } from "./SettingControls.js";
|
|
11
15
|
export function StoryPanelSettings({ storyAutoOpen, setStoryAutoOpen, storyPauseSeconds, setStoryPauseSeconds }) {
|
|
12
16
|
return (_jsxs(SettingGroup, { name: "story-panels", title: "Story panels", children: [_jsx(SettingButtons, { children: _jsx("button", { "aria-pressed": storyAutoOpen, onClick: () => setStoryAutoOpen(!storyAutoOpen), children: "Open panels automatically" }) }), _jsx(SettingSlider, { label: "Pause when a panel opens (s)", ariaLabel: "Story panel pause", testId: "story-pause-value", display: storyPauseSeconds === 0 ? "off" : storyPauseSeconds.toFixed(1), min: 0, max: MAX_PANEL_PAUSE_SECONDS, step: 0.5, value: storyPauseSeconds, onChange: setStoryPauseSeconds })] }));
|
|
@@ -17,8 +21,14 @@ export function MoonsAndRingsSettings({ bodySets, ringSystems, setLook, changeSe
|
|
|
17
21
|
export function SkyAndSunSettings({ illuminateAll, setIlluminateAll, visible, glowShown, setGlowShown, controls, milkyWayOn, setMilkyWayOn, starBrightness, setStarBrightness, milkyWayBrightness, setMilkyWayBrightness }) {
|
|
18
22
|
return (_jsxs(_Fragment, { children: [_jsx(SettingGroup, { name: "lighting", title: "Lighting", children: _jsx(SettingButtons, { children: _jsx("button", { "aria-pressed": illuminateAll, "aria-label": "Illuminate all", onClick: () => { controls.current.illuminateAll = !illuminateAll; setIlluminateAll(!illuminateAll); }, children: "Illuminate all" }) }) }), visible && (_jsxs(SettingGroup, { name: "sky", title: "Sky", children: [_jsx(SettingButtons, { children: _jsx("button", { "aria-pressed": milkyWayOn, onClick: () => { controls.current.showMilkyWay = !milkyWayOn; setMilkyWayOn(!milkyWayOn); }, children: "Milky Way picture" }) }), _jsx(SettingSlider, { label: "Star brightness", ariaLabel: "Star brightness", testId: "star-brightness-value", display: starBrightness.toFixed(2), min: 0, max: 2, step: 0.05, value: starBrightness, onChange: (value) => { controls.current.starBrightness = value; setStarBrightness(value); } }), _jsx(SettingSlider, { label: "Milky Way brightness", ariaLabel: "Milky Way brightness", testId: "milky-way-brightness-value", display: milkyWayBrightness.toFixed(2), min: 0, max: 2, step: 0.05, value: milkyWayBrightness, onChange: (value) => { controls.current.milkyWayBrightness = value; setMilkyWayBrightness(value); } })] })), glowShown !== null && (_jsxs(SettingGroup, { name: "glow", title: "Sun glow", children: [_jsx(SettingSlider, { label: "Glow size (px)", ariaLabel: "Sun glow size", testId: "sun-glow-size-value", display: glowShown.sizePx.toFixed(0), min: GLOW_LIMITS.sizePx.min, max: GLOW_LIMITS.sizePx.max, step: 1, value: glowShown.sizePx, onChange: (value) => { controls.current.glowLook.sizePx = value; setGlowShown({ ...controls.current.glowLook }); } }), _jsx(SettingSlider, { label: "Glow brightness", ariaLabel: "Sun glow brightness", testId: "sun-glow-brightness-value", display: glowShown.brightness.toFixed(2), min: GLOW_LIMITS.brightness.min, max: GLOW_LIMITS.brightness.max, step: 0.05, value: glowShown.brightness, onChange: (value) => { controls.current.glowLook.brightness = value; setGlowShown({ ...controls.current.glowLook }); } }), _jsx(SettingSlider, { label: "Glow reach (\u00D7 disc)", ariaLabel: "Sun glow reach", testId: "sun-glow-scale-value", display: glowShown.scale.toFixed(1), min: GLOW_LIMITS.scale.min, max: GLOW_LIMITS.scale.max, step: 0.1, value: glowShown.scale, onChange: (value) => { controls.current.glowLook.scale = value; setGlowShown({ ...controls.current.glowLook }); } })] }))] }));
|
|
19
23
|
}
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
/** A colour input takes `#rrggbb` only; the look may hold any CSS colour the viewer accepts, so show it as hex. */
|
|
25
|
+
const hexOf = (colour) => `#${new Color(colour).getHexString()}`;
|
|
26
|
+
const SKY_COLOUR_ROWS = [["figure", "Figure lines"], ["label", "Figure names"], ["boundary", "Outlines"], ["ecliptic", "Ecliptic"], ["equator", "Celestial equator"], ["traced", "Traced lines"], ["faded", "Faded lines"], ["selected", "Selected figure"]];
|
|
27
|
+
export function LabelSettings({ controls, hoverBrightness, setHoverBrightness, labelToggles, trackedCount, anchorLabels, setAnchorLabels, hiddenLabels, setHiddenLabels, labelStyle, setLabelStyle, skyColours, setSkyColours, hasSky }) {
|
|
28
|
+
return (_jsxs(_Fragment, { children: [_jsx(SettingSlider, { label: "Hover name brightness", ariaLabel: "Hover name brightness", testId: "hover-brightness-value", display: hoverBrightness.toFixed(2), min: HOVER_BRIGHTNESS_LIMITS.min, max: HOVER_BRIGHTNESS_LIMITS.max, step: 0.05, value: hoverBrightness, onChange: (value) => { controls.current.hoverBrightness = value; setHoverBrightness(value); } }), _jsx(SettingSlider, { label: "Label size (px)", ariaLabel: "Label size", testId: "label-size-value", display: labelStyle.sizePx.toFixed(0), min: LABEL_SIZE_LIMITS.min, max: LABEL_SIZE_LIMITS.max, step: 1, value: labelStyle.sizePx, onChange: (sizePx) => { controls.current.labelStyle = { ...controls.current.labelStyle, sizePx }; setLabelStyle(controls.current.labelStyle); } }), _jsxs("label", { className: "setting", children: [_jsx("span", { className: "setting-label", children: "Label font" }), _jsx("input", { type: "text", "aria-label": "Label font", "data-testid": "label-font", defaultValue: labelStyle.fontFamily, spellCheck: false, onChange: (event) => { if (isFontFamily(event.target.value)) {
|
|
29
|
+
controls.current.labelStyle = { ...controls.current.labelStyle, fontFamily: event.target.value.trim() };
|
|
30
|
+
setLabelStyle(controls.current.labelStyle);
|
|
31
|
+
} } })] }), hasSky && (_jsx(SettingGroup, { name: "sky-line-colours", title: "Sky line colours", children: SKY_COLOUR_ROWS.map(([key, label]) => (_jsx(SettingColor, { label: label, ariaLabel: `Sky ${label} colour`, testId: `sky-colour-${key}`, value: hexOf(skyColours[key]), onChange: (value) => { controls.current.skyColours = { ...controls.current.skyColours, [key]: value }; setSkyColours(controls.current.skyColours); } }, key))) })), (labelToggles.length > 0 || trackedCount > 0) && _jsxs(SettingButtons, { children: [trackedCount > 0 && _jsx("button", { "aria-pressed": anchorLabels, onClick: () => { controls.current.showAnchorLabels = !anchorLabels; setAnchorLabels(!anchorLabels); }, children: "Anchor labels" }), labelToggles.map((object) => (_jsx("button", { "aria-pressed": !hiddenLabels.has(object.id), onClick: () => {
|
|
22
32
|
const hidden = controls.current.hiddenLabels ?? new Set();
|
|
23
33
|
if (hidden.has(object.id))
|
|
24
34
|
hidden.delete(object.id);
|
|
@@ -29,7 +39,7 @@ export function LabelSettings({ controls, hoverBrightness, setHoverBrightness, l
|
|
|
29
39
|
}, children: `${object.label} label` }, object.id)))] })] }));
|
|
30
40
|
}
|
|
31
41
|
export function ViewLinkReadout({ viewNow, viewLink, scale, upChoice }) {
|
|
32
|
-
return (_jsxs(_Fragment, { children: [viewNow !== null && _jsx("p", { className: "view-link-values", "data-testid": "view-values", children: `View: ${formatView(viewNow).replace(/%2C/g, ",")} (focus, azimuth °, elevation °, distance) · scale ${scale} · up ${upChoice}` }), viewLink !== null && (_jsxs("p", { className: "view-link-field", children: [_jsx("input", { readOnly: true, "aria-label": "View link", "data-testid": "view-link", value: viewLink.url, onFocus: (event) => event.currentTarget.select() }), _jsx("span", { children: viewLink.copied ? "Copied to the clipboard." : "Clipboard unavailable: select the link above and copy it." })] }))] }));
|
|
42
|
+
return (_jsxs(_Fragment, { children: [viewNow !== null && _jsx("p", { className: "view-link-values", "data-testid": "view-values", children: `View: ${formatView(viewNow).replace(/%2C/g, ",")} ${isSkyView(viewNow) ? "(body, right ascension °, declination °, field of view °, sky)" : "(focus, azimuth °, elevation °, distance)"} · scale ${scale} · up ${upChoice}` }), viewLink !== null && (_jsxs("p", { className: "view-link-field", children: [_jsx("input", { readOnly: true, "aria-label": "View link", "data-testid": "view-link", value: viewLink.url, onFocus: (event) => event.currentTarget.select() }), _jsx("span", { children: viewLink.copied ? "Copied to the clipboard." : "Clipboard unavailable: select the link above and copy it." })] }))] }));
|
|
33
43
|
}
|
|
34
44
|
export function UnderTheHoodSettings({ hud, frames, fills, fpsHistory }) {
|
|
35
45
|
return (_jsxs(_Fragment, { children: [hud !== null && (_jsx(HudSection, { level: 4, heading: "Scene instrumentation", children: _jsx(DebugOverlay, { readout: hud }) })), _jsx(FrameRateSection, { frames: frames, fills: fills, fpsHistory: fpsHistory })] }));
|
package/src/app/SceneLabels.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type Camera } from "three";
|
|
|
2
2
|
import type { ExperienceObject } from "../shell/experience.js";
|
|
3
3
|
import type { FloatingOrigin } from "./floatingOrigin.js";
|
|
4
4
|
import type { RenderVector } from "./renderCoordinates.js";
|
|
5
|
+
import type { SkyLabelSpec } from "./SkyFiguresView.js";
|
|
6
|
+
import type { SkyLineSwitches } from "./skyFigures.js";
|
|
5
7
|
interface Rect {
|
|
6
8
|
readonly left: number;
|
|
7
9
|
readonly top: number;
|
|
@@ -18,15 +20,31 @@ export declare const LABEL_PADDING_PX = 6;
|
|
|
18
20
|
* One rule for every label; the selected label is placed first and never loses a collision (I-108).
|
|
19
21
|
*/
|
|
20
22
|
export declare const LABEL_REAPPEAR_MARGIN_PX = 14;
|
|
23
|
+
/** Sky labels rank below every object label, so a name on the sky never hides a body's (figures above outlines). */
|
|
24
|
+
export declare const SKY_LABEL_PRIORITY: {
|
|
25
|
+
readonly figure: -10;
|
|
26
|
+
readonly boundary: -20;
|
|
27
|
+
};
|
|
28
|
+
/** Where the sky labels stand this frame: which kinds show, and the distance (render units) from the camera they are projected at. */
|
|
29
|
+
export interface SkyLabelFrame {
|
|
30
|
+
readonly on: Readonly<SkyLineSwitches>;
|
|
31
|
+
readonly distance: number;
|
|
32
|
+
/** The look's colour for a sky label that has no colour of its own. */
|
|
33
|
+
readonly labelColor: string;
|
|
34
|
+
/** The look's colour for the selected sky figure's name. */
|
|
35
|
+
readonly selectedColor?: string;
|
|
36
|
+
/** How much of a sky label shows, 0 (not drawn) to 1; absent: all show. */
|
|
37
|
+
readonly opacity?: (id: string) => number;
|
|
38
|
+
}
|
|
21
39
|
/** App adapter that places configured labels; the label presentation itself stays generic. */
|
|
22
40
|
export declare class SceneLabelLayer {
|
|
23
41
|
#private;
|
|
24
|
-
constructor(host: HTMLElement, objects: readonly ExperienceObject[]);
|
|
42
|
+
constructor(host: HTMLElement, objects: readonly ExperienceObject[], skyLabels?: readonly SkyLabelSpec[]);
|
|
25
43
|
/** The page rectangles of the labels shown after the latest update, by object id: the targets a tap on a name can hit. */
|
|
26
44
|
get shownRects(): ReadonlyMap<string, Rect>;
|
|
27
45
|
/** Brightens the name of the hovered object by `gain` (1 leaves it alone); null clears it. */
|
|
28
46
|
setHover(id: string | null, gain: number): void;
|
|
29
|
-
update(positionFor: (objectId: string) => RenderVector | null, camera: Camera, widthPx: number, heightPx: number, origin: FloatingOrigin, selectedObjectId: string, hiddenIds?: ReadonlySet<string
|
|
47
|
+
update(positionFor: (objectId: string) => RenderVector | null, camera: Camera, widthPx: number, heightPx: number, origin: FloatingOrigin, selectedObjectId: string, hiddenIds?: ReadonlySet<string>, sky?: SkyLabelFrame): void;
|
|
30
48
|
dispose(): void;
|
|
31
49
|
}
|
|
32
50
|
export {};
|
package/src/app/SceneLabels.js
CHANGED
|
@@ -11,19 +11,36 @@ export const LABEL_PADDING_PX = 6;
|
|
|
11
11
|
* One rule for every label; the selected label is placed first and never loses a collision (I-108).
|
|
12
12
|
*/
|
|
13
13
|
export const LABEL_REAPPEAR_MARGIN_PX = 14;
|
|
14
|
+
/** Sky labels rank below every object label, so a name on the sky never hides a body's (figures above outlines). */
|
|
15
|
+
export const SKY_LABEL_PRIORITY = { figure: -10, boundary: -20 };
|
|
16
|
+
/** How much of a sky label shows, 0 to 1 (1 for an object label and where the frame names no rule). */
|
|
17
|
+
const skyOpacity = (spec, sky) => (spec === undefined ? 1 : sky?.opacity?.(spec.id) ?? 1);
|
|
14
18
|
/** App adapter that places configured labels; the label presentation itself stays generic. */
|
|
15
19
|
export class SceneLabelLayer {
|
|
16
20
|
#root = document.createElement("div");
|
|
17
21
|
#entries;
|
|
18
22
|
#local = new Vector3();
|
|
23
|
+
#direction = new Vector3();
|
|
19
24
|
#shown = new Map();
|
|
20
25
|
/** Per object id, whether the latest layout showed it; absent when it was not a candidate (unplaced, out of reach or switched off). */
|
|
21
26
|
#lastShown = new Map();
|
|
22
|
-
|
|
27
|
+
#sky;
|
|
28
|
+
/** The colour last set on each sky label (by id), so a change of look or selection repaints only what changed. */
|
|
29
|
+
#skyColours = new Map();
|
|
30
|
+
constructor(host, objects, skyLabels = []) {
|
|
23
31
|
this.#root.className = "scene-labels";
|
|
24
|
-
|
|
32
|
+
// A sky label is an object-like entry (its id, text and colour) with a priority below every object's and a place at infinity; it joins the one layout below, so it collides and keeps its place by the same rule.
|
|
33
|
+
const asObjects = [...objects, ...skyLabels.map((spec) => ({ id: spec.id, label: spec.label, ...(spec.color === undefined ? {} : { color: spec.color }), labelPriority: SKY_LABEL_PRIORITY[spec.kind] }))];
|
|
34
|
+
this.#sky = new Map(skyLabels.map((spec) => [spec.id, spec]));
|
|
35
|
+
this.#entries = asObjects.map((object) => {
|
|
25
36
|
const element = createLabelElement(object.label, object.color, "scene-object-label");
|
|
26
37
|
element.dataset.labelId = object.id;
|
|
38
|
+
// A figure's own font and size go on its label through the same variables the viewer root sets for every label.
|
|
39
|
+
const own = this.#sky.get(object.id);
|
|
40
|
+
if (own?.font !== undefined)
|
|
41
|
+
element.style.setProperty("--label-font", own.font);
|
|
42
|
+
if (own?.sizePx !== undefined)
|
|
43
|
+
element.style.setProperty("--label-size", `${own.sizePx}px`);
|
|
27
44
|
element.hidden = true; // not shown until the first layout places it (I-108: unplaced labels all showed for a moment, so a reader could see a label the settled layout then hides)
|
|
28
45
|
this.#root.appendChild(element);
|
|
29
46
|
return { object, element };
|
|
@@ -39,8 +56,21 @@ export class SceneLabelLayer {
|
|
|
39
56
|
for (const entry of this.#entries)
|
|
40
57
|
entry.element.style.filter = entry.object.id === id && gain !== 1 ? `brightness(${gain})` : "";
|
|
41
58
|
}
|
|
42
|
-
update(positionFor, camera, widthPx, heightPx, origin, selectedObjectId, hiddenIds) {
|
|
59
|
+
update(positionFor, camera, widthPx, heightPx, origin, selectedObjectId, hiddenIds, sky) {
|
|
43
60
|
camera.updateMatrixWorld(true);
|
|
61
|
+
if (sky !== undefined) {
|
|
62
|
+
// A sky label takes its figure's own colour, else the look's; the selected figure's name takes the look's selected colour.
|
|
63
|
+
for (const entry of this.#entries) {
|
|
64
|
+
const spec = this.#sky.get(entry.object.id);
|
|
65
|
+
if (spec === undefined)
|
|
66
|
+
continue;
|
|
67
|
+
const colour = entry.object.id === selectedObjectId ? sky.selectedColor ?? sky.labelColor : spec.color ?? sky.labelColor;
|
|
68
|
+
if (this.#skyColours.get(spec.id) !== colour) {
|
|
69
|
+
this.#skyColours.set(spec.id, colour);
|
|
70
|
+
entry.element.style.setProperty("--label-color", colour);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
44
74
|
this.#shown.clear();
|
|
45
75
|
const previous = new Map(this.#lastShown);
|
|
46
76
|
this.#lastShown.clear();
|
|
@@ -49,12 +79,22 @@ export class SceneLabelLayer {
|
|
|
49
79
|
entry.element.hidden = true;
|
|
50
80
|
return [];
|
|
51
81
|
}
|
|
52
|
-
const
|
|
53
|
-
|
|
82
|
+
const spec = this.#sky.get(entry.object.id);
|
|
83
|
+
const absolute = spec === undefined ? positionFor(entry.object.id) : null;
|
|
84
|
+
const opacity = skyOpacity(spec, sky);
|
|
85
|
+
const skyShown = spec !== undefined && sky !== undefined && opacity > 0 && sky.on[spec.kind === "figure" ? "figures" : "boundaries"];
|
|
86
|
+
if (spec === undefined ? absolute === null : !skyShown) {
|
|
54
87
|
entry.element.hidden = true;
|
|
55
88
|
return [];
|
|
56
89
|
}
|
|
57
|
-
|
|
90
|
+
if (spec !== undefined)
|
|
91
|
+
entry.element.style.opacity = String(opacity);
|
|
92
|
+
// A sky label is projected from the camera's own place, at a fixed distance along its direction: it never moves with the scene, only with the camera's turn.
|
|
93
|
+
if (spec !== undefined)
|
|
94
|
+
this.#local.copy(camera.position).addScaledVector(this.#direction.fromArray(spec.direction), sky.distance);
|
|
95
|
+
else
|
|
96
|
+
this.#local.fromArray(origin.toLocal(absolute));
|
|
97
|
+
const screen = projectToScreen(this.#local, camera, widthPx, heightPx);
|
|
58
98
|
const distance = this.#local.distanceTo(camera.position);
|
|
59
99
|
const maxDistance = entry.object.labelMaxDistance ?? Number.POSITIVE_INFINITY;
|
|
60
100
|
if (screen === null || distance > maxDistance) {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Group } from "three";
|
|
2
|
+
import type { PerspectiveCamera } from "three";
|
|
3
|
+
import { type SkyColours, type SkyFigureLayer, type SkyClearRequest, type SkyLineSwitches, type SkyTraceRequest } from "./skyFigures.js";
|
|
4
|
+
import { type RenderVector } from "./renderCoordinates.js";
|
|
5
|
+
import { type PickRect, type SkyPickFigure } from "./scenePicking.js";
|
|
6
|
+
/** One label to place on the sky: its text and unit render-frame direction, the kind (the switch that shows it) and the figure's own colour, font and size when it has them (else the looks apply). */
|
|
7
|
+
export interface SkyLabelSpec {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly color?: string;
|
|
11
|
+
readonly font?: string;
|
|
12
|
+
readonly sizePx?: number;
|
|
13
|
+
readonly kind: "figure" | "boundary";
|
|
14
|
+
/** True: the label shows only while a trace of the figure runs or stays (`labelOpacity`). */
|
|
15
|
+
readonly whenTraced?: boolean;
|
|
16
|
+
readonly direction: RenderVector;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Figures, outlines and the two reference circles, drawn at infinity like the stars: the group stands on the camera every frame and is scaled to sit between the near and far planes,
|
|
20
|
+
* so only the camera's orientation matters. Carries no State (ARCH-02). The ecliptic and the equator are built the first time they are switched on.
|
|
21
|
+
*/
|
|
22
|
+
export declare class SkyFiguresView {
|
|
23
|
+
#private;
|
|
24
|
+
readonly group: Group<import("three").Object3DEventMap>;
|
|
25
|
+
readonly labels: readonly SkyLabelSpec[];
|
|
26
|
+
constructor(layers: readonly SkyFigureLayer[]);
|
|
27
|
+
/** Stands the group on the camera, sized between its planes, shows the kinds the switches say (building a reference circle the first time it shows) and paints the lines in the colours given. */
|
|
28
|
+
place(camera: PerspectiveCamera, on: Readonly<SkyLineSwitches>, colours: Readonly<SkyColours>, selectedId?: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* The figures a tap can select, as screen lines (CSS px from the canvas's top left) and the rectangle of each shown name (`labelRects` are page rectangles; `box` is the canvas's). A figure whose switch is off, or that is
|
|
31
|
+
* shown only when traced and has no trace showing, is left out. A segment is kept whenever any part of it is in front of the camera (cut at the camera plane), even with both ends off screen. Worked out when asked, not each frame.
|
|
32
|
+
*/
|
|
33
|
+
screenFigures(camera: PerspectiveCamera, widthPx: number, heightPx: number, on: Readonly<SkyLineSwitches>, labelRects: ReadonlyMap<string, PickRect> | undefined, box: {
|
|
34
|
+
readonly left: number;
|
|
35
|
+
readonly top: number;
|
|
36
|
+
}): readonly SkyPickFigure[];
|
|
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
|
+
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): void;
|
|
41
|
+
/**
|
|
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
|
+
* shows each with its figure's switch, and removes finished ones. Returns true while anything changed, so the caller wakes the draw rule.
|
|
44
|
+
*/
|
|
45
|
+
advanceTraces(deltaSeconds: number, colours: Readonly<SkyColours>, on: Readonly<SkyLineSwitches>, selectedId?: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Moves the fade-in of every kind of line on by `deltaSeconds` of real time over `seconds` (0: at once), and sets the lines' opacity; a kind whose switch is off goes back to 0 so it fades in again
|
|
48
|
+
* when it next turns on. Returns true while a fade-in is still running, so the caller wakes the draw rule.
|
|
49
|
+
*/
|
|
50
|
+
advanceFadeIn(deltaSeconds: number, seconds: number, on: Readonly<SkyLineSwitches>): boolean;
|
|
51
|
+
/** 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). */
|
|
52
|
+
labelOpacity(id: string): number;
|
|
53
|
+
/** Which lines are shown now, by name (read by tests and the canvas data). */
|
|
54
|
+
get shown(): readonly string[];
|
|
55
|
+
dispose(): void;
|
|
56
|
+
}
|