@johnmorrisdotca/chikyu-earth 0.46.6 → 0.48.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +3 -3
  3. package/dist/beam/layer.d.ts +1 -1
  4. package/dist/markers/place-layer.d.ts +4 -0
  5. package/dist/markers/place-layer.js +20 -6
  6. package/dist/place/index.d.ts +230 -0
  7. package/dist/place/index.js +183 -0
  8. package/dist/place/land.d.ts +30 -0
  9. package/dist/place/land.js +177 -0
  10. package/dist/place/water.d.ts +15 -0
  11. package/dist/place/water.js +63 -0
  12. package/dist/realistic/earth.d.ts +12 -1
  13. package/dist/realistic/earth.js +17 -1
  14. package/dist/realistic/element-base.d.ts +92 -0
  15. package/dist/realistic/element-base.js +179 -4
  16. package/dist/sky/claim.d.ts +4 -0
  17. package/dist/sky/claim.js +8 -0
  18. package/dist/sky/host.js +5 -0
  19. package/dist/space/element-base.d.ts +168 -2
  20. package/dist/space/element-base.js +402 -8
  21. package/dist/space/ephemeris.d.ts +1 -1
  22. package/dist/space/ephemeris.js +4 -2
  23. package/dist/space/follow.d.ts +36 -0
  24. package/dist/space/follow.js +46 -0
  25. package/dist/space/index.d.ts +1 -1
  26. package/dist/space/index.js +1 -0
  27. package/dist/space/path-controls.d.ts +56 -0
  28. package/dist/space/path-controls.js +121 -0
  29. package/dist/space/path-ribbons.d.ts +25 -0
  30. package/dist/space/path-ribbons.js +165 -0
  31. package/dist/space/paths.d.ts +119 -0
  32. package/dist/space/paths.js +163 -0
  33. package/dist/space/ride.d.ts +3 -2
  34. package/dist/space/ride.js +6 -4
  35. package/dist/space/satellite-hover.d.ts +47 -0
  36. package/dist/space/satellite-hover.js +183 -0
  37. package/dist/space/satellite-layer.d.ts +83 -2
  38. package/dist/space/satellite-layer.js +231 -52
  39. package/dist/space/satellite-model.d.ts +2 -1
  40. package/dist/space/satellite-model.js +4 -3
  41. package/dist/space/scene.d.ts +41 -0
  42. package/dist/space/scene.js +82 -13
  43. package/package.json +6 -1
@@ -0,0 +1,177 @@
1
+ // Which country a point is in, from the same Natural Earth 1:110m outlines the line globe draws (chizu's world-geo).
2
+ // The line is coarse, so a point within PLACE_COAST_KM of an outline but outside every shape is `near`, not a country.
3
+ import { geoContains } from "d3-geo";
4
+ import WORLD_GEO from "@johnmorrisdotca/chizu/world-geo";
5
+ /**
6
+ * How close to a 1:110m outline, in kilometres, still counts as that country nearby.
7
+ * The outlines can sit tens of kilometres off a real coast, so a point this close is not reported as inside.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { PLACE_COAST_KM } from "@johnmorrisdotca/chikyu-earth/place";
12
+ *
13
+ * console.log(PLACE_COAST_KM);
14
+ * ```
15
+ */
16
+ export const PLACE_COAST_KM = 50;
17
+ const RAD = Math.PI / 180;
18
+ const MEAN_RADIUS_KM = 6371.0088;
19
+ const CELL = 15;
20
+ const EXPAND = 0.8;
21
+ const toVec = (lon, lat) => {
22
+ const la = lat * RAD;
23
+ const lo = lon * RAD;
24
+ const c = Math.cos(la);
25
+ return [c * Math.cos(lo), c * Math.sin(lo), Math.sin(la)];
26
+ };
27
+ const dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
28
+ const cross = (a, b) => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
29
+ const hypot = (a) => Math.hypot(a[0], a[1], a[2]);
30
+ const angle = (a, b) => Math.acos(Math.min(1, Math.max(-1, dot(a, b))));
31
+ /** Kilometres from `p` to the minor arc `a`–`b`. A segment longer than half a turn uses the nearer end. */
32
+ const segmentKm = (p, a, b) => {
33
+ const ab = angle(a, b);
34
+ if (ab < 1e-8 || ab > Math.PI - 1e-4)
35
+ return Math.min(angle(p, a), angle(p, b)) * MEAN_RADIUS_KM;
36
+ const n = cross(a, b);
37
+ const nn = hypot(n);
38
+ if (nn < 1e-12)
39
+ return angle(p, a) * MEAN_RADIUS_KM;
40
+ const scale = dot(p, n) / (nn * nn);
41
+ const raw = [p[0] - n[0] * scale, p[1] - n[1] * scale, p[2] - n[2] * scale];
42
+ const len = hypot(raw);
43
+ if (len < 1e-12)
44
+ return 0;
45
+ const g = [raw[0] / len, raw[1] / len, raw[2] / len];
46
+ const on = dot(cross(a, g), n) >= -1e-7 && dot(cross(g, b), n) >= -1e-7;
47
+ return (on ? angle(p, g) : Math.min(angle(p, a), angle(p, b))) * MEAN_RADIUS_KM;
48
+ };
49
+ const ringsOf = (geometry) => {
50
+ if (geometry.type === "Polygon")
51
+ return geometry.coordinates;
52
+ if (geometry.type === "MultiPolygon")
53
+ return geometry.coordinates.flat();
54
+ return [];
55
+ };
56
+ const boxesOf = (rings) => {
57
+ let south = 90;
58
+ let north = -90;
59
+ let wraps = false;
60
+ const lons = [];
61
+ for (const ring of rings) {
62
+ for (let i = 0; i < ring.length; i += 1) {
63
+ const lon = ring[i][0];
64
+ const lat = ring[i][1];
65
+ lons.push(lon);
66
+ if (lat < south)
67
+ south = lat;
68
+ if (lat > north)
69
+ north = lat;
70
+ if (i > 0 && Math.abs(lon - ring[i - 1][0]) > 180)
71
+ wraps = true;
72
+ }
73
+ }
74
+ if (lons.length === 0)
75
+ return [];
76
+ if (!wraps)
77
+ return [{ west: Math.min(...lons), east: Math.max(...lons), south, north }];
78
+ const east = lons.filter((lon) => lon >= 0);
79
+ const west = lons.filter((lon) => lon < 0);
80
+ const boxes = [];
81
+ if (east.length > 0)
82
+ boxes.push({ west: Math.min(...east), east: 180, south, north });
83
+ if (west.length > 0)
84
+ boxes.push({ west: -180, east: Math.max(...west), south, north });
85
+ return boxes;
86
+ };
87
+ const cellKey = (lon, lat) => {
88
+ const x = Math.max(-180, Math.min(165, Math.floor(lon / CELL) * CELL));
89
+ const y = Math.max(-90, Math.min(75, Math.floor(lat / CELL) * CELL));
90
+ return (x + 180) / CELL + ((y + 90) / CELL) * 24;
91
+ };
92
+ const build = () => {
93
+ const lands = [];
94
+ const grid = new Map();
95
+ for (const feature of WORLD_GEO.features) {
96
+ const geometry = feature.geometry;
97
+ const raw = ringsOf(geometry);
98
+ if (raw.length === 0)
99
+ continue;
100
+ const boxes = boxesOf(raw);
101
+ const rings = raw.map((ring) => ring.map(([lon, lat]) => toVec(lon, lat)));
102
+ const area = boxes.reduce((sum, box) => sum + (box.east - box.west) * (box.north - box.south), 0);
103
+ const index = lands.length;
104
+ const props = feature.properties;
105
+ lands.push({
106
+ code: props.code.length === 2 ? props.code : null,
107
+ name: props.name,
108
+ nameJa: props.nameJa || props.name,
109
+ group: props.group ?? "",
110
+ groupJa: props.groupJa ?? "",
111
+ geometry,
112
+ rings,
113
+ boxes,
114
+ area,
115
+ });
116
+ for (const box of boxes) {
117
+ const west = Math.max(-180, box.west - EXPAND);
118
+ const east = Math.min(180, box.east + EXPAND);
119
+ const south = Math.max(-90, box.south - EXPAND);
120
+ const north = Math.min(90, box.north + EXPAND);
121
+ for (let lat = Math.floor(south / CELL) * CELL; lat <= north; lat += CELL) {
122
+ for (let lon = Math.floor(west / CELL) * CELL; lon <= east; lon += CELL) {
123
+ const key = cellKey(Math.max(-180, Math.min(179.9, lon)), Math.max(-90, Math.min(89.9, lat)));
124
+ const list = grid.get(key);
125
+ if (list)
126
+ list.push(index);
127
+ else
128
+ grid.set(key, [index]);
129
+ }
130
+ }
131
+ }
132
+ }
133
+ return { lands, grid };
134
+ };
135
+ let ready = null;
136
+ const index = () => (ready ??= build());
137
+ const nearestKm = (land, point) => {
138
+ let best = Number.POSITIVE_INFINITY;
139
+ for (const ring of land.rings) {
140
+ for (let i = 0; i < ring.length - 1; i += 1) {
141
+ const km = segmentKm(point, ring[i], ring[i + 1]);
142
+ if (km < best)
143
+ best = km;
144
+ if (best === 0)
145
+ return 0;
146
+ }
147
+ }
148
+ return best;
149
+ };
150
+ const asHit = (land) => ({ code: land.code, name: land.name, nameJa: land.nameJa, group: land.group, groupJa: land.groupJa });
151
+ /** The country at a longitude and latitude, or the nearest one when the point is just off a coarse outline. The shapes are Natural Earth 1:110m. */
152
+ export function landAt(lon, lat) {
153
+ const { lands, grid } = index();
154
+ const list = grid.get(cellKey(lon, lat)) ?? [];
155
+ const point = toVec(lon, lat);
156
+ let inside = null;
157
+ for (const id of list) {
158
+ const land = lands[id];
159
+ const feature = { type: "Feature", geometry: land.geometry, properties: {} };
160
+ if (!geoContains(feature, [lon, lat]))
161
+ continue;
162
+ if (!inside || land.area < inside.area)
163
+ inside = land;
164
+ }
165
+ if (inside)
166
+ return { country: asHit(inside), near: null };
167
+ let best = null;
168
+ for (const id of list) {
169
+ const land = lands[id];
170
+ const km = nearestKm(land, point);
171
+ if (km <= PLACE_COAST_KM && (!best || km < best.km))
172
+ best = { land, km };
173
+ }
174
+ if (!best)
175
+ return { country: null, near: null };
176
+ return { country: null, near: { ...asHit(best.land), distanceKm: best.km } };
177
+ }
@@ -0,0 +1,15 @@
1
+ import type { SeaFeature } from "../sea-names/geometry.ts";
2
+ /**
3
+ * How far from a sea, gulf or bay's own point, in kilometres, a point still counts as that water.
4
+ * Each reach is wide enough to cover that water and short of the next named water's point.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import { SEA_REACH_KM } from "@johnmorrisdotca/chikyu-earth/place";
9
+ *
10
+ * console.log(SEA_REACH_KM["sea-of-japan"] > 0);
11
+ * ```
12
+ */
13
+ export declare const SEA_REACH_KM: Readonly<Record<string, number>>;
14
+ /** The named sea, gulf, bay or ocean a point is over, or null when none is within its reach. A smaller water's point is nearer, so it wins over an ocean. */
15
+ export declare function waterAt(lon: number, lat: number): SeaFeature | null;
@@ -0,0 +1,63 @@
1
+ import { SEA_FEATURES } from "../sea-names/features.js";
2
+ const RAD = Math.PI / 180;
3
+ const MEAN_RADIUS_KM = 6371.0088;
4
+ /**
5
+ * How far from a sea, gulf or bay's own point, in kilometres, a point still counts as that water.
6
+ * Each reach is wide enough to cover that water and short of the next named water's point.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { SEA_REACH_KM } from "@johnmorrisdotca/chikyu-earth/place";
11
+ *
12
+ * console.log(SEA_REACH_KM["sea-of-japan"] > 0);
13
+ * ```
14
+ */
15
+ export const SEA_REACH_KM = {
16
+ "arctic-ocean": 3500,
17
+ "southern-ocean": 5500,
18
+ "atlantic-ocean": 10000,
19
+ "pacific-ocean": 12000,
20
+ "indian-ocean": 7000,
21
+ "black-sea": 650,
22
+ "philippine-sea": 1600,
23
+ "tasman-sea": 1100,
24
+ "bay-of-bengal": 1300,
25
+ "south-china-sea": 1400,
26
+ "arabian-sea": 1400,
27
+ "beaufort-sea": 800,
28
+ "caribbean-sea": 1200,
29
+ "gulf-of-mexico": 900,
30
+ "labrador-sea": 800,
31
+ "hudson-bay": 700,
32
+ "caspian-sea": 650,
33
+ "baffin-bay": 800,
34
+ "gulf-of-alaska": 800,
35
+ "red-sea": 1100,
36
+ "sea-of-okhotsk": 900,
37
+ "weddell-sea": 1400,
38
+ "persian-gulf": 450,
39
+ "mediterranean-sea": 1800,
40
+ "ross-sea": 900,
41
+ "coral-sea": 1200,
42
+ "sea-of-japan": 800,
43
+ };
44
+ const waters = SEA_FEATURES.filter((one) => one.kind !== "continent");
45
+ const kmBetween = (lon, lat, feature) => {
46
+ const φ1 = lat * RAD;
47
+ const φ2 = feature.lat * RAD;
48
+ const Δφ = (feature.lat - lat) * RAD;
49
+ const Δλ = (feature.lon - lon) * RAD;
50
+ const h = Math.sin(Δφ / 2) ** 2 + Math.cos(φ1) * Math.cos(φ2) * Math.sin(Δλ / 2) ** 2;
51
+ return 2 * MEAN_RADIUS_KM * Math.asin(Math.min(1, Math.sqrt(h)));
52
+ };
53
+ /** The named sea, gulf, bay or ocean a point is over, or null when none is within its reach. A smaller water's point is nearer, so it wins over an ocean. */
54
+ export function waterAt(lon, lat) {
55
+ let best = null;
56
+ for (const feature of waters) {
57
+ const reach = SEA_REACH_KM[feature.id] ?? 0;
58
+ const km = kmBetween(lon, lat, feature);
59
+ if (km <= reach && (!best || km < best.km))
60
+ best = { feature, km };
61
+ }
62
+ return best?.feature ?? null;
63
+ }
@@ -3,7 +3,8 @@ import type { AssetCache, Item3D } from "@johnmorrisdotca/kazoku-ui/renderer";
3
3
  import type { GeoPoint, GlobeView } from "../types.ts";
4
4
  import type { SatelliteRef } from "../satellites/types.ts";
5
5
  import { lookAt } from "../view.ts";
6
- import { type SatelliteState } from "../space/satellite-layer.ts";
6
+ import type { PathHit } from "../space/paths.ts";
7
+ import { type SatelliteScreen, type SatelliteState } from "../space/satellite-layer.ts";
7
8
  import type { Layer } from "./tiers.ts";
8
9
  import { type ThreeParts } from "./textures.ts";
9
10
  import { type TileSet, type TileSources } from "./tile-set.ts";
@@ -85,8 +86,12 @@ export interface EarthModel {
85
86
  } | null;
86
87
  /** The map tiles laid over the pictures while the scene is built: what they are doing, for a page or a test. */
87
88
  tiles: TileSet | null;
89
+ /** The page's path under a point of the view (CSS pixels), within a radius, once a draw has been made and one is there. */
90
+ pathAt: ((x: number, y: number, radius: number) => Omit<PathHit, "pointer"> | null) | null;
88
91
  /** The satellite at a point of the view (CSS pixels), within a radius, once a draw has been made and one is there. */
89
92
  pick: ((x: number, y: number, radius: number) => SatelliteRef | null) | null;
93
+ /** Where a satellite of a shown group is on the screen as of the last draw, or `null`. */
94
+ placeSatellite: ((ref: SatelliteRef) => SatelliteScreen | null) | null;
90
95
  /** The pixel ratio the textures are chosen for. */
91
96
  ratio(): number;
92
97
  /** Meteors seen from space (src/meteors/layer.ts): off unless the element switches them on. */
@@ -135,6 +140,12 @@ export interface EarthDeps {
135
140
  width: number;
136
141
  height: number;
137
142
  }) => void;
143
+ /** Where the satellite under the pointer is, or null. Called at each draw while one is under the pointer (and once when it is let go). */
144
+ onHover?: (place: {
145
+ x: number;
146
+ y: number;
147
+ visible: boolean;
148
+ } | null) => void;
138
149
  /** The rings the places' layer wants drawn in one draw call, read right after `onPose`. */
139
150
  placeSprites?: () => PlaceSpriteData | null;
140
151
  /** Told once, when the rings of the places that are not markers of their own were first wanted: whether the picture can draw them (false when the three.js parts handed over lack `Points`). */
@@ -44,6 +44,8 @@ export const newModel = () => ({
44
44
  drawn: null,
45
45
  tiles: null,
46
46
  pick: null,
47
+ pathAt: null,
48
+ placeSatellite: null,
47
49
  ratio: () => Math.min(globalThis.devicePixelRatio || 1, 2),
48
50
  meteors: newMeteorState(),
49
51
  bodyLabel: newBodyLabelState(),
@@ -191,6 +193,7 @@ export function createEarthItem(model, deps) {
191
193
  inertial.add(spun);
192
194
  scene.add(inertial);
193
195
  let layer;
196
+ let hoverShown = false;
194
197
  // far enough in front that a geostationary satellite (6.6 radii out) is never behind the camera: an orthographic picture is the same from anywhere on the line
195
198
  const camera = new three.OrthographicCamera(-1, 1, 1, -1, 1, 120);
196
199
  camera.position.set(0, 0, 50);
@@ -240,8 +243,19 @@ export function createEarthItem(model, deps) {
240
243
  deps.onSatellitesError?.(error);
241
244
  }
242
245
  }
243
- layer?.update(model.time, model.speed, radius);
246
+ layer?.update(model.time, model.speed, radius, size);
244
247
  model.pick = layer ? (x, y, radius) => layer.pick(x, y, camera, size, radius) : null;
248
+ model.pathAt = layer ? (x, y, radius) => layer.pathAt(x, y, camera, size, radius) : null;
249
+ model.placeSatellite = layer ? (ref) => layer.placeOf(ref, camera, size) : null;
250
+ if (layer && deps.onHover) {
251
+ const hover = model.satellites.hover;
252
+ const ref = hover.enabled && hover.ref && hover.fade > 0 ? hover.ref : null;
253
+ const at = ref ? layer.placeOf(ref, camera, size) : null;
254
+ const place = at ? { x: at.x, y: at.y, visible: at.visible } : null;
255
+ if (place || hoverShown)
256
+ deps.onHover(place);
257
+ hoverShown = place !== null;
258
+ }
245
259
  model.drawn = { view: { ...view }, time: model.time, radius, centre: { ...centre } };
246
260
  textures.sync(radius * model.ratio());
247
261
  tiles.sync({ lon: look.lon, lat: look.lat, width: size.width, height: size.height, panX: view.panX, panY: view.panY, radius }, [sunDir.value.x, sunDir.value.y, sunDir.value.z], true, model.ratio());
@@ -344,6 +358,8 @@ export function createEarthItem(model, deps) {
344
358
  dispose() {
345
359
  layer?.dispose();
346
360
  model.pick = null;
361
+ model.pathAt = null;
362
+ model.placeSatellite = null;
347
363
  clearTimeout(meteorTimer);
348
364
  meteors?.dispose();
349
365
  nameOn?.dispose();
@@ -5,6 +5,8 @@ import { type PaintSpec } from "../paint/buffer.ts";
5
5
  import type { SatelliteInfo, SatelliteRef, Satellites } from "../satellites/types.ts";
6
6
  import { type SatelliteStyle } from "../space/satellite-layer.ts";
7
7
  import { type SatelliteOthers } from "../space/satellite-focus.ts";
8
+ import { type PathStats } from "../space/path-controls.ts";
9
+ import { type PathHit, type PathRequest, type PathStyle } from "../space/paths.ts";
8
10
  import type { Credit, DataSource } from "../data-door.ts";
9
11
  import { type BodyLabelSettings } from "./body-label.ts";
10
12
  import type { SkyKeepClear } from "../sky/keep-clear.ts";
@@ -56,6 +58,9 @@ type SatelliteStats = {
56
58
  averageUpdateMs: number;
57
59
  updates: number;
58
60
  selectedRing: boolean;
61
+ hoverPath: boolean;
62
+ hoverOpacity: number;
63
+ selectedOpacity: number;
59
64
  };
60
65
  /**
61
66
  * A `speed` attribute: how many seconds pass for each real second.
@@ -370,6 +375,8 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
370
375
  tiers: Record<EarthLayer, number>;
371
376
  tiles: TileStats;
372
377
  satellites: SatelliteStats;
378
+ /** The page's paths: asked for, drawn (with the chosen satellite's own), left out over the cap of 16, unmatched, whether the chosen satellite's own orbit is drawn, draw calls they took at the last draw (0 or 1), the path under the mouse and the `chikyu-path-click` events sent. */
379
+ paths: PathStats;
373
380
  draws: number;
374
381
  contexts: number;
375
382
  canvas: {
@@ -537,10 +544,95 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
537
544
  ok: false;
538
545
  reason: "not-set";
539
546
  };
547
+ /**
548
+ * Draw a faint orbit while the pointer rests on a satellite. On unless `hover-path="off"`. Left unset, it is on when `names-on-hover` is on.
549
+ * The colour and the opacity are the custom properties `--chikyu-hover-path` and `--chikyu-hover-path-opacity`.
550
+ */
551
+ get hoverPath(): boolean;
552
+ set hoverPath(value: boolean);
553
+ /** Show a satellite's name while the pointer rests on it. On unless `names-on-hover="off"`. A touch does not rest, so it shows nothing. */
554
+ get namesOnHover(): boolean;
555
+ set namesOnHover(value: boolean);
540
556
  /** Mark one satellite: a larger ring round it and its orbit drawn. `null` lets it go. */
541
557
  selectSatellite(ref: SatelliteRef | null): void;
558
+ /**
559
+ * Where a satellite is on the screen as of the last draw: `{ x, y, visible, heightKm }` in CSS pixels from the view's top left, `visible` meaning it is inside the box and not behind the Earth. `null` when its group is not set or not shown, it cannot be placed, or it is behind the camera.
560
+ */
561
+ placeSatellite(ref: SatelliteRef): {
562
+ x: number;
563
+ y: number;
564
+ visible: boolean;
565
+ heightKm: number;
566
+ } | null;
542
567
  /** The satellite marked by `selectSatellite` or by a press on it, if any. */
543
568
  get selectedSatellite(): SatelliteRef | null;
569
+ /**
570
+ * Draw these satellites' orbits at once, each in a look from the table (`pathStyles`), without a satellite being chosen. One draw call for all of them and the chosen satellite's own orbit, and nothing is drawn at rest. At most 16 are kept, the last of the list.
571
+ * `id` is a NORAD catalogue number or `group:index` (`stations:0`); an id that matches no satellite is skipped (`stats.paths.unresolved`). A satellite asked for twice is drawn once, in the later look. `style` is the name of a look (`selected`, `hovered`, `favourite`, `path`, or one of the page's own)
572
+ * or a partial look over `path`. `[]` takes them all away. Where the pointer is on one, `chikyu-path-hover` and `chikyu-path-click` say which (`path-hit`).
573
+ *
574
+ * @param list - The paths, oldest first.
575
+ *
576
+ * @example
577
+ * ```ts
578
+ * import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
579
+ *
580
+ * const show = (space: ChikyuSpace): void => space.setPaths([{ id: 25544, style: "favourite" }, { id: "stations:1", style: { color: "#7fdbff", dash: [8, 4] } }]);
581
+ * console.log(typeof show);
582
+ * ```
583
+ */
584
+ setPaths(list: readonly PathRequest[]): void;
585
+ /** The paths in use, as set (the last 16). Setting it is `setPaths`. */
586
+ get paths(): PathRequest[];
587
+ set paths(list: readonly PathRequest[]);
588
+ /**
589
+ * Change the looks the paths are drawn in, by name. Each entry is a partial look over the built-in one of that name (or over `path`, for a name of the page's own); `null` takes the page's entry away. Without `replace` the entries are added to those already set.
590
+ * The built-in looks differ by width and dash as well as colour: `selected` (white, 2 px, solid, also the look of the chosen satellite's own orbit), `hovered` (white, 1.5 px, dashed), `favourite` (amber, 1.75 px, dotted) and `path` (white, 1.5 px, solid).
591
+ * A look is `{ color, width (0.5 to 8 CSS pixels), opacity (0 to 1), dash ([dash, gap] in CSS pixels, or null) }`.
592
+ *
593
+ * @param table - The entries by name.
594
+ * @param replace - `true` to drop the entries set before.
595
+ *
596
+ * @example
597
+ * ```ts
598
+ * import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
599
+ *
600
+ * const quiet = (space: ChikyuSpace): void => space.setPathStyles({ selected: { color: "#ffd166", width: 3, dash: null } });
601
+ * console.log(typeof quiet);
602
+ * ```
603
+ */
604
+ setPathStyles(table: Readonly<Record<string, Partial<PathStyle> | null>>, replace?: boolean): void;
605
+ /** The table of looks in use, whole: the built-in ones with the page's own over them. A copy. */
606
+ get pathStyles(): Record<string, PathStyle>;
607
+ set pathStyles(table: Readonly<Record<string, Partial<PathStyle> | null>>);
608
+ /**
609
+ * Draw the chosen satellite's own orbit (the attribute `selected-path`; on unless `off`). Off, `selectSatellite` still rings and names the satellite and a ride still follows it, but no line is drawn: the page draws it, with `setPaths` and the `selected` look, or its own. The look of the line when it is on is the `selected` entry of `pathStyles`.
610
+ */
611
+ get selectedPath(): boolean;
612
+ set selectedPath(value: boolean);
613
+ /**
614
+ * How near, in CSS pixels, the pointer has to be to a path for the pick and hover events to report it (the attribute `path-hit`; 8 when left out, 0 to 40; `0` or `off` turns the test off). A touch is given twice that, and at least 16.
615
+ * The test covers the page's paths and the chosen satellite's own orbit, not the part of an orbit the Earth hides, and a satellite's dot under the pointer comes first. In a ride from a satellite the test is off unless the attribute is set.
616
+ */
617
+ get pathHit(): number;
618
+ set pathHit(value: number);
619
+ /**
620
+ * The path under a point of the element, from the last draw: its id as given, the satellite (`ref`, the same shape as in `chikyu-satellite-click`), the name of its look, the nearest point on it and the distance to it, or `null`.
621
+ *
622
+ * @param x - CSS pixels from the element's left.
623
+ * @param y - CSS pixels from its top.
624
+ * @param radiusPx - How near the point must be, 0 to 200; `path-hit` when left out.
625
+ * @returns The path, or `null` when none is within reach.
626
+ *
627
+ * @example
628
+ * ```ts
629
+ * import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
630
+ *
631
+ * const name = (space: ChikyuSpace, x: number, y: number): string => space.pathAt(x, y, 10)?.style ?? "none";
632
+ * console.log(typeof name);
633
+ * ```
634
+ */
635
+ pathAt(x: number, y: number, radiusPx?: number): PathHit | null;
544
636
  /** Facts about one satellite at the moment shown (name, number, element age, height, speed, period, and `ownerCountry` when the owner is one country); undefined if it cannot be placed then. */
545
637
  satelliteInfo(ref: SatelliteRef): SatelliteInfo | undefined;
546
638
  /** The view as it is (for a page that wants to read it back). */