@johnmorrisdotca/wakusei-planets 0.67.0 → 0.69.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 +23 -2
- package/NOTICE.md +10 -0
- package/README.md +3 -3
- package/dist/data/moon-catalogue.d.ts +1 -1
- package/dist/data/moon-catalogue.js +1 -1
- package/dist/data/places-added.d.ts +2 -0
- package/dist/data/places-added.js +2 -0
- package/dist/data/places-aliases.d.ts +1 -0
- package/dist/data/places-aliases.js +14 -0
- package/dist/data/places-planned.js +1 -1
- package/dist/data/places-search-67p.d.ts +1 -0
- package/dist/data/places-search-67p.js +3 -0
- package/dist/data/places-search-amalthea.d.ts +1 -0
- package/dist/data/places-search-amalthea.js +3 -0
- package/dist/data/places-search-ariel.d.ts +1 -0
- package/dist/data/places-search-ariel.js +3 -0
- package/dist/data/places-search-bennu.d.ts +1 -0
- package/dist/data/places-search-bennu.js +3 -0
- package/dist/data/places-search-bodies.d.ts +25 -0
- package/dist/data/places-search-bodies.js +125 -0
- package/dist/data/places-search-callisto.d.ts +1 -0
- package/dist/data/places-search-callisto.js +3 -0
- package/dist/data/places-search-ceres.d.ts +1 -0
- package/dist/data/places-search-ceres.js +3 -0
- package/dist/data/places-search-charon.d.ts +1 -0
- package/dist/data/places-search-charon.js +3 -0
- package/dist/data/places-search-dactyl.d.ts +1 -0
- package/dist/data/places-search-dactyl.js +3 -0
- package/dist/data/places-search-deimos.d.ts +1 -0
- package/dist/data/places-search-deimos.js +3 -0
- package/dist/data/places-search-didymos.d.ts +1 -0
- package/dist/data/places-search-didymos.js +3 -0
- package/dist/data/places-search-dimorphos.d.ts +1 -0
- package/dist/data/places-search-dimorphos.js +3 -0
- package/dist/data/places-search-dinkinesh.d.ts +1 -0
- package/dist/data/places-search-dinkinesh.js +3 -0
- package/dist/data/places-search-dione.d.ts +1 -0
- package/dist/data/places-search-dione.js +3 -0
- package/dist/data/places-search-donaldjohanson.d.ts +1 -0
- package/dist/data/places-search-donaldjohanson.js +3 -0
- package/dist/data/places-search-enceladus.d.ts +1 -0
- package/dist/data/places-search-enceladus.js +3 -0
- package/dist/data/places-search-epimetheus.d.ts +1 -0
- package/dist/data/places-search-epimetheus.js +3 -0
- package/dist/data/places-search-eros.d.ts +1 -0
- package/dist/data/places-search-eros.js +3 -0
- package/dist/data/places-search-europa.d.ts +1 -0
- package/dist/data/places-search-europa.js +3 -0
- package/dist/data/places-search-ganymede.d.ts +1 -0
- package/dist/data/places-search-ganymede.js +3 -0
- package/dist/data/places-search-gaspra.d.ts +1 -0
- package/dist/data/places-search-gaspra.js +3 -0
- package/dist/data/places-search-hyperion.d.ts +1 -0
- package/dist/data/places-search-hyperion.js +3 -0
- package/dist/data/places-search-iapetus.d.ts +1 -0
- package/dist/data/places-search-iapetus.js +3 -0
- package/dist/data/places-search-ida.d.ts +1 -0
- package/dist/data/places-search-ida.js +3 -0
- package/dist/data/places-search-io.d.ts +1 -0
- package/dist/data/places-search-io.js +3 -0
- package/dist/data/places-search-itokawa.d.ts +1 -0
- package/dist/data/places-search-itokawa.js +3 -0
- package/dist/data/places-search-janus.d.ts +1 -0
- package/dist/data/places-search-janus.js +3 -0
- package/dist/data/places-search-jupiter.d.ts +1 -0
- package/dist/data/places-search-jupiter.js +3 -0
- package/dist/data/places-search-lutetia.d.ts +1 -0
- package/dist/data/places-search-lutetia.js +3 -0
- package/dist/data/places-search-mars.d.ts +1 -0
- package/dist/data/places-search-mars.js +3 -0
- package/dist/data/places-search-mathilde.d.ts +1 -0
- package/dist/data/places-search-mathilde.js +3 -0
- package/dist/data/places-search-mercury.d.ts +1 -0
- package/dist/data/places-search-mercury.js +3 -0
- package/dist/data/places-search-mimas.d.ts +1 -0
- package/dist/data/places-search-mimas.js +3 -0
- package/dist/data/places-search-miranda.d.ts +1 -0
- package/dist/data/places-search-miranda.js +3 -0
- package/dist/data/places-search-moon-satellites.d.ts +1 -0
- package/dist/data/places-search-moon-satellites.js +3 -0
- package/dist/data/places-search-moon.d.ts +1 -0
- package/dist/data/places-search-moon.js +3 -0
- package/dist/data/places-search-oberon.d.ts +1 -0
- package/dist/data/places-search-oberon.js +3 -0
- package/dist/data/places-search-phobos.d.ts +1 -0
- package/dist/data/places-search-phobos.js +3 -0
- package/dist/data/places-search-phoebe.d.ts +1 -0
- package/dist/data/places-search-phoebe.js +3 -0
- package/dist/data/places-search-pluto.d.ts +1 -0
- package/dist/data/places-search-pluto.js +3 -0
- package/dist/data/places-search-proteus.d.ts +1 -0
- package/dist/data/places-search-proteus.js +3 -0
- package/dist/data/places-search-rhea.d.ts +1 -0
- package/dist/data/places-search-rhea.js +3 -0
- package/dist/data/places-search-ryugu.d.ts +1 -0
- package/dist/data/places-search-ryugu.js +3 -0
- package/dist/data/places-search-saturn.d.ts +1 -0
- package/dist/data/places-search-saturn.js +3 -0
- package/dist/data/places-search-steins.d.ts +1 -0
- package/dist/data/places-search-steins.js +3 -0
- package/dist/data/places-search-tempel-1.d.ts +1 -0
- package/dist/data/places-search-tempel-1.js +3 -0
- package/dist/data/places-search-tethys.d.ts +1 -0
- package/dist/data/places-search-tethys.js +3 -0
- package/dist/data/places-search-thebe.d.ts +1 -0
- package/dist/data/places-search-thebe.js +3 -0
- package/dist/data/places-search-titan.d.ts +1 -0
- package/dist/data/places-search-titan.js +3 -0
- package/dist/data/places-search-titania.d.ts +1 -0
- package/dist/data/places-search-titania.js +3 -0
- package/dist/data/places-search-triton.d.ts +1 -0
- package/dist/data/places-search-triton.js +3 -0
- package/dist/data/places-search-types.d.ts +1 -0
- package/dist/data/places-search-types.js +59 -0
- package/dist/data/places-search-umbriel.d.ts +1 -0
- package/dist/data/places-search-umbriel.js +3 -0
- package/dist/data/places-search-venus.d.ts +1 -0
- package/dist/data/places-search-venus.js +3 -0
- package/dist/data/places-search-vesta.d.ts +1 -0
- package/dist/data/places-search-vesta.js +3 -0
- package/dist/earth-places.d.ts +17 -1
- package/dist/earth-places.js +18 -0
- package/dist/fact-sheets.d.ts +1 -1
- package/dist/fact-sheets.js +1 -1
- package/dist/flat/words.js +2 -0
- package/dist/moon-catalogue.d.ts +190 -0
- package/dist/moon-catalogue.js +189 -3
- package/dist/place-marks.js +1 -1
- package/dist/place-search.d.ts +179 -0
- package/dist/place-search.js +223 -0
- package/dist/places/moon.js +4 -1
- package/dist/places/search/67p.d.ts +12 -0
- package/dist/places/search/67p.js +14 -0
- package/dist/places/search/amalthea.d.ts +12 -0
- package/dist/places/search/amalthea.js +14 -0
- package/dist/places/search/ariel.d.ts +12 -0
- package/dist/places/search/ariel.js +14 -0
- package/dist/places/search/bennu.d.ts +12 -0
- package/dist/places/search/bennu.js +14 -0
- package/dist/places/search/callisto.d.ts +12 -0
- package/dist/places/search/callisto.js +14 -0
- package/dist/places/search/ceres.d.ts +12 -0
- package/dist/places/search/ceres.js +14 -0
- package/dist/places/search/charon.d.ts +12 -0
- package/dist/places/search/charon.js +14 -0
- package/dist/places/search/dactyl.d.ts +12 -0
- package/dist/places/search/dactyl.js +14 -0
- package/dist/places/search/deimos.d.ts +12 -0
- package/dist/places/search/deimos.js +14 -0
- package/dist/places/search/didymos.d.ts +12 -0
- package/dist/places/search/didymos.js +14 -0
- package/dist/places/search/dimorphos.d.ts +12 -0
- package/dist/places/search/dimorphos.js +14 -0
- package/dist/places/search/dinkinesh.d.ts +12 -0
- package/dist/places/search/dinkinesh.js +14 -0
- package/dist/places/search/dione.d.ts +12 -0
- package/dist/places/search/dione.js +14 -0
- package/dist/places/search/donaldjohanson.d.ts +12 -0
- package/dist/places/search/donaldjohanson.js +14 -0
- package/dist/places/search/enceladus.d.ts +12 -0
- package/dist/places/search/enceladus.js +14 -0
- package/dist/places/search/epimetheus.d.ts +12 -0
- package/dist/places/search/epimetheus.js +14 -0
- package/dist/places/search/eros.d.ts +12 -0
- package/dist/places/search/eros.js +14 -0
- package/dist/places/search/europa.d.ts +12 -0
- package/dist/places/search/europa.js +14 -0
- package/dist/places/search/ganymede.d.ts +12 -0
- package/dist/places/search/ganymede.js +14 -0
- package/dist/places/search/gaspra.d.ts +12 -0
- package/dist/places/search/gaspra.js +14 -0
- package/dist/places/search/hyperion.d.ts +12 -0
- package/dist/places/search/hyperion.js +14 -0
- package/dist/places/search/iapetus.d.ts +12 -0
- package/dist/places/search/iapetus.js +14 -0
- package/dist/places/search/ida.d.ts +12 -0
- package/dist/places/search/ida.js +14 -0
- package/dist/places/search/io.d.ts +12 -0
- package/dist/places/search/io.js +14 -0
- package/dist/places/search/itokawa.d.ts +12 -0
- package/dist/places/search/itokawa.js +14 -0
- package/dist/places/search/janus.d.ts +12 -0
- package/dist/places/search/janus.js +14 -0
- package/dist/places/search/jupiter.d.ts +12 -0
- package/dist/places/search/jupiter.js +14 -0
- package/dist/places/search/lutetia.d.ts +12 -0
- package/dist/places/search/lutetia.js +14 -0
- package/dist/places/search/mars.d.ts +12 -0
- package/dist/places/search/mars.js +14 -0
- package/dist/places/search/mathilde.d.ts +12 -0
- package/dist/places/search/mathilde.js +14 -0
- package/dist/places/search/mercury.d.ts +12 -0
- package/dist/places/search/mercury.js +14 -0
- package/dist/places/search/mimas.d.ts +12 -0
- package/dist/places/search/mimas.js +14 -0
- package/dist/places/search/miranda.d.ts +12 -0
- package/dist/places/search/miranda.js +14 -0
- package/dist/places/search/moon-satellites.d.ts +12 -0
- package/dist/places/search/moon-satellites.js +14 -0
- package/dist/places/search/moon.d.ts +12 -0
- package/dist/places/search/moon.js +14 -0
- package/dist/places/search/oberon.d.ts +12 -0
- package/dist/places/search/oberon.js +14 -0
- package/dist/places/search/phobos.d.ts +12 -0
- package/dist/places/search/phobos.js +14 -0
- package/dist/places/search/phoebe.d.ts +12 -0
- package/dist/places/search/phoebe.js +14 -0
- package/dist/places/search/pluto.d.ts +12 -0
- package/dist/places/search/pluto.js +14 -0
- package/dist/places/search/proteus.d.ts +12 -0
- package/dist/places/search/proteus.js +14 -0
- package/dist/places/search/rhea.d.ts +12 -0
- package/dist/places/search/rhea.js +14 -0
- package/dist/places/search/ryugu.d.ts +12 -0
- package/dist/places/search/ryugu.js +14 -0
- package/dist/places/search/saturn.d.ts +12 -0
- package/dist/places/search/saturn.js +14 -0
- package/dist/places/search/steins.d.ts +12 -0
- package/dist/places/search/steins.js +14 -0
- package/dist/places/search/tempel-1.d.ts +12 -0
- package/dist/places/search/tempel-1.js +14 -0
- package/dist/places/search/tethys.d.ts +12 -0
- package/dist/places/search/tethys.js +14 -0
- package/dist/places/search/thebe.d.ts +12 -0
- package/dist/places/search/thebe.js +14 -0
- package/dist/places/search/titan.d.ts +12 -0
- package/dist/places/search/titan.js +14 -0
- package/dist/places/search/titania.d.ts +12 -0
- package/dist/places/search/titania.js +14 -0
- package/dist/places/search/triton.d.ts +12 -0
- package/dist/places/search/triton.js +14 -0
- package/dist/places/search/umbriel.d.ts +12 -0
- package/dist/places/search/umbriel.js +14 -0
- package/dist/places/search/venus.d.ts +12 -0
- package/dist/places/search/venus.js +14 -0
- package/dist/places/search/vesta.d.ts +12 -0
- package/dist/places/search/vesta.js +14 -0
- package/dist/places/search.d.ts +42 -0
- package/dist/places/search.js +77 -0
- package/dist/places.d.ts +4 -3
- package/dist/scene/body-places.d.ts +98 -0
- package/dist/scene/body-places.js +113 -0
- package/dist/scene/earth-places.d.ts +6 -1
- package/dist/scene/earth-places.js +55 -2
- package/dist/scene/place-layer.js +1 -0
- package/dist/space/all-moons.d.ts +81 -10
- package/dist/space/all-moons.js +132 -27
- package/dist/space/element.d.ts +56 -5
- package/dist/space/element.js +240 -24
- package/dist/space/moon-settings.d.ts +25 -0
- package/dist/space/moon-settings.js +43 -0
- package/dist/space/orbit-rules.d.ts +25 -0
- package/dist/space/orbit-rules.js +36 -0
- package/dist/space/scene.d.ts +14 -3
- package/dist/space/scene.js +48 -17
- package/package.json +271 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// The places laid on any body in `<wakusei-space>`: a reader's own place and the places they keep on the Moon, Mars or any other body the view draws, each a marker standing out of the ground, the same one `earth-places` draws on the Earth.
|
|
2
|
+
// The layout is chikyu-earth's (handed in by `@johnmorrisdotca/wakusei-planets/earth-places`, an optional peer this file never imports): its `layoutPlaces` works on any body's picture, so here is only what is about bodies: the list
|
|
3
|
+
// keyed by body, reading it, and laying the lists of several bodies in one draw. Pure: no DOM, no clock reads.
|
|
4
|
+
import { BODIES } from "../facts.js";
|
|
5
|
+
import { pointUnder, spotView } from "../place-marks.js";
|
|
6
|
+
import { EARTH_PLACE_MARKS, EARTH_PLACES_FROM_PX } from "./earth-places.js";
|
|
7
|
+
/** The most places kept from a list, as `earth-places` keeps. */
|
|
8
|
+
export const BODY_PLACES_KEPT = 5000;
|
|
9
|
+
/**
|
|
10
|
+
* Read the text of the `body-places` attribute (a JSON array) as the list the view draws. Each entry needs a `body` (lower case letters, digits and hyphens, not `earth`) and what an `earth-places` entry needs: they are grouped by body and each group
|
|
11
|
+
* is read by chikyu-earth's own reader, so a longitude from -180 to 180, a latitude from -90 to 90, a label of 80 letters at most, `here` or `favourite` and a safe colour mean the same here. An entry that fails is left out; a text that is not a list is no list.
|
|
12
|
+
*
|
|
13
|
+
* @param value - The attribute's text, or null.
|
|
14
|
+
* @param read - chikyu-earth's `readPlaces`: the text of one body's list to the places to draw.
|
|
15
|
+
* @returns The places, bodies in the order they first appear, at most 5,000.
|
|
16
|
+
*/
|
|
17
|
+
export function readBodyPlacesWith(value, read) {
|
|
18
|
+
if (typeof value !== "string" || value === "")
|
|
19
|
+
return [];
|
|
20
|
+
let parsed;
|
|
21
|
+
try {
|
|
22
|
+
parsed = JSON.parse(value);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
if (!Array.isArray(parsed))
|
|
28
|
+
return [];
|
|
29
|
+
const groups = new Map();
|
|
30
|
+
for (const entry of parsed) {
|
|
31
|
+
if (typeof entry !== "object" || entry === null)
|
|
32
|
+
continue;
|
|
33
|
+
const body = entry.body;
|
|
34
|
+
if (typeof body !== "string" || !/^[a-z0-9-]{1,40}$/.test(body) || body === "earth")
|
|
35
|
+
continue;
|
|
36
|
+
const rest = { ...entry };
|
|
37
|
+
delete rest["body"];
|
|
38
|
+
const group = groups.get(body);
|
|
39
|
+
if (group === undefined)
|
|
40
|
+
groups.set(body, [rest]);
|
|
41
|
+
else
|
|
42
|
+
group.push(rest);
|
|
43
|
+
}
|
|
44
|
+
const out = [];
|
|
45
|
+
for (const [body, group] of groups)
|
|
46
|
+
for (const place of read(JSON.stringify(group)))
|
|
47
|
+
out.push({ ...place, body });
|
|
48
|
+
return out.slice(0, BODY_PLACES_KEPT);
|
|
49
|
+
}
|
|
50
|
+
/** The bodies a list has places on, in the order they first appear. */
|
|
51
|
+
export const bodiesOf = (places) => [...new Set(places.map((place) => place.body))];
|
|
52
|
+
/** The body's shape as the places lie on it: its three axes where it has them, else its flattening, as the marks of `places` do. */
|
|
53
|
+
export function bodyScale(id) {
|
|
54
|
+
const facts = BODIES[id];
|
|
55
|
+
if (facts === undefined)
|
|
56
|
+
return undefined;
|
|
57
|
+
const ax = facts.axesKm;
|
|
58
|
+
return ax ? [ax[1] / facts.radiusKm, ax[2] / facts.radiusKm, ax[0] / facts.radiusKm] : [1, 1 - facts.flattening, 1];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Lay the places of every body in sight in one go: for each body of `surfaces` with places in the list, big enough on the screen (`EARTH_PLACES_FROM_PX` CSS pixels of radius) and not covered, chikyu-earth's layout on that body's picture, names keeping
|
|
62
|
+
* clear of each other across bodies. The markers of `here` places come first, then the rest in the order given, and only the first `marks` stand up; the rest are counted in `omitted`.
|
|
63
|
+
*
|
|
64
|
+
* @param places - The places, as `readBodyPlaces` makes them.
|
|
65
|
+
* @param surfaces - The bodies as the last draw left them.
|
|
66
|
+
* @param using - chikyu-earth's reading and layout.
|
|
67
|
+
* @param look - `beam`, `pin` or `ring`.
|
|
68
|
+
* @param options - The width of a name, the boxes in use and which bodies are covered.
|
|
69
|
+
* @returns The places the shapes index, the layout of all of them, and how many were left out for the limit.
|
|
70
|
+
*/
|
|
71
|
+
export function layBodyPlaces(places, surfaces, using, look, options) {
|
|
72
|
+
const merged = [];
|
|
73
|
+
const shapes = [];
|
|
74
|
+
const labels = [];
|
|
75
|
+
const taken = [...options.taken];
|
|
76
|
+
for (const surface of surfaces) {
|
|
77
|
+
if (!(surface.radiusPx >= EARTH_PLACES_FROM_PX) || options.covered?.(surface.id) === true)
|
|
78
|
+
continue;
|
|
79
|
+
const scale = bodyScale(surface.id);
|
|
80
|
+
if (scale === undefined)
|
|
81
|
+
continue;
|
|
82
|
+
// the places that matter most first: where the reader is, then the rest in the order given
|
|
83
|
+
const here = places.filter((place) => place.body === surface.id);
|
|
84
|
+
const mine = [...here.filter((place) => place.kind === "here"), ...here.filter((place) => place.kind !== "here")];
|
|
85
|
+
if (mine.length === 0)
|
|
86
|
+
continue;
|
|
87
|
+
const view = spotView({ ...surface, scale });
|
|
88
|
+
const sun = surface.sun === null ? null : pointUnder(surface.sun, surface.pole, surface.meridian);
|
|
89
|
+
const layoutOptions = {
|
|
90
|
+
size: (place) => (place.label === undefined ? null : { width: options.width(place.label), height: 18 }),
|
|
91
|
+
taken,
|
|
92
|
+
sun,
|
|
93
|
+
};
|
|
94
|
+
const laid = using.layout(mine, view, look, layoutOptions);
|
|
95
|
+
const offset = merged.length;
|
|
96
|
+
merged.push(...mine);
|
|
97
|
+
for (const shape of laid.shapes)
|
|
98
|
+
shapes.push({ ...shape, index: shape.index + offset });
|
|
99
|
+
for (const spot of laid.labels) {
|
|
100
|
+
labels.push({ ...spot, index: spot.index + offset });
|
|
101
|
+
const label = mine[spot.index]?.label;
|
|
102
|
+
if (label !== undefined)
|
|
103
|
+
taken.push({ left: spot.left, top: spot.top, width: options.width(label), height: 18 });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// the places of the reader come first on every body, then the others; the first few in sight stand up and the rest are counted, never silently left out
|
|
107
|
+
const rank = (shape) => (merged[shape.index]?.kind === "here" ? 0 : 1);
|
|
108
|
+
const ordered = shapes.map((shape, i) => ({ shape, i })).sort((a, b) => rank(a.shape) - rank(b.shape) || a.i - b.i).map((entry) => entry.shape);
|
|
109
|
+
const limit = options.marks ?? EARTH_PLACE_MARKS;
|
|
110
|
+
const kept = ordered.slice(0, limit);
|
|
111
|
+
const keptLabels = labels.filter((spot) => kept.some((shape) => shape.index === spot.index));
|
|
112
|
+
return { places: merged, layout: { shapes: kept, labels: keptLabels }, omitted: ordered.length - kept.length };
|
|
113
|
+
}
|
|
@@ -169,6 +169,8 @@ export interface EarthPlaceMark {
|
|
|
169
169
|
x: number;
|
|
170
170
|
y: number;
|
|
171
171
|
named: boolean;
|
|
172
|
+
/** For a place on a body other than the Earth (`body-places`): the body. */
|
|
173
|
+
body?: string;
|
|
172
174
|
}
|
|
173
175
|
/** The markers over one view. */
|
|
174
176
|
export interface EarthPlaceLayerView {
|
|
@@ -185,6 +187,9 @@ export interface EarthPlaceLayerView {
|
|
|
185
187
|
* Make the layer of markers inside a view's shadow root, above its picture. It holds a handful of elements made once and kept; a draw only writes the numbers that changed.
|
|
186
188
|
*
|
|
187
189
|
* @param root - The view's shadow root.
|
|
190
|
+
* @param options - `press`, called with the mark and the pointer event when a press that did not move ends over a drawn name or a foot ring (the layer itself takes no pointer: a press on it goes on to the view's controls, as a name on a body's surface does).
|
|
188
191
|
* @returns The layer.
|
|
189
192
|
*/
|
|
190
|
-
export declare function createEarthPlaceLayer(root: ShadowRoot
|
|
193
|
+
export declare function createEarthPlaceLayer(root: ShadowRoot, options?: {
|
|
194
|
+
press?: (mark: EarthPlaceMark, event: PointerEvent) => void;
|
|
195
|
+
}): EarthPlaceLayerView;
|
|
@@ -52,9 +52,10 @@ const STYLE = `.wk-eplaces{position:absolute;inset:0;pointer-events:none;overflo
|
|
|
52
52
|
* Make the layer of markers inside a view's shadow root, above its picture. It holds a handful of elements made once and kept; a draw only writes the numbers that changed.
|
|
53
53
|
*
|
|
54
54
|
* @param root - The view's shadow root.
|
|
55
|
+
* @param options - `press`, called with the mark and the pointer event when a press that did not move ends over a drawn name or a foot ring (the layer itself takes no pointer: a press on it goes on to the view's controls, as a name on a body's surface does).
|
|
55
56
|
* @returns The layer.
|
|
56
57
|
*/
|
|
57
|
-
export function createEarthPlaceLayer(root) {
|
|
58
|
+
export function createEarthPlaceLayer(root, options = {}) {
|
|
58
59
|
const style = document.createElement("style");
|
|
59
60
|
style.textContent = STYLE;
|
|
60
61
|
const box = document.createElement("div");
|
|
@@ -73,6 +74,8 @@ export function createEarthPlaceLayer(root) {
|
|
|
73
74
|
let context;
|
|
74
75
|
const pool = [];
|
|
75
76
|
let shown = [];
|
|
77
|
+
// what is on the screen to press: each drawn mark with its parts and how strongly it shows
|
|
78
|
+
let live = [];
|
|
76
79
|
const item = (i) => {
|
|
77
80
|
let it = pool[i];
|
|
78
81
|
if (it === undefined) {
|
|
@@ -101,10 +104,50 @@ export function createEarthPlaceLayer(root) {
|
|
|
101
104
|
el.setAttribute(name, value);
|
|
102
105
|
};
|
|
103
106
|
const n = (value) => String(Math.round(value * 10) / 10);
|
|
107
|
+
// press: the layer takes no pointer (a press on it goes on to the view's controls, which turn the view), so a press that did not move and ends over a drawn name or a foot ring is the mark's, found here as the marks of
|
|
108
|
+
// a body's surface find a written name. The nearest of the marks whose name's box or ring's box holds the point wins; a mark that is fading out (under a fifth of its strength) cannot be pressed.
|
|
109
|
+
const host = root.host;
|
|
110
|
+
let pressed = null;
|
|
111
|
+
const down = (event) => {
|
|
112
|
+
pressed = event.button === 0 && event.composedPath().includes(host) ? { x: event.clientX, y: event.clientY, id: event.pointerId } : null;
|
|
113
|
+
};
|
|
114
|
+
const up = (event) => {
|
|
115
|
+
const start = pressed;
|
|
116
|
+
pressed = null;
|
|
117
|
+
if (start === null || start.id !== event.pointerId || live.length === 0 || options.press === undefined || Math.hypot(event.clientX - start.x, event.clientY - start.y) > 6)
|
|
118
|
+
return;
|
|
119
|
+
let best;
|
|
120
|
+
for (const entry of live) {
|
|
121
|
+
if (entry.opacity < 0.2)
|
|
122
|
+
continue;
|
|
123
|
+
for (const part of [entry.it.name.hidden ? null : entry.it.name, entry.it.ring.style.display === "none" ? null : entry.it.ring]) {
|
|
124
|
+
if (part === null)
|
|
125
|
+
continue;
|
|
126
|
+
const r = part.getBoundingClientRect();
|
|
127
|
+
const pad = part === entry.it.name ? 0 : 6;
|
|
128
|
+
if (event.clientX < r.left - pad || event.clientX > r.right + pad || event.clientY < r.top - pad || event.clientY > r.bottom + pad)
|
|
129
|
+
continue;
|
|
130
|
+
const away = Math.hypot(event.clientX - (r.left + r.right) / 2, event.clientY - (r.top + r.bottom) / 2);
|
|
131
|
+
if (best === undefined || away < best.away)
|
|
132
|
+
best = { mark: entry.mark, away };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (best !== undefined)
|
|
136
|
+
options.press(best.mark, event);
|
|
137
|
+
};
|
|
138
|
+
const cancel = () => {
|
|
139
|
+
pressed = null;
|
|
140
|
+
};
|
|
141
|
+
if (options.press !== undefined) {
|
|
142
|
+
window.addEventListener("pointerdown", down, true);
|
|
143
|
+
window.addEventListener("pointerup", up, true);
|
|
144
|
+
window.addEventListener("pointercancel", cancel, true);
|
|
145
|
+
}
|
|
104
146
|
return {
|
|
105
147
|
set(places, layout, look) {
|
|
106
148
|
const named = new Map(layout.labels.map((spot) => [spot.index, spot]));
|
|
107
149
|
shown = [];
|
|
150
|
+
live = [];
|
|
108
151
|
for (const [i, shape] of layout.shapes.entries()) {
|
|
109
152
|
const place = places[shape.index];
|
|
110
153
|
const it = item(i);
|
|
@@ -147,7 +190,12 @@ export function createEarthPlaceLayer(root) {
|
|
|
147
190
|
}
|
|
148
191
|
else
|
|
149
192
|
it.name.hidden = true;
|
|
150
|
-
|
|
193
|
+
const mark = { id: place.id, kind: here ? "here" : "favourite", x: shape.x, y: shape.y, named: spot !== undefined };
|
|
194
|
+
const body = place.body;
|
|
195
|
+
if (body !== undefined)
|
|
196
|
+
mark.body = body;
|
|
197
|
+
shown.push(mark);
|
|
198
|
+
live.push({ mark, it, opacity: shape.opacity * dim });
|
|
151
199
|
}
|
|
152
200
|
for (let i = layout.shapes.length; i < pool.length; i += 1) {
|
|
153
201
|
const it = pool[i];
|
|
@@ -161,6 +209,7 @@ export function createEarthPlaceLayer(root) {
|
|
|
161
209
|
it.name.hidden = true;
|
|
162
210
|
}
|
|
163
211
|
shown = [];
|
|
212
|
+
live = [];
|
|
164
213
|
},
|
|
165
214
|
width(text) {
|
|
166
215
|
const known = widths.get(text);
|
|
@@ -181,10 +230,14 @@ export function createEarthPlaceLayer(root) {
|
|
|
181
230
|
return shown;
|
|
182
231
|
},
|
|
183
232
|
dispose() {
|
|
233
|
+
window.removeEventListener("pointerdown", down, true);
|
|
234
|
+
window.removeEventListener("pointerup", up, true);
|
|
235
|
+
window.removeEventListener("pointercancel", cancel, true);
|
|
184
236
|
box.remove();
|
|
185
237
|
style.remove();
|
|
186
238
|
pool.length = 0;
|
|
187
239
|
shown = [];
|
|
240
|
+
live = [];
|
|
188
241
|
},
|
|
189
242
|
};
|
|
190
243
|
}
|
|
@@ -29,6 +29,7 @@ const KIND_WORD = {
|
|
|
29
29
|
entry: { en: "lost in the atmosphere", ja: "大気圏で消失" },
|
|
30
30
|
planned: { en: "planned landing", ja: "着陸予定" },
|
|
31
31
|
feature: { en: "feature", ja: "地形" },
|
|
32
|
+
hardware: { en: "hardware", ja: "機器・部品" },
|
|
32
33
|
};
|
|
33
34
|
/**
|
|
34
35
|
* The short line under a place's name: what it is and when (a site's year, a planned landing's announced year, a feature's kind and size), in English or Japanese.
|
|
@@ -2,22 +2,92 @@ import type * as THREE from "three";
|
|
|
2
2
|
import { type Vec3 } from "../vec.ts";
|
|
3
3
|
import type { SpaceDwarf, SpacePlanet } from "./frame.ts";
|
|
4
4
|
import { type ScaleMode } from "./scale.ts";
|
|
5
|
-
/** The parts of three.js the dots use, over and above the ones every body needs. */
|
|
6
|
-
export type DotsThree = Pick<typeof THREE, "BufferAttribute" | "BufferGeometry" | "Points" | "PointsMaterial">;
|
|
5
|
+
/** The parts of three.js the dots and the orbits use, over and above the ones every body needs. */
|
|
6
|
+
export type DotsThree = Pick<typeof THREE, "BufferAttribute" | "BufferGeometry" | "Points" | "PointsMaterial" | "LineSegments" | "LineBasicMaterial">;
|
|
7
|
+
type Host = SpacePlanet | SpaceDwarf;
|
|
7
8
|
/** One moon to draw as a dot: its planet, and where it is from the planet's centre in kilometres, in the J2000 ecliptic frame (what `catalogueMoonPosition` gives). */
|
|
8
9
|
export interface MoonDot {
|
|
9
|
-
host:
|
|
10
|
+
host: Host;
|
|
10
11
|
km: Vec3;
|
|
11
12
|
}
|
|
12
|
-
/**
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
/** What `moons-colors` says an orbit's colour means: the moon's family, or the way it goes round. */
|
|
14
|
+
export type MoonColorChoice = "group" | "direction";
|
|
15
|
+
/** A moon of the catalogue as the layer needs it, without the catalogue's rows: the element makes these from the chunk, so this file never imports it. */
|
|
16
|
+
export interface SourceMoon {
|
|
17
|
+
/** The catalogue's id (`himalia`). */
|
|
18
|
+
id: string;
|
|
19
|
+
/** What to print: the name, else the designation. */
|
|
20
|
+
label: string;
|
|
21
|
+
/** The Japanese name, where one is written down. */
|
|
22
|
+
ja: string | null;
|
|
23
|
+
host: Host;
|
|
24
|
+
/** Whether the view draws it in full: then it is a body, not a dot, and only its orbit is drawn here. */
|
|
25
|
+
full: boolean;
|
|
26
|
+
/** `#rrggbb` of its orbit by group and by direction. */
|
|
27
|
+
colors: Readonly<Record<MoonColorChoice, string>>;
|
|
28
|
+
}
|
|
29
|
+
/** The catalogue as a source of places and orbits. */
|
|
30
|
+
export interface MoonSource {
|
|
31
|
+
/** The moons with an orbit, of every host. */
|
|
32
|
+
moons: readonly SourceMoon[];
|
|
33
|
+
/** Where a moon is at a moment, kilometres from its planet's centre, J2000 ecliptic. */
|
|
34
|
+
position(moon: SourceMoon, ms: number): Vec3;
|
|
35
|
+
/** A closed line of the orbit a moon follows at a moment, in the same frame and unit. */
|
|
36
|
+
orbit(moon: SourceMoon, ms: number, points: number): Vec3[];
|
|
37
|
+
}
|
|
38
|
+
/** A dot's place on the screen, for a press. */
|
|
39
|
+
export interface MoonSpot {
|
|
40
|
+
id: string;
|
|
41
|
+
host: Host;
|
|
42
|
+
x: number;
|
|
43
|
+
y: number;
|
|
44
|
+
}
|
|
45
|
+
/** What one draw of the layer is given. */
|
|
46
|
+
export interface MoonLayerInput {
|
|
47
|
+
source: MoonSource;
|
|
48
|
+
/** The planets whose moons are all shown. */
|
|
49
|
+
hosts: ReadonlySet<string>;
|
|
50
|
+
by: MoonColorChoice;
|
|
51
|
+
mode: ScaleMode;
|
|
52
|
+
/** The view's moment, in milliseconds since 1970 (UTC). */
|
|
53
|
+
time: number;
|
|
54
|
+
/** Whether the view draws orbit lines at all (the attribute `orbits`). */
|
|
55
|
+
orbits: boolean;
|
|
56
|
+
at: (host: Host) => Vec3;
|
|
57
|
+
radius: (host: Host) => number;
|
|
58
|
+
ratio: number;
|
|
59
|
+
/** The screen place of a point of the scene, or `null` off the screen or behind the camera. */
|
|
60
|
+
spot: (point: Vec3) => {
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
} | null;
|
|
64
|
+
}
|
|
65
|
+
/** What a draw drew. */
|
|
66
|
+
export interface MoonLayerDrawn {
|
|
67
|
+
dots: number;
|
|
68
|
+
/** The orbits drawn. */
|
|
69
|
+
orbits: number;
|
|
70
|
+
/** The dots that are on the screen, for a press. */
|
|
71
|
+
spots: MoonSpot[];
|
|
72
|
+
}
|
|
73
|
+
/** The dots and the orbits of the view. */
|
|
74
|
+
export interface MoonLayer {
|
|
75
|
+
update(input: MoonLayerInput): MoonLayerDrawn;
|
|
76
|
+
/** The moons whose orbits a planet's `LineSegments` holds, in order, each with how many segments it has: segment number n of the object belongs to the moon where the running total passes n. For a hover on a line. */
|
|
77
|
+
orbitMoons(host: string): readonly {
|
|
78
|
+
id: string;
|
|
79
|
+
segments: number;
|
|
80
|
+
}[];
|
|
17
81
|
dispose(): void;
|
|
18
82
|
}
|
|
19
83
|
/** The most dots drawn: more than every known moon, with room for the years of finds to come. */
|
|
20
84
|
export declare const MAX_MOON_DOTS = 1024;
|
|
85
|
+
/** The opacity of every orbit line, set here and nowhere else. */
|
|
86
|
+
export declare const MOON_ORBIT_OPACITY = 0.6;
|
|
87
|
+
/** How many points go round an orbit. */
|
|
88
|
+
export declare const MOON_ORBIT_POINTS = 72;
|
|
89
|
+
/** An orbit is drawn again when the view's moment is this far from the one it was drawn for: the orbits of the irregular moons turn over years. */
|
|
90
|
+
export declare const MOON_ORBIT_KEEP_MS: number;
|
|
21
91
|
/**
|
|
22
92
|
* Where the view draws a moon of the catalogue: its place from the planet in the planet's radii, turned into the scene's axes and drawn nearer in a compressed view (the same mapping as the drawn moons).
|
|
23
93
|
*
|
|
@@ -26,5 +96,6 @@ export declare const MAX_MOON_DOTS = 1024;
|
|
|
26
96
|
* @returns The offset from the planet's centre, in the planet's radii, in the scene's axes.
|
|
27
97
|
*/
|
|
28
98
|
export declare function moonDotOffset(mode: ScaleMode, dot: MoonDot): Vec3;
|
|
29
|
-
/** The dots,
|
|
30
|
-
export declare function
|
|
99
|
+
/** The dots and the orbits, each a draw that is hidden until it has something to show. */
|
|
100
|
+
export declare function createMoonLayer(T: DotsThree, parent: THREE.Object3D): MoonLayer;
|
|
101
|
+
export {};
|
package/dist/space/all-moons.js
CHANGED
|
@@ -5,10 +5,21 @@ import { moonDistance } from "./scale.js";
|
|
|
5
5
|
export const MAX_MOON_DOTS = 1024;
|
|
6
6
|
/** A dot's size, in CSS pixels across. */
|
|
7
7
|
const DOT_PX = 3;
|
|
8
|
+
/** The opacity of every orbit line, set here and nowhere else. */
|
|
9
|
+
export const MOON_ORBIT_OPACITY = 0.6;
|
|
10
|
+
/** How many points go round an orbit. */
|
|
11
|
+
export const MOON_ORBIT_POINTS = 72;
|
|
12
|
+
/** An orbit is drawn again when the view's moment is this far from the one it was drawn for: the orbits of the irregular moons turn over years. */
|
|
13
|
+
export const MOON_ORBIT_KEEP_MS = 20 * 86_400_000;
|
|
8
14
|
const C = Math.cos(OBLIQUITY * RAD);
|
|
9
15
|
const S = Math.sin(OBLIQUITY * RAD);
|
|
10
16
|
/** An ecliptic J2000 vector in the scene's axes (equatorial, y to the celestial north pole), as `moonOffset` turns a moon's. */
|
|
11
17
|
const toScene = (v) => [v[0], v[1] * S + v[2] * C, -(v[1] * C - v[2] * S)];
|
|
18
|
+
/** `#rrggbb` as three numbers from 0 to 1. */
|
|
19
|
+
const rgb = (hex) => {
|
|
20
|
+
const n = Number.parseInt(hex.slice(1), 16);
|
|
21
|
+
return [((n >> 16) & 255) / 255, ((n >> 8) & 255) / 255, (n & 255) / 255];
|
|
22
|
+
};
|
|
12
23
|
/**
|
|
13
24
|
* Where the view draws a moon of the catalogue: its place from the planet in the planet's radii, turned into the scene's axes and drawn nearer in a compressed view (the same mapping as the drawn moons).
|
|
14
25
|
*
|
|
@@ -23,39 +34,133 @@ export function moonDotOffset(mode, dot) {
|
|
|
23
34
|
const k = d === 0 ? 1 : moonDistance(mode, dot.host, d) / d;
|
|
24
35
|
return [v[0] * k, v[1] * k, v[2] * k];
|
|
25
36
|
}
|
|
26
|
-
/** The dots,
|
|
27
|
-
export function
|
|
37
|
+
/** The dots and the orbits, each a draw that is hidden until it has something to show. */
|
|
38
|
+
export function createMoonLayer(T, parent) {
|
|
39
|
+
// the dots: one `Points` for every host
|
|
28
40
|
const positions = new Float32Array(MAX_MOON_DOTS * 3);
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
const colors = new Float32Array(MAX_MOON_DOTS * 3);
|
|
42
|
+
const dotGeometry = new T.BufferGeometry();
|
|
43
|
+
const dotPositions = new T.BufferAttribute(positions, 3);
|
|
44
|
+
const dotColors = new T.BufferAttribute(colors, 3);
|
|
45
|
+
dotGeometry.setAttribute("position", dotPositions);
|
|
46
|
+
dotGeometry.setAttribute("color", dotColors);
|
|
47
|
+
dotGeometry.setDrawRange(0, 0);
|
|
48
|
+
const dotMaterial = new T.PointsMaterial({ color: 0xffffff, vertexColors: true, size: DOT_PX, sizeAttenuation: false, transparent: true, opacity: 0.9, depthWrite: false });
|
|
49
|
+
const dots = new T.Points(dotGeometry, dotMaterial);
|
|
50
|
+
dots.frustumCulled = false;
|
|
51
|
+
dots.visible = false;
|
|
52
|
+
parent.add(dots);
|
|
53
|
+
// the orbits: one `LineSegments` for each host, in the planet's radii round the planet's centre, moved and scaled with it
|
|
54
|
+
const lineMaterial = new T.LineBasicMaterial({ vertexColors: true, transparent: true, opacity: MOON_ORBIT_OPACITY, depthWrite: false });
|
|
55
|
+
const lines = new Map();
|
|
56
|
+
let built = null;
|
|
57
|
+
const orbitsKey = (input) => `${input.mode}|${input.by}|${[...input.hosts].sort().join(",")}`;
|
|
58
|
+
// draws the orbits again: for the scale, the colours, the planets chosen or a month's turning
|
|
59
|
+
const build = (input) => {
|
|
60
|
+
let total = 0;
|
|
61
|
+
for (const entry of lines.values())
|
|
62
|
+
entry.object.visible = false;
|
|
63
|
+
for (const host of input.hosts) {
|
|
64
|
+
const rings = [];
|
|
65
|
+
for (const moon of input.source.moons) {
|
|
66
|
+
if (moon.host !== host || moon.id === "moon")
|
|
67
|
+
continue;
|
|
68
|
+
const points = input.source.orbit(moon, input.time, MOON_ORBIT_POINTS);
|
|
69
|
+
if (points.length > 1)
|
|
70
|
+
rings.push({ moon, points });
|
|
71
|
+
}
|
|
72
|
+
const segments = rings.reduce((sum, ring) => sum + ring.points.length - 1, 0);
|
|
73
|
+
const array = new Float32Array(segments * 6);
|
|
74
|
+
const tint = new Float32Array(segments * 6);
|
|
75
|
+
let k = 0;
|
|
76
|
+
for (const { moon, points } of rings) {
|
|
77
|
+
const c = rgb(moon.colors[input.by]);
|
|
78
|
+
const offsets = points.map((km) => moonDotOffset(input.mode, { host: moon.host, km }));
|
|
79
|
+
for (let i = 0; i + 1 < offsets.length; i += 1) {
|
|
80
|
+
for (const v of [offsets[i], offsets[i + 1]]) {
|
|
81
|
+
array.set(v, k * 3);
|
|
82
|
+
tint.set(c, k * 3);
|
|
83
|
+
k += 1;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
let entry = lines.get(host);
|
|
88
|
+
if (entry === undefined) {
|
|
89
|
+
const geometry = new T.BufferGeometry();
|
|
90
|
+
const object = new T.LineSegments(geometry, lineMaterial);
|
|
91
|
+
object.frustumCulled = false;
|
|
92
|
+
entry = { object, geometry, count: 0, moons: [] };
|
|
93
|
+
lines.set(host, entry);
|
|
94
|
+
parent.add(object);
|
|
95
|
+
}
|
|
96
|
+
entry.geometry.setAttribute("position", new T.BufferAttribute(array, 3));
|
|
97
|
+
entry.geometry.setAttribute("color", new T.BufferAttribute(tint, 3));
|
|
98
|
+
entry.count = rings.length;
|
|
99
|
+
entry.moons = rings.map((ring) => ({ id: ring.moon.id, segments: ring.points.length - 1 }));
|
|
100
|
+
total += rings.length;
|
|
101
|
+
}
|
|
102
|
+
built = { source: input.source, key: orbitsKey(input), time: input.time };
|
|
103
|
+
return total;
|
|
104
|
+
};
|
|
37
105
|
return {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
106
|
+
update(input) {
|
|
107
|
+
const wanted = input.orbits && input.hosts.size > 0;
|
|
108
|
+
// the orbits
|
|
109
|
+
let orbitsDrawn = 0;
|
|
110
|
+
if (wanted) {
|
|
111
|
+
if (built === null || built.source !== input.source || built.key !== orbitsKey(input) || Math.abs(input.time - built.time) > MOON_ORBIT_KEEP_MS)
|
|
112
|
+
build(input);
|
|
113
|
+
for (const [host, entry] of lines) {
|
|
114
|
+
const on = input.hosts.has(host);
|
|
115
|
+
entry.object.visible = on;
|
|
116
|
+
if (!on)
|
|
117
|
+
continue;
|
|
118
|
+
const c = input.at(host);
|
|
119
|
+
entry.object.position.set(c[0], c[1], c[2]);
|
|
120
|
+
entry.object.scale.setScalar(input.radius(host));
|
|
121
|
+
orbitsDrawn += entry.count;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else
|
|
125
|
+
for (const entry of lines.values())
|
|
126
|
+
entry.object.visible = false;
|
|
127
|
+
// the dots, of the moons the view does not draw in full, in the planets chosen
|
|
128
|
+
const shown = input.hosts.size === 0 ? [] : input.source.moons.filter((m) => !m.full && input.hosts.has(m.host));
|
|
129
|
+
const count = Math.min(MAX_MOON_DOTS, shown.length);
|
|
130
|
+
const spots = [];
|
|
41
131
|
for (let k = 0; k < count; k += 1) {
|
|
42
|
-
const
|
|
43
|
-
const o = moonDotOffset(mode,
|
|
44
|
-
const c = at(
|
|
45
|
-
const r = radius(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
132
|
+
const moon = shown[k];
|
|
133
|
+
const o = moonDotOffset(input.mode, { host: moon.host, km: input.source.position(moon, input.time) });
|
|
134
|
+
const c = input.at(moon.host);
|
|
135
|
+
const r = input.radius(moon.host);
|
|
136
|
+
const x = c[0] + o[0] * r;
|
|
137
|
+
const y = c[1] + o[1] * r;
|
|
138
|
+
const z = c[2] + o[2] * r;
|
|
139
|
+
positions[k * 3] = x;
|
|
140
|
+
positions[k * 3 + 1] = y;
|
|
141
|
+
positions[k * 3 + 2] = z;
|
|
142
|
+
colors.set(rgb(moon.colors[input.by]), k * 3);
|
|
143
|
+
const spot = input.spot([x, y, z]);
|
|
144
|
+
if (spot !== null)
|
|
145
|
+
spots.push({ id: moon.id, host: moon.host, x: spot.x, y: spot.y });
|
|
49
146
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
147
|
+
dotPositions.needsUpdate = true;
|
|
148
|
+
dotColors.needsUpdate = true;
|
|
149
|
+
dotGeometry.setDrawRange(0, count);
|
|
150
|
+
dotMaterial.size = DOT_PX * input.ratio;
|
|
151
|
+
dots.visible = count > 0;
|
|
152
|
+
return { dots: count, orbits: orbitsDrawn, spots };
|
|
55
153
|
},
|
|
154
|
+
orbitMoons: (host) => lines.get(host)?.moons ?? [],
|
|
56
155
|
dispose() {
|
|
57
|
-
|
|
58
|
-
|
|
156
|
+
parent.remove(dots);
|
|
157
|
+
for (const entry of lines.values())
|
|
158
|
+
parent.remove(entry.object);
|
|
159
|
+
dotGeometry.dispose();
|
|
160
|
+
dotMaterial.dispose();
|
|
161
|
+
lineMaterial.dispose();
|
|
162
|
+
for (const entry of lines.values())
|
|
163
|
+
entry.geometry.dispose();
|
|
59
164
|
},
|
|
60
165
|
};
|
|
61
166
|
}
|