@johnmorrisdotca/wakusei-planets 0.27.0 → 0.30.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 +22 -0
- package/NOTICE.md +20 -0
- package/README.md +21 -8
- package/dist/element.d.ts +5 -0
- package/dist/element.js +46 -3
- package/dist/embed.d.ts +64 -0
- package/dist/embed.js +66 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/kids/picture.d.ts +4 -4
- package/dist/kids/picture.js +4 -4
- package/dist/lineup/data.d.ts +160 -0
- package/dist/lineup/data.js +303 -0
- package/dist/lineup/element.d.ts +99 -0
- package/dist/lineup/element.js +782 -0
- package/dist/lineup/labels.d.ts +141 -0
- package/dist/lineup/labels.js +155 -0
- package/dist/lineup/layout.d.ts +174 -0
- package/dist/lineup/layout.js +162 -0
- package/dist/lineup/scene3d.d.ts +47 -0
- package/dist/lineup/scene3d.js +155 -0
- package/dist/portrait/element.d.ts +5 -2
- package/dist/portrait/element.js +57 -6
- package/dist/portrait/scene3d.d.ts +13 -0
- package/dist/portrait/scene3d.js +21 -2
- package/dist/scene/body.d.ts +2 -0
- package/dist/scene/body.js +2 -1
- package/dist/scene/detail.d.ts +8 -2
- package/dist/scene/detail.js +56 -28
- package/dist/scene/painter.d.ts +30 -0
- package/dist/scene/painter.js +93 -9
- package/dist/scene/textures.d.ts +4 -2
- package/dist/scene/textures.js +2 -0
- package/dist/scene/tiles.d.ts +46 -0
- package/dist/scene/tiles.js +165 -19
- package/dist/space/clock.d.ts +31 -0
- package/dist/space/clock.js +45 -0
- package/dist/space/element.d.ts +16 -2
- package/dist/space/element.js +54 -32
- package/dist/space/scene.d.ts +9 -0
- package/dist/space/scene.js +16 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +9 -2
package/dist/space/element.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { carryControls } from "@johnmorrisdotca/kazoku-ui/view-controls";
|
|
2
2
|
import { BODIES, MOONS_OF } from "../facts.js";
|
|
3
3
|
import { createGate, frameCap } from "../gate.js";
|
|
4
|
+
import { createGameClock } from "./clock.js";
|
|
4
5
|
import { createPainter } from "../scene/painter.js";
|
|
5
6
|
import { setThreeLoader, takeRenderer } from "../scene/shared.js";
|
|
6
|
-
import { texturePaths } from "../scene/textures.js";
|
|
7
|
+
import { texturePaths, tilesBase } from "../scene/textures.js";
|
|
7
8
|
import { AU_IN_EARTH_RADII, EARTH_RADIUS_KM, frameAt, SPACE_PLANETS } from "./frame.js";
|
|
8
9
|
import { moonDistance, placeBodies, radiusIn } from "./scale.js";
|
|
9
10
|
import { createSpaceItem, FIT_DISTANCE, newSpaceModel, SPACE_BODIES } from "./scene.js";
|
|
@@ -11,6 +12,8 @@ export { setThreeLoader, SPACE_BODIES };
|
|
|
11
12
|
const readLight = (value) => (value === "lit" ? "lit" : "sun");
|
|
12
13
|
const RAD = Math.PI / 180;
|
|
13
14
|
const REAL_TIME_TICK_MS = 60_000;
|
|
15
|
+
/** The least time between two `wakusei-timechange` events while time runs: a few a second at most, however fast the picture is drawn. */
|
|
16
|
+
const TIME_EVENT_MS = 250;
|
|
14
17
|
const readCentre = (value) => {
|
|
15
18
|
if (!value)
|
|
16
19
|
return null;
|
|
@@ -31,34 +34,40 @@ const readBody = (value) => {
|
|
|
31
34
|
};
|
|
32
35
|
/**
|
|
33
36
|
* The zoom range of the space view when it carries its own controls. The floor, a millionth, takes the camera out past Neptune in the true scale. The ceiling is where the camera reaches the body: it is held at
|
|
34
|
-
* 1.05 radii from the surface (`FIT_DISTANCE` over the zoom), so past a zoom of about 3.2 nothing moves; 3
|
|
37
|
+
* 1.05 radii from the surface (`FIT_DISTANCE` over the zoom), so past a zoom of about 3.2 nothing moves; 3 is where the finest map tiles of the Earth, Mars and the Moon (16384 pixels round) run out of detail too, so it is the same ceiling for both.
|
|
35
38
|
*/
|
|
36
39
|
const CARRIED_LIMITS = { zoomMin: 1e-6, zoomMax: 3, tiltMax: 90 };
|
|
37
40
|
const STYLE = `<style>:host{display:block;aspect-ratio:1/1;position:relative;overflow:hidden}#stage,#labels{position:absolute;inset:0}#labels{pointer-events:none;overflow:hidden}.sp-label{position:absolute;left:0;top:0;margin:0;padding:0;border:0;background:none;font:12px/16px system-ui,-apple-system,sans-serif;color:#fff;white-space:nowrap;text-shadow:0 0 3px #000,0 0 3px #000;will-change:transform;pointer-events:none}.sp-label:focus-visible{outline:2px solid #6cd0ff;outline-offset:2px;border-radius:4px}.sp-label::before{content:"";display:inline-block;width:5px;height:5px;margin:0 5px 1px -2px;border-radius:50%;background:#fff}.sp-label[hidden]{display:none}</style><div id="stage"></div><div id="labels"></div>`;
|
|
38
41
|
/**
|
|
39
42
|
* The `<wakusei-space>` custom element: the Earth, the Moon, the Sun and the planets where they are at a date and time, drawn with three.js through the shared renderer. It takes `center`
|
|
40
43
|
* (`"lon,lat"`), `time` (`now` or an ISO date), `speed` (1 is real time, 0 holds, 86400 is a day a second, negative runs backwards), `scale` (`compressed` or `true`), `look` (`realistic` or `painted`),
|
|
41
|
-
* `light` (`sun` or `lit`), `lang` (`en` or `ja`: the names), `labels` and `orbits` (`off` hides them), and `texture-base`, `texture-far-base
|
|
44
|
+
* `light` (`sun` or `lit`), `lang` (`en` or `ja`: the names), `labels` and `orbits` (`off` hides them), and `texture-base`, `texture-far-base`, `max-texture` and `tiles` (where the finer map tiles are, for a close zoom; `off` for none). Positions come from this package's own models. It draws
|
|
42
45
|
* only when something changes, and nothing while it is out of sight.
|
|
43
46
|
*
|
|
44
47
|
* It carries the shared view controls itself: a drag turns the camera round the body, two fingers pinch, Ctrl, Command or Alt with the wheel zooms (the plain wheel scrolls the page), and the arrow keys, + and - and 0 work once it is
|
|
45
48
|
* focused. `controls="none"` turns them off; `zoom-min` and `zoom-max` set the range (a millionth to 3 by default); a `<kazoku-view-controls for="...">` takes over and reads it.
|
|
46
49
|
*
|
|
50
|
+
* While time runs (`speed` is not 0) it sends `wakusei-timechange` with `detail: { time, running: true }`, `time` being the moment shown in milliseconds since 1970, at most four times a second however fast the picture is
|
|
51
|
+
* drawn, and once with `running: false` when the clock holds (`speed` set to 0): a page writes the date into its date box from it. It is not sent for a `time` the page sets itself. `wakusei-time` is sent at every step the clock takes.
|
|
52
|
+
*
|
|
47
53
|
* @example
|
|
48
54
|
* ```ts no-run
|
|
49
55
|
* import type { WakuseiSpace } from "@johnmorrisdotca/wakusei-planets/space/element";
|
|
50
56
|
*
|
|
51
57
|
* const space = document.createElement("wakusei-space") as WakuseiSpace;
|
|
52
58
|
* space.setAttribute("time", "2026-11-02T12:00Z");
|
|
53
|
-
* space.setAttribute("speed", "
|
|
59
|
+
* space.setAttribute("speed", "86400");
|
|
60
|
+
* space.addEventListener("wakusei-timechange", (event) => {
|
|
61
|
+
* const { time, running } = (event as CustomEvent<{ time: number; running: boolean }>).detail;
|
|
62
|
+
* console.log(new Date(time).toISOString(), running ? "running" : "held");
|
|
63
|
+
* });
|
|
54
64
|
* document.body.append(space);
|
|
55
65
|
* ```
|
|
56
66
|
*/
|
|
57
67
|
export class WakuseiSpace extends HTMLElement {
|
|
58
68
|
static observedAttributes = ["center", "time", "speed", "scale", "labels", "orbits", "look", "light", "lang"];
|
|
59
69
|
#model = newSpaceModel();
|
|
60
|
-
#
|
|
61
|
-
#speed = 1;
|
|
70
|
+
#clock = createGameClock("now", 1);
|
|
62
71
|
#view;
|
|
63
72
|
#gate;
|
|
64
73
|
#taken;
|
|
@@ -66,7 +75,7 @@ export class WakuseiSpace extends HTMLElement {
|
|
|
66
75
|
#labelBox;
|
|
67
76
|
#state = "loading";
|
|
68
77
|
#timer;
|
|
69
|
-
#
|
|
78
|
+
#announced = -Infinity;
|
|
70
79
|
#pool = new Map();
|
|
71
80
|
#places;
|
|
72
81
|
#names = {};
|
|
@@ -81,15 +90,14 @@ export class WakuseiSpace extends HTMLElement {
|
|
|
81
90
|
}
|
|
82
91
|
connectedCallback() {
|
|
83
92
|
this.#model.centre = readCentre(this.getAttribute("center")) ?? this.#model.centre;
|
|
84
|
-
this.#
|
|
85
|
-
this.#model.time = this.#
|
|
86
|
-
this.#speed = this.#readSpeed();
|
|
93
|
+
this.#clock = createGameClock(readTime(this.getAttribute("time")), this.#readSpeed());
|
|
94
|
+
this.#model.time = this.#clock.time;
|
|
87
95
|
this.#model.mode = this.getAttribute("scale") === "true" ? "true" : "compressed";
|
|
88
96
|
this.#model.labels = this.getAttribute("labels") !== "off";
|
|
89
97
|
this.#model.orbits = this.getAttribute("orbits") !== "off";
|
|
90
98
|
this.#model.look = this.getAttribute("look") === "painted" ? "painted" : "realistic";
|
|
91
99
|
this.#model.light = readLight(this.getAttribute("light"));
|
|
92
|
-
this.#model.stepMs = Math.max(1000, Math.abs(this.#speed) * 1000);
|
|
100
|
+
this.#model.stepMs = Math.max(1000, Math.abs(this.#clock.speed) * 1000);
|
|
93
101
|
if (!this.hasAttribute("role"))
|
|
94
102
|
this.setAttribute("role", "img");
|
|
95
103
|
if (!this.hasAttribute("tabindex"))
|
|
@@ -114,6 +122,7 @@ export class WakuseiSpace extends HTMLElement {
|
|
|
114
122
|
painter: () => this.#painterNow(),
|
|
115
123
|
cap: () => this.#textureCap(),
|
|
116
124
|
invalidate: () => this.#gate?.request(),
|
|
125
|
+
advance: () => this.#advance(),
|
|
117
126
|
onLabels: (places) => this.#placeLabels(places),
|
|
118
127
|
onMoving: () => this.#gate?.request(),
|
|
119
128
|
onRideLost: () => this.#rideLost(),
|
|
@@ -129,10 +138,9 @@ export class WakuseiSpace extends HTMLElement {
|
|
|
129
138
|
else if (this.#state === "loading")
|
|
130
139
|
this.#set("unavailable");
|
|
131
140
|
});
|
|
132
|
-
this.#last = performance.now();
|
|
133
141
|
this.#schedule();
|
|
134
142
|
this.addEventListener("pointerdown", this.#down);
|
|
135
|
-
this.#hands = carryControls(this, { limits: CARRIED_LIMITS,
|
|
143
|
+
this.#hands = carryControls(this, { limits: CARRIED_LIMITS, onChange: (view, info) => this.setView(view, info.final) });
|
|
136
144
|
this.#labelBox.addEventListener("click", this.#labelClick);
|
|
137
145
|
this.#labelBox.addEventListener("focusin", this.#labelFocus);
|
|
138
146
|
}
|
|
@@ -180,26 +188,31 @@ export class WakuseiSpace extends HTMLElement {
|
|
|
180
188
|
}
|
|
181
189
|
/** The moment shown: milliseconds since the epoch, or "now" to follow the clock. Setting it points the camera at the same place on the ground again. */
|
|
182
190
|
get time() {
|
|
191
|
+
this.#advance();
|
|
183
192
|
return this.#model.time;
|
|
184
193
|
}
|
|
185
194
|
set time(value) {
|
|
186
|
-
this.#
|
|
187
|
-
this.#model.time = this.#
|
|
195
|
+
this.#clock.set(value instanceof Date ? value.getTime() : value);
|
|
196
|
+
this.#model.time = this.#clock.time;
|
|
188
197
|
this.#model.anchor = null;
|
|
189
|
-
this.#last = performance.now();
|
|
190
198
|
this.#schedule();
|
|
191
199
|
this.#gate?.request();
|
|
192
200
|
}
|
|
193
201
|
/** Seconds of game time per second: 1 is real time, 0 holds still, negative runs backwards. */
|
|
194
202
|
get speed() {
|
|
195
|
-
return this.#speed;
|
|
203
|
+
return this.#clock.speed;
|
|
196
204
|
}
|
|
197
205
|
set speed(value) {
|
|
198
|
-
this
|
|
199
|
-
|
|
200
|
-
this.#
|
|
206
|
+
// time up to this moment is worked out at the old speed (the clock does that), so a hold keeps the moment the reader saw last
|
|
207
|
+
const was = this.#clock.speed;
|
|
208
|
+
this.#clock.setSpeed(value);
|
|
209
|
+
if (this.isConnected)
|
|
210
|
+
this.#model.time = this.#clock.time;
|
|
211
|
+
this.#model.stepMs = Math.max(1000, Math.abs(this.#clock.speed) * 1000);
|
|
201
212
|
this.#schedule();
|
|
202
213
|
this.#gate?.request();
|
|
214
|
+
if (this.#clock.speed === 0 && was !== 0)
|
|
215
|
+
this.#announce(false);
|
|
203
216
|
}
|
|
204
217
|
/** `compressed` (the default: every direction real, the distances squeezed) or `true` (real distances and sizes). */
|
|
205
218
|
get scale() {
|
|
@@ -332,7 +345,6 @@ export class WakuseiSpace extends HTMLElement {
|
|
|
332
345
|
this.#lostTold = false;
|
|
333
346
|
const pose = model.pose;
|
|
334
347
|
model.transition = (options.smooth ?? true) && !reduced && pose.valid ? { start: performance.now(), duration: 1200, from: { p: [pose.p[0], pose.p[1], pose.p[2]], q: [pose.q[0], pose.q[1], pose.q[2], pose.q[3]], fov: pose.fov } } : null;
|
|
335
|
-
this.#last = performance.now();
|
|
336
348
|
this.#schedule();
|
|
337
349
|
this.#gate?.request();
|
|
338
350
|
this.dispatchEvent(new CustomEvent("wakusei-ride", { detail: this.riding }));
|
|
@@ -396,10 +408,11 @@ export class WakuseiSpace extends HTMLElement {
|
|
|
396
408
|
canvas: stats?.canvas ?? { width: 0, height: 0, pixels: 0 },
|
|
397
409
|
distance: this.#model.drawn?.distance ?? 0,
|
|
398
410
|
assets: { entries: stats?.assets.entries ?? 0, refs: stats?.assets.refs ?? 0 },
|
|
399
|
-
time: this
|
|
411
|
+
time: this.time,
|
|
400
412
|
lookups: this.#model.lookups,
|
|
401
413
|
camera: { position: [...this.#model.camera.position], fov: this.#model.camera.fov },
|
|
402
414
|
bodies: { look: this.#model.look, painted: this.#model.painted.bodies, moons: this.#model.painted.moons, held: this.#model.painted.held },
|
|
415
|
+
tiles: { ...this.#model.tiles },
|
|
403
416
|
ride: { riding: this.#model.ride !== null, lost: this.#model.rideLost, gliding: this.#model.transition !== null },
|
|
404
417
|
};
|
|
405
418
|
}
|
|
@@ -413,26 +426,35 @@ export class WakuseiSpace extends HTMLElement {
|
|
|
413
426
|
#schedule() {
|
|
414
427
|
clearTimeout(this.#timer);
|
|
415
428
|
this.#timer = undefined;
|
|
416
|
-
if (!this.isConnected || this.#speed === 0)
|
|
429
|
+
if (!this.isConnected || this.#clock.speed === 0)
|
|
417
430
|
return;
|
|
418
431
|
const riding = this.#model.ride !== null;
|
|
419
|
-
const pixels = Math.max(this.#model.motion || 0.015, this.#model.rideMotion) * Math.abs(this.#speed);
|
|
432
|
+
const pixels = Math.max(this.#model.motion || 0.015, this.#model.rideMotion) * Math.abs(this.#clock.speed);
|
|
420
433
|
let perSecond = Math.min(30, Math.max(1, pixels));
|
|
421
434
|
if (riding && typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches)
|
|
422
435
|
perSecond = 1;
|
|
423
|
-
const wait = !riding && this.#speed === 1 ? REAL_TIME_TICK_MS : 1000 / perSecond;
|
|
436
|
+
const wait = !riding && this.#clock.speed === 1 ? REAL_TIME_TICK_MS : 1000 / perSecond;
|
|
424
437
|
this.#timer = setTimeout(this.#tick, wait);
|
|
425
438
|
}
|
|
426
|
-
|
|
439
|
+
/** Bring the moment shown up to the page's clock, by the time that really passed at the speed it has run at, however few frames were drawn (`createGameClock`). */
|
|
440
|
+
#advance() {
|
|
441
|
+
if (this.isConnected)
|
|
442
|
+
this.#model.time = this.#clock.advance();
|
|
443
|
+
}
|
|
444
|
+
/** Tell the page the moment shown: at most four times a second while time runs (`running`), and once, at once, when it holds. */
|
|
445
|
+
#announce(running) {
|
|
427
446
|
const now = performance.now();
|
|
428
|
-
if (
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
447
|
+
if (running && now - this.#announced < TIME_EVENT_MS)
|
|
448
|
+
return;
|
|
449
|
+
this.#announced = running ? now : -Infinity;
|
|
450
|
+
this.dispatchEvent(new CustomEvent("wakusei-timechange", { detail: { time: this.#model.time, running } }));
|
|
451
|
+
}
|
|
452
|
+
#tick = () => {
|
|
453
|
+
this.#advance();
|
|
433
454
|
this.#gate?.request();
|
|
434
455
|
this.#schedule();
|
|
435
456
|
this.dispatchEvent(new CustomEvent("wakusei-time", { detail: { time: this.#model.time } }));
|
|
457
|
+
this.#announce(this.#clock.speed !== 0);
|
|
436
458
|
};
|
|
437
459
|
// --- labels --------------------------------------------------------------------------------------------------------------------------------------
|
|
438
460
|
#nameOf(id) {
|
|
@@ -518,7 +540,7 @@ export class WakuseiSpace extends HTMLElement {
|
|
|
518
540
|
};
|
|
519
541
|
// --- the rest --------------------------------------------------------------------------------------------------------------------------------------
|
|
520
542
|
#painterNow() {
|
|
521
|
-
return (this.#painter ??= createPainter({ textureBase: texturePaths(this).textureBase(), farBase: texturePaths(this).farBase() }));
|
|
543
|
+
return (this.#painter ??= createPainter({ textureBase: texturePaths(this).textureBase(), farBase: texturePaths(this).farBase(), tiles: tilesBase(this) ?? "off" }));
|
|
522
544
|
}
|
|
523
545
|
#textureCap() {
|
|
524
546
|
const given = Number(this.getAttribute("max-texture"));
|
package/dist/space/scene.d.ts
CHANGED
|
@@ -135,6 +135,13 @@ export interface SpaceModel {
|
|
|
135
135
|
moons: number;
|
|
136
136
|
held: number;
|
|
137
137
|
};
|
|
138
|
+
/** What the windows of finer map tiles on the bodies are doing, summed at the last draw: tile fetches made, tiles being fetched, tiles or windows that failed, and the finest level on a body now (`null` for none). */
|
|
139
|
+
tiles: {
|
|
140
|
+
requested: number;
|
|
141
|
+
loading: number;
|
|
142
|
+
failed: number;
|
|
143
|
+
shown: number | null;
|
|
144
|
+
};
|
|
138
145
|
/** How many frames the ephemeris has worked out. */
|
|
139
146
|
lookups: number;
|
|
140
147
|
/** Pixels a game-second moves things on the screen (the fastest turning body in sight): the draw rate follows it. */
|
|
@@ -183,6 +190,8 @@ export interface SpaceDeps {
|
|
|
183
190
|
painter: () => WakuseiPainter;
|
|
184
191
|
cap: () => number;
|
|
185
192
|
invalidate: () => void;
|
|
193
|
+
/** Bring the model's time up to the page's clock; called at the start of each draw, so a picture drawn late shows the moment it is drawn at and not the one of the last tick. */
|
|
194
|
+
advance?: () => void;
|
|
186
195
|
/** Where each body is on the screen, in CSS pixels in the box, or null when it is behind the camera. Called at each draw. */
|
|
187
196
|
onLabels?: (places: Record<SpaceBody, BodyPlace | null>) => void;
|
|
188
197
|
/** Called at the end of a draw while the camera is moving from one ride to another, so the next frame is asked for (at the page's frame cap). */
|
package/dist/space/scene.js
CHANGED
|
@@ -42,6 +42,7 @@ export const newSpaceModel = () => ({
|
|
|
42
42
|
look: "realistic",
|
|
43
43
|
drawn: null,
|
|
44
44
|
painted: { bodies: 0, moons: 0, held: 0 },
|
|
45
|
+
tiles: { requested: 0, loading: 0, failed: 0, shown: null },
|
|
45
46
|
lookups: 0,
|
|
46
47
|
motion: 0,
|
|
47
48
|
drawnView: null,
|
|
@@ -129,6 +130,7 @@ export function createSpaceItem(model, deps) {
|
|
|
129
130
|
scene,
|
|
130
131
|
camera,
|
|
131
132
|
update() {
|
|
133
|
+
deps.advance?.();
|
|
132
134
|
const frame = track.at(model.time);
|
|
133
135
|
model.lookups = track.lookups;
|
|
134
136
|
if (model.stepMs !== trackStep) {
|
|
@@ -313,7 +315,7 @@ export function createSpaceItem(model, deps) {
|
|
|
313
315
|
drawing.object.quaternion.copy(camera.quaternion);
|
|
314
316
|
const lit = id !== "sun" && model.light === "lit";
|
|
315
317
|
const toSun = lit ? unit([camera.position.x - pos[id][0], camera.position.y - pos[id][1], camera.position.z - pos[id][2]]) : toSunOf(id);
|
|
316
|
-
drawing.update({ toSun, ms: model.time, radiusPx: px[id] });
|
|
318
|
+
drawing.update({ toSun, ms: model.time, radiusPx: px[id], view: { camera, width: size.width, height: size.height } });
|
|
317
319
|
}
|
|
318
320
|
model.painted.bodies = paintedBodies;
|
|
319
321
|
// the orbits round the Sun, placed by the same mapping as the bodies
|
|
@@ -367,7 +369,7 @@ export function createSpaceItem(model, deps) {
|
|
|
367
369
|
drawing.object.position.set(at[0], at[1], at[2]);
|
|
368
370
|
drawing.object.scale.setScalar(drawn);
|
|
369
371
|
const moonPx = away <= drawn * 1.001 ? 1e5 : ((size.height / 2) * (drawn / Math.sqrt(away * away - drawn * drawn))) / half;
|
|
370
|
-
drawing.update({ toSun: model.light === "lit" ? unit([camera.position.x - at[0], camera.position.y - at[1], camera.position.z - at[2]]) : toSunOf(id), ms: model.time, radiusPx: moonPx });
|
|
372
|
+
drawing.update({ toSun: model.light === "lit" ? unit([camera.position.x - at[0], camera.position.y - at[1], camera.position.z - at[2]]) : toSunOf(id), ms: model.time, radiusPx: moonPx, view: { camera, width: size.width, height: size.height } });
|
|
371
373
|
}
|
|
372
374
|
}
|
|
373
375
|
let soonest = Number.POSITIVE_INFINITY;
|
|
@@ -393,6 +395,18 @@ export function createSpaceItem(model, deps) {
|
|
|
393
395
|
paintedMoons += 1;
|
|
394
396
|
model.painted.moons = paintedMoons;
|
|
395
397
|
model.painted.held = moonSlots.size;
|
|
398
|
+
const tiles = { requested: 0, loading: 0, failed: 0, shown: null };
|
|
399
|
+
for (const painting of [...[...slots.values()].map((slot) => slot.drawing), ...[...moonSlots.values()].map((held) => held.slot.drawing)]) {
|
|
400
|
+
const stats = painting?.tiles;
|
|
401
|
+
if (stats === undefined)
|
|
402
|
+
continue;
|
|
403
|
+
tiles.requested += stats.requested;
|
|
404
|
+
tiles.loading += stats.loading;
|
|
405
|
+
tiles.failed += stats.failed;
|
|
406
|
+
if (stats.shown !== null)
|
|
407
|
+
tiles.shown = Math.max(tiles.shown ?? 0, stats.shown);
|
|
408
|
+
}
|
|
409
|
+
model.tiles = tiles;
|
|
396
410
|
if (deps.onLabels && model.labels) {
|
|
397
411
|
const places = {};
|
|
398
412
|
for (const id of SPACE_BODIES) {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.30.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.30.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/wakusei-planets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "Wakusei Planets 惑星 — The Sun, planets and moons for the web: each as a clean line drawing, a shaded realistic drawing or a painted surface map, with real sizes, axial tilt and rotation as data, and positions of the moons for any date and time. SVG for the lines, three.js (optional) for the rest.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"planets",
|
|
@@ -89,12 +89,14 @@
|
|
|
89
89
|
"sideEffects": [
|
|
90
90
|
"./dist/element.js",
|
|
91
91
|
"./dist/portrait/element.js",
|
|
92
|
+
"./dist/lineup/element.js",
|
|
92
93
|
"./dist/space/element.js",
|
|
93
94
|
"./dist/bodies/*.js",
|
|
94
95
|
"./dist/tables/*.js",
|
|
95
96
|
"./dist/craft/*.js",
|
|
96
97
|
"./src/element.ts",
|
|
97
98
|
"./src/portrait/element.ts",
|
|
99
|
+
"./src/lineup/element.ts",
|
|
98
100
|
"./src/space/element.ts",
|
|
99
101
|
"./src/bodies/*.ts",
|
|
100
102
|
"./src/tables/*.ts",
|
|
@@ -119,6 +121,11 @@
|
|
|
119
121
|
"import": "./dist/portrait/element.js",
|
|
120
122
|
"default": "./dist/portrait/element.js"
|
|
121
123
|
},
|
|
124
|
+
"./lineup": {
|
|
125
|
+
"types": "./dist/lineup/element.d.ts",
|
|
126
|
+
"import": "./dist/lineup/element.js",
|
|
127
|
+
"default": "./dist/lineup/element.js"
|
|
128
|
+
},
|
|
122
129
|
"./space": {
|
|
123
130
|
"types": "./dist/space/index.d.ts",
|
|
124
131
|
"import": "./dist/space/index.js",
|
|
@@ -387,7 +394,7 @@
|
|
|
387
394
|
},
|
|
388
395
|
"packageManager": "pnpm@10.28.0",
|
|
389
396
|
"dependencies": {
|
|
390
|
-
"@johnmorrisdotca/kazoku-ui": "^0.
|
|
397
|
+
"@johnmorrisdotca/kazoku-ui": "^0.27.0"
|
|
391
398
|
},
|
|
392
399
|
"peerDependencies": {
|
|
393
400
|
"@johnmorrisdotca/chikyu-earth": ">=0.10.0",
|