@johnmorrisdotca/chikyu-earth 0.39.0 → 0.41.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 +9 -0
- package/README.md +1 -1
- package/dist/cities/geometry.d.ts +7 -0
- package/dist/cities/geometry.js +1 -1
- package/dist/cities/host.d.ts +10 -2
- package/dist/cities/host.js +4 -2
- package/dist/markers/layer.d.ts +16 -1
- package/dist/markers/layer.js +3 -2
- package/dist/markers/place-layer.js +3 -0
- package/dist/realistic/air-note.d.ts +1 -1
- package/dist/realistic/air-note.js +1 -1
- package/dist/realistic/earth.js +2 -1
- package/dist/realistic/element-base.js +50 -10
- package/dist/sky/host.d.ts +12 -0
- package/dist/sky/host.js +30 -4
- package/dist/space/element-base.js +50 -6
- package/dist/space/scene.d.ts +2 -0
- package/dist/space/scene.js +34 -32
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.41.0 - 2026-11-12
|
|
6
|
+
|
|
7
|
+
- **The credit under the space view follows the painter's credit** (MODULES-1158). wakusei-planets' painter (0.39 and later) carries `credit: { en, ja }` for the pictures of the bodies the view holds, and the view makes the Sun, the Moon and every planet in each view, so the line names all their pictures in an Earth view as in a Jupiter view (more than is big on the screen is safe, less would be the fault); so `<chikyu-space>` reads it again whenever a body drawing asks for a redraw (a picture arrived, a window of tiles changed, a body was made) and writes the line only when its text changed, never at every frame; no credit, no line. Pass the painter as it is: `{ ...painter }` reads `credit` once. A page that writes the credit itself (`bodies-credit="off"`) is sent `chikyu-bodies-credit` when it changed, with `detail` `{ en, ja }` or `null`. The demo drops its own `PLANET_CREDIT` and uses the painter's; its full-screen page follows the event. Tests: `e2e/space-credit.gl.ts` (a painter of the test's own; and wakusei-planets' own, wrapped to log the bodies made and the reads of its credit after they are made: every body is made, the Sun's and Jupiter's CC BY 4.0 credits are in the line, and it is the painter's credit as it is now). Lazy making of the bodies out of view, which would narrow the credit, is a separate ticket. The credit line is at most four lines high and scrolls: with every body made, wakusei-planets' credit is some twenty lines and covered the whole view (it hid the ground from the drag, air and follow tests in CI).
|
|
8
|
+
|
|
9
|
+
## 0.40.0 - 2026-11-12
|
|
10
|
+
|
|
11
|
+
- **Names of different layers never overlap** (MODULES-1072). On `<chikyu-space>` and `<chikyu-earth-realistic>` each layer placed its names alone: city names ignored the places, the markers' labels ignored the places' names, and star names ignored every layer's names and rings, so a name could sit over another layer's. The layers now lay out in a fixed order, each keeping clear of the boxes of those before it: the places' names, rings and marks with the ringed satellites, then the markers' labels, then the cities' names, then the stars' and constellations' names (the countries' names, which already kept clear of the others, come after the cities'). A star whose name box or ring touches an earlier box is left out and the next star is named. The order is the draw's: the realistic Earth's places are laid out before its markers and the sky after the cities, as the space view's sky is after its cities. `OverlayHost` has an optional `taken()` (the places' boxes, which `attachMarkers` reads), `CityLayoutOptions` has `taken`, and a satellite's ring is among the boxes the places take. Boxes are handed over when names are laid out, which is when the view changes; nothing is laid out or drawn at rest. Tests: `test/label-overlap.test.ts` and `e2e/label-overlap.gl.ts`.
|
|
12
|
+
- **A glide is counted on the page, not polled** (MODULES-1190). `e2e/ride-above.gl.ts` watched for the camera's glide into the above view by polling `stats.ride.gliding`, and a short glide could be missed (seen in CI on 2026-11-12). The page now counts each glide at every animation frame and the test reads the count; it fails when a view change never glides. A test change only; the package is unchanged.
|
|
13
|
+
|
|
5
14
|
## 0.39.0 - 2026-11-12
|
|
6
15
|
|
|
7
16
|
- **The painted trail follows the orbit at any clock, and costs nothing until it is used** (MODULES-1188). A month laid down at once, or a fast clock, took samples too far apart and drew chords across the map: samples are now at most a third of a trip apart. A clock run backwards laid down nothing for the older end, so the trail shrank: it now fills it in. A coverage swath over the date line was cut at the edge of the map: it now wraps. Switching to a satellite that paints nothing left the old picture on the globe: the cleared picture is sent. The trail's two megabytes and its picture on the graphics card were made in every view, painting or not: they are made when the first satellite is painted, and `clearPaint()` gives them back.
|
package/README.md
CHANGED
|
@@ -609,7 +609,7 @@ console.log(countryList().filter((country) => country.alpha2 === null).map((coun
|
|
|
609
609
|
|
|
610
610
|
## How to cite
|
|
611
611
|
|
|
612
|
-
> Morris, J. (2026). *Chikyu Earth* (version 0.
|
|
612
|
+
> Morris, J. (2026). *Chikyu Earth* (version 0.41.0) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
|
|
613
613
|
|
|
614
614
|
GitHub's "Cite this repository" button reads [CITATION.cff](CITATION.cff) and gives BibTeX and APA. Cite the version you used (`npm ls @johnmorrisdotca/chikyu-earth`), and credit the sources behind the numbers and pictures: [NOTICE.md](NOTICE.md) says who made each one and under what terms.
|
|
615
615
|
|
|
@@ -77,6 +77,13 @@ export interface CityLayoutOptions {
|
|
|
77
77
|
* (a fallback font for Japanese, say) would otherwise lay names over one another. Left out, the estimate alone is used, as in Node.
|
|
78
78
|
*/
|
|
79
79
|
measure?: (text: string) => number;
|
|
80
|
+
/** Boxes another layer's names, rings and marks already take (left, top, width and height from the picture's top left): no name is put over one. */
|
|
81
|
+
taken?: readonly {
|
|
82
|
+
left: number;
|
|
83
|
+
top: number;
|
|
84
|
+
width: number;
|
|
85
|
+
height: number;
|
|
86
|
+
}[];
|
|
80
87
|
}
|
|
81
88
|
/**
|
|
82
89
|
* A city to name: where its dot is, the text to write and where the text's box goes (its top left corner and size).
|
package/dist/cities/geometry.js
CHANGED
|
@@ -124,7 +124,7 @@ export function layoutCities(cities, frame, lang, options) {
|
|
|
124
124
|
const height = Math.ceil(options.size * 1.35);
|
|
125
125
|
const texts = seen.map((one) => cityNameText(one.city, lang));
|
|
126
126
|
const items = seen.map((one, index) => ({ x: one.x, y: one.y, r: options.dot, w: Math.max(nameWidth(texts[index], options.size), options.measure ? Math.ceil(options.measure(texts[index])) + 4 : 0), h: height, priority: seen.length - index }));
|
|
127
|
-
return placeLabels(items, frame.width, frame.height, options.max).map((place) => {
|
|
127
|
+
return placeLabels(items, frame.width, frame.height, options.max, 64, options.taken).map((place) => {
|
|
128
128
|
const one = seen[place.item];
|
|
129
129
|
return { city: one.city, text: texts[place.item], x: one.x, y: one.y, left: place.left, top: place.top, width: items[place.item].w, height };
|
|
130
130
|
});
|
package/dist/cities/host.d.ts
CHANGED
|
@@ -38,8 +38,16 @@ export interface CityHostOptions {
|
|
|
38
38
|
onLayout?(): void;
|
|
39
39
|
}
|
|
40
40
|
export interface CityHost {
|
|
41
|
-
/**
|
|
42
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Tells where the Earth is in the picture just drawn, or `null` when there is no Earth to name. `taken` is the boxes the layers placed before this one (the places', the markers', the bodies' names) take: no name goes over one.
|
|
43
|
+
* The list is read again whenever the names are laid out between draws, so the element refills the same array.
|
|
44
|
+
*/
|
|
45
|
+
frame(frame: CityFrame | null, taken?: readonly {
|
|
46
|
+
left: number;
|
|
47
|
+
top: number;
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
}[]): void;
|
|
43
51
|
/** Reads the attribute and the language again after either changed. */
|
|
44
52
|
refresh(): void;
|
|
45
53
|
/** The look of the names (the property `cityNamesStyle`). */
|
package/dist/cities/host.js
CHANGED
|
@@ -35,6 +35,7 @@ export function createCityHost(options) {
|
|
|
35
35
|
let version = 0;
|
|
36
36
|
let cache;
|
|
37
37
|
let last = null;
|
|
38
|
+
let lastTaken;
|
|
38
39
|
let shown = [];
|
|
39
40
|
let renders = 0;
|
|
40
41
|
let style = {};
|
|
@@ -154,7 +155,7 @@ export function createCityHost(options) {
|
|
|
154
155
|
const size = style.size ?? DEFAULTS.size;
|
|
155
156
|
const dot = style.dotSize ?? DEFAULTS.dot;
|
|
156
157
|
usedLang = options.language();
|
|
157
|
-
shown = layoutCities(citiesFor(tiers), frame, usedLang, { max, size, dot, measure: measurer(size) });
|
|
158
|
+
shown = layoutCities(citiesFor(tiers), frame, usedLang, { max, size, dot, measure: measurer(size), ...(lastTaken ? { taken: lastTaken } : {}) });
|
|
158
159
|
place(frame, dot);
|
|
159
160
|
}
|
|
160
161
|
function place(frame, dot) {
|
|
@@ -223,10 +224,11 @@ export function createCityHost(options) {
|
|
|
223
224
|
};
|
|
224
225
|
doc.fonts?.addEventListener?.("loadingdone", onFonts);
|
|
225
226
|
return {
|
|
226
|
-
frame(next) {
|
|
227
|
+
frame(next, taken) {
|
|
227
228
|
if (gone)
|
|
228
229
|
return;
|
|
229
230
|
last = next;
|
|
231
|
+
lastTaken = taken;
|
|
230
232
|
if (max === null)
|
|
231
233
|
return;
|
|
232
234
|
if (!next) {
|
package/dist/markers/layer.d.ts
CHANGED
|
@@ -33,13 +33,28 @@ export interface OverlayHost {
|
|
|
33
33
|
readonly overlayRoot: HTMLElement;
|
|
34
34
|
readonly pose: OverlayPose | null;
|
|
35
35
|
subscribe(listener: (pose: OverlayPose) => void): () => void;
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Tells the element the boxes an overlay's marks and labels take now (an empty list when it is taken away), so the element's own names keep clear of them. `names` is the part of `boxes` that is the labels' (the marks' own boxes are the rest): the cities' names, which are
|
|
38
|
+
* set at a mark's own place, keep clear of the labels and not of the marks.
|
|
39
|
+
*/
|
|
37
40
|
claim?(owner: object, boxes: readonly {
|
|
38
41
|
left: number;
|
|
39
42
|
top: number;
|
|
40
43
|
width: number;
|
|
41
44
|
height: number;
|
|
45
|
+
}[], names?: readonly {
|
|
46
|
+
left: number;
|
|
47
|
+
top: number;
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
42
50
|
}[]): void;
|
|
51
|
+
/** The boxes the element's own places take now (names, rings, marks): the markers' labels are put clear of them, as the places come first. */
|
|
52
|
+
taken?(): readonly {
|
|
53
|
+
left: number;
|
|
54
|
+
top: number;
|
|
55
|
+
width: number;
|
|
56
|
+
height: number;
|
|
57
|
+
}[];
|
|
43
58
|
}
|
|
44
59
|
/**
|
|
45
60
|
* What {@link attachMarkers} may be asked: the most labels, how close markers gather, and the default colour.
|
package/dist/markers/layer.js
CHANGED
|
@@ -232,7 +232,7 @@ export function attachMarkers(element, options = {}) {
|
|
|
232
232
|
hitMembers.push(g.members);
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
const placed = placeLabels(items, pose.width, pose.height, maxLabels);
|
|
235
|
+
const placed = placeLabels(items, pose.width, pose.height, maxLabels, 64, host.taken?.());
|
|
236
236
|
for (let k = 0; k < placed.length; k += 1) {
|
|
237
237
|
const p = placed[k];
|
|
238
238
|
const m = data.items[labelled[p.item]];
|
|
@@ -264,9 +264,10 @@ export function attachMarkers(element, options = {}) {
|
|
|
264
264
|
const boxes = [];
|
|
265
265
|
for (const p of placed)
|
|
266
266
|
boxes.push({ left: p.left, top: p.top, width: items[p.item].w, height: items[p.item].h });
|
|
267
|
+
const names = boxes.slice();
|
|
267
268
|
for (let k = 0; k < hitX.length; k += 1)
|
|
268
269
|
boxes.push({ left: hitX[k] - hitR[k], top: hitY[k] - hitR[k], width: hitR[k] * 2, height: hitR[k] * 2 });
|
|
269
|
-
host.claim?.(api, boxes);
|
|
270
|
+
host.claim?.(api, boxes, names);
|
|
270
271
|
stats.markers = visible.length - groups.reduce((sum, g) => sum + (g.members.length > 1 ? g.members.length : 0), 0);
|
|
271
272
|
stats.clusters = clusters;
|
|
272
273
|
stats.labels = placed.length;
|
|
@@ -544,6 +544,9 @@ export function createPlaceLayer(box) {
|
|
|
544
544
|
boxes.push({ left: spot.left, top: spot.top, width: items[spot.item].w, height: items[spot.item].h });
|
|
545
545
|
for (const shape of layout.shapes)
|
|
546
546
|
boxes.push({ left: shape.tipX - 5, top: shape.tipY - 5, width: 10, height: 10 });
|
|
547
|
+
// the ring round each satellite that can be seen: other layers' names keep off it as they keep off its name
|
|
548
|
+
for (const mark of seen)
|
|
549
|
+
boxes.push({ left: mark.x - SATELLITE_RING, top: mark.y - SATELLITE_RING, width: SATELLITE_RING * 2, height: SATELLITE_RING * 2 });
|
|
547
550
|
stats.shown = shown;
|
|
548
551
|
stats.marks = order.length;
|
|
549
552
|
stats.labels = layout.labels.length;
|
|
@@ -12,7 +12,7 @@ export declare const AIR_NOTE: {
|
|
|
12
12
|
readonly ja: "大気は、見やすいように実際の厚さの{n}倍で描いています。";
|
|
13
13
|
};
|
|
14
14
|
/** The styles of the lines under the picture (`#notes`, with the air's `#air-note` and the meteors' `#meteor-note` in it, one above the other) in an element's shadow root. */
|
|
15
|
-
export declare const NOTES_STYLE = "#notes{position:absolute;left:8px;right:8px;bottom:6px;display:flex;flex-direction:column;align-items:flex-start;gap:4px;pointer-events:none}#notes>p{position:static;margin:0;max-width:100%;font:11px/1.3 system-ui,sans-serif;color:#dfe6f2;background:#0b0e14b3;padding:2px 6px;border-radius:4px}#notes>p[hidden]{display:none}";
|
|
15
|
+
export declare const NOTES_STYLE = "#notes{position:absolute;left:8px;right:8px;bottom:6px;display:flex;flex-direction:column;align-items:flex-start;gap:4px;pointer-events:none}#notes>p{position:static;margin:0;max-width:100%;font:11px/1.3 system-ui,sans-serif;color:#dfe6f2;background:#0b0e14b3;padding:2px 6px;border-radius:4px}#notes>p[hidden]{display:none}#notes>#bodies-note{max-height:4.6em;overflow-y:auto;pointer-events:auto;overscroll-behavior:contain}";
|
|
16
16
|
/** The words of the line for a thickness: a whole number is written plainly, any other with up to one decimal. */
|
|
17
17
|
export declare function airNoteText(lang: "en" | "ja", thickness: number): string;
|
|
18
18
|
/** Put the line right: its words in the language of the element or the page, shown only while the air is thicker than it is (`air-thickness` above 1) and `air-label` is not `off`. */
|
|
@@ -13,7 +13,7 @@ export const AIR_NOTE = {
|
|
|
13
13
|
ja: "大気は、見やすいように実際の厚さの{n}倍で描いています。",
|
|
14
14
|
};
|
|
15
15
|
/** The styles of the lines under the picture (`#notes`, with the air's `#air-note` and the meteors' `#meteor-note` in it, one above the other) in an element's shadow root. */
|
|
16
|
-
export const NOTES_STYLE = "#notes{position:absolute;left:8px;right:8px;bottom:6px;display:flex;flex-direction:column;align-items:flex-start;gap:4px;pointer-events:none}#notes>p{position:static;margin:0;max-width:100%;font:11px/1.3 system-ui,sans-serif;color:#dfe6f2;background:#0b0e14b3;padding:2px 6px;border-radius:4px}#notes>p[hidden]{display:none}";
|
|
16
|
+
export const NOTES_STYLE = "#notes{position:absolute;left:8px;right:8px;bottom:6px;display:flex;flex-direction:column;align-items:flex-start;gap:4px;pointer-events:none}#notes>p{position:static;margin:0;max-width:100%;font:11px/1.3 system-ui,sans-serif;color:#dfe6f2;background:#0b0e14b3;padding:2px 6px;border-radius:4px}#notes>p[hidden]{display:none}#notes>#bodies-note{max-height:4.6em;overflow-y:auto;pointer-events:auto;overscroll-behavior:contain}";
|
|
17
17
|
/** The words of the line for a thickness: a whole number is written plainly, any other with up to one decimal. */
|
|
18
18
|
export function airNoteText(lang, thickness) {
|
|
19
19
|
return AIR_NOTE[lang].replace("{n}", String(Math.round(thickness * 10) / 10));
|
package/dist/realistic/earth.js
CHANGED
|
@@ -247,6 +247,8 @@ export function createEarthItem(model, deps) {
|
|
|
247
247
|
if (model.bodyLabel.settings && !nameOn)
|
|
248
248
|
nameOn = createBodyLabelLayer(three, turned, model.bodyLabel, { invalidate: deps.invalidate, ...(deps.onLabelError ? { onError: deps.onLabelError } : {}) });
|
|
249
249
|
nameOn?.sync(camera, radius);
|
|
250
|
+
deps.onPose?.({ lon: look.lon, lat: look.lat, radius, cx: size.width / 2 + view.panX, cy: size.height / 2 + view.panY, width: size.width, height: size.height });
|
|
251
|
+
// the sky after the places, the markers and the city names, so its names keep clear of what they take as it is laid out
|
|
250
252
|
if (deps.onSky) {
|
|
251
253
|
// the sky as the picture's own axes see it: a direction in space, turned as the satellites are into the picture's axes, falls where its sideways and upward parts say, in front when it points towards the viewer
|
|
252
254
|
spun.updateWorldMatrix(true, false);
|
|
@@ -268,7 +270,6 @@ export function createEarthItem(model, deps) {
|
|
|
268
270
|
},
|
|
269
271
|
});
|
|
270
272
|
}
|
|
271
|
-
deps.onPose?.({ lon: look.lon, lat: look.lat, radius, cx: size.width / 2 + view.panX, cy: size.height / 2 + view.panY, width: size.width, height: size.height });
|
|
272
273
|
// the borders: made the first time a set is switched on, above the clouds and under the air
|
|
273
274
|
if ((model.borders.countries || model.borders.regions) && !borders && !model.borders.stats.failed) {
|
|
274
275
|
try {
|
|
@@ -241,6 +241,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
241
241
|
language: () => ((this.closest("[lang]")?.getAttribute("lang") ?? "").toLowerCase().startsWith("ja") ? "ja" : "en"),
|
|
242
242
|
onError: (error) => this.dispatchEvent(new CustomEvent("chikyu-sky-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } })),
|
|
243
243
|
loadFont: loadMichroma,
|
|
244
|
+
taken: () => this.#boxesBeforeSky(),
|
|
244
245
|
});
|
|
245
246
|
this.#sky.setStyle(this.#skyStyle);
|
|
246
247
|
this.#sky.setKeepClear(this.#keepClear);
|
|
@@ -254,7 +255,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
254
255
|
attribute: (name) => this.getAttribute(name),
|
|
255
256
|
language: () => ((this.closest("[lang]")?.getAttribute("lang") ?? "").toLowerCase().startsWith("ja") ? "ja" : "en"),
|
|
256
257
|
onError: (error) => this.dispatchEvent(new CustomEvent("chikyu-city-names-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } })),
|
|
257
|
-
onLayout: () => this.#
|
|
258
|
+
onLayout: () => this.#relayNames(false, true),
|
|
258
259
|
});
|
|
259
260
|
this.#cities.setStyle(this.#citiesStyle);
|
|
260
261
|
Object.assign(this.#model.borders, readBorders(this.getAttribute("borders")));
|
|
@@ -313,6 +314,11 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
313
314
|
onPose: (pose) => {
|
|
314
315
|
if (this.#hands)
|
|
315
316
|
this.#hands.controller.grabRadius = discRadius(pose.width, pose.height, 1);
|
|
317
|
+
// the places first, then the markers (they keep off what the places take), then the cities', countries', stars' and constellations' names
|
|
318
|
+
if (this.#placeLayer && (this.#placeList.length > 0 || this.#placeLayer.stats.shown > 0)) {
|
|
319
|
+
this.#placeLayer.frame(orthoView(pose), [], [], this.#model.light === "lit" ? null : subsolarPoint(this.#model.time));
|
|
320
|
+
this.#notePlacesLost();
|
|
321
|
+
}
|
|
316
322
|
this.#pose = { ...pose, transform: "" };
|
|
317
323
|
this.#posing = true;
|
|
318
324
|
try {
|
|
@@ -322,10 +328,6 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
322
328
|
finally {
|
|
323
329
|
this.#posing = false;
|
|
324
330
|
}
|
|
325
|
-
if (this.#placeLayer && (this.#placeList.length > 0 || this.#placeLayer.stats.shown > 0)) {
|
|
326
|
-
this.#placeLayer.frame(orthoView(pose), [], [], this.#model.light === "lit" ? null : subsolarPoint(this.#model.time));
|
|
327
|
-
this.#notePlacesLost();
|
|
328
|
-
}
|
|
329
331
|
this.#cityFrame();
|
|
330
332
|
},
|
|
331
333
|
onPlaceRings: (drawn) => this.#ringsDrawn(drawn),
|
|
@@ -747,9 +749,40 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
747
749
|
return at.z;
|
|
748
750
|
},
|
|
749
751
|
};
|
|
750
|
-
this.#cities.frame(frame);
|
|
751
752
|
this.#nameFrame = frame;
|
|
753
|
+
this.#relayNames(true, false);
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Lays the names that come after the places and the markers out on the last frame, in the order of the layers: the cities' names clear of the places' names, rings and marks and of the markers' labels; the countries' names clear of those and the cities'; the stars' and constellations'
|
|
757
|
+
* names clear of all of them. `cities` says whether the cities are laid out again (a new frame), or only what follows them (the cities told that they changed); `sky` says whether the stars' names are laid out again, which a draw does itself after the names.
|
|
758
|
+
*/
|
|
759
|
+
#relayNames(cities, sky) {
|
|
760
|
+
if (cities && this.#nameFrame)
|
|
761
|
+
this.#cities?.frame(this.#nameFrame, this.#boxesBeforeCities());
|
|
752
762
|
this.#countryFrame();
|
|
763
|
+
if (sky)
|
|
764
|
+
this.#sky?.relayout();
|
|
765
|
+
}
|
|
766
|
+
/** What the cities' names keep off: what the places layer takes (names, rings, marks) and the markers' labels (a city is named beside its own dot, which a marker may sit on, so the marks are not kept clear of). The list is refilled, not made again. */
|
|
767
|
+
#beforeCities = [];
|
|
768
|
+
#boxesBeforeCities() {
|
|
769
|
+
const out = this.#beforeCities;
|
|
770
|
+
out.length = 0;
|
|
771
|
+
out.push(...(this.#placeLayer?.boxes ?? []));
|
|
772
|
+
for (const boxes of this.#claimedNames.values())
|
|
773
|
+
out.push(...boxes);
|
|
774
|
+
return out;
|
|
775
|
+
}
|
|
776
|
+
/** What the stars' and constellations' names keep off: everything before them, the cities' names last. The list is refilled, not made again. */
|
|
777
|
+
#beforeSky = [];
|
|
778
|
+
#boxesBeforeSky() {
|
|
779
|
+
const out = this.#beforeSky;
|
|
780
|
+
out.length = 0;
|
|
781
|
+
out.push(...(this.#placeLayer?.boxes ?? []));
|
|
782
|
+
for (const boxes of this.#claims.values())
|
|
783
|
+
out.push(...boxes);
|
|
784
|
+
out.push(...(this.#cities?.boxes ?? []));
|
|
785
|
+
return out;
|
|
753
786
|
}
|
|
754
787
|
/** The frame the names were last laid out on. */
|
|
755
788
|
#nameFrame = null;
|
|
@@ -838,19 +871,26 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
838
871
|
this.#listeners.add(listener);
|
|
839
872
|
return () => this.#listeners.delete(listener);
|
|
840
873
|
},
|
|
841
|
-
|
|
842
|
-
|
|
874
|
+
taken: () => this.#placeLayer?.boxes ?? [],
|
|
875
|
+
claim: (owner, boxes, names) => {
|
|
876
|
+
if (boxes.length === 0) {
|
|
843
877
|
this.#claims.delete(owner);
|
|
844
|
-
|
|
878
|
+
this.#claimedNames.delete(owner);
|
|
879
|
+
}
|
|
880
|
+
else {
|
|
845
881
|
this.#claims.set(owner, boxes);
|
|
882
|
+
this.#claimedNames.set(owner, names ?? boxes);
|
|
883
|
+
}
|
|
846
884
|
// laid out again only when the overlay changed between draws: at a draw the names are laid out after it anyway
|
|
847
885
|
if (!this.#posing)
|
|
848
|
-
this.#
|
|
886
|
+
this.#relayNames(true, true);
|
|
849
887
|
},
|
|
850
888
|
};
|
|
851
889
|
}
|
|
852
890
|
/** The boxes overlays on the element (markers) take, by overlay. */
|
|
853
891
|
#claims = new Map();
|
|
892
|
+
/** The part of each overlay's boxes that is its labels'. */
|
|
893
|
+
#claimedNames = new Map();
|
|
854
894
|
/** True while the overlays are told of a draw. */
|
|
855
895
|
#posing = false;
|
|
856
896
|
/** Where the view starts: longitude and latitude; the shared controls' yaw and tilt turn it from there. */
|
package/dist/sky/host.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export interface SkyHost {
|
|
|
11
11
|
refresh(): void;
|
|
12
12
|
/** The places where the sky's names must not go (the property `keepClear`): rectangles in the element's pixels, or elements of the page. `null` for none. */
|
|
13
13
|
setKeepClear(areas: readonly SkyKeepClear[] | null): void;
|
|
14
|
+
/** Lays the names out once more on the last frame, where a layer placed before this one has moved between draws (a marker list changed, city names arrived). Nothing happens when there is no frame or no name is asked for. */
|
|
15
|
+
relayout(): void;
|
|
14
16
|
/** The look of the names, as a partial hoshi-stars `LabelStyle` (the property `skyStyle`). */
|
|
15
17
|
setStyle(style: Partial<SkyLabelStyle>): void;
|
|
16
18
|
/** Picks a constellation by its IAU abbreviation (`Ori`), or lets it go (`null`): the property `constellation`. Sends no event. */
|
|
@@ -52,6 +54,16 @@ export interface SkyHostOptions {
|
|
|
52
54
|
importer?: () => Promise<typeof import("@johnmorrisdotca/hoshi-stars/sky-labels")>;
|
|
53
55
|
/** Brings hoshi-stars' `constellations` in, for the names of the figures: a dynamic import by default. */
|
|
54
56
|
constellations?: () => Promise<typeof import("@johnmorrisdotca/hoshi-stars/constellations")>;
|
|
57
|
+
/**
|
|
58
|
+
* The boxes the layers placed before the sky take in the picture just drawn (the places' names and marks, the markers' labels, the bodies' and the cities' names), as left, top, width and height from the picture's top left. No star name, ring or figure name goes over one.
|
|
59
|
+
* Read when the names are laid out; the element refills the same list, so nothing is made at a draw.
|
|
60
|
+
*/
|
|
61
|
+
taken?: () => readonly {
|
|
62
|
+
left: number;
|
|
63
|
+
top: number;
|
|
64
|
+
width: number;
|
|
65
|
+
height: number;
|
|
66
|
+
}[];
|
|
55
67
|
/** Brings a sky culture of hoshi-stars in (`western`, `japanese` or `chinese`): a dynamic import of the culture by default, a page's own (or a test's) where it has one. */
|
|
56
68
|
cultures?: (id: string) => Promise<Culture>;
|
|
57
69
|
}
|
package/dist/sky/host.js
CHANGED
|
@@ -86,7 +86,10 @@ export function createSkyHost(options) {
|
|
|
86
86
|
let covered;
|
|
87
87
|
/** The places the page asked to keep clear, and as boxes from the picture's top left: measured when something has changed (a resize, a new list), never at each frame. */
|
|
88
88
|
let keepList = [];
|
|
89
|
+
const pageKeep = [];
|
|
90
|
+
/** What the names keep off: the page's places (`pageKeep`) and the boxes the layers placed before the sky take (the pool `ext`, refilled at each layout). */
|
|
89
91
|
const keep = [];
|
|
92
|
+
const ext = [];
|
|
90
93
|
let keepStale = true;
|
|
91
94
|
let keepWatch;
|
|
92
95
|
let keepEvents = false;
|
|
@@ -104,7 +107,7 @@ export function createSkyHost(options) {
|
|
|
104
107
|
queuedFrame = true;
|
|
105
108
|
const run = () => {
|
|
106
109
|
queuedFrame = false;
|
|
107
|
-
if (module && last && (
|
|
110
|
+
if (module && last && (pageKeep.length > 0 || options.attribute("constellation-names") !== null || shownAbbr !== null))
|
|
108
111
|
compute();
|
|
109
112
|
};
|
|
110
113
|
if (typeof globalThis.requestAnimationFrame === "function")
|
|
@@ -131,7 +134,7 @@ export function createSkyHost(options) {
|
|
|
131
134
|
const measureKeep = (rewatch) => {
|
|
132
135
|
keepStale = false;
|
|
133
136
|
const items = keepItems();
|
|
134
|
-
|
|
137
|
+
pageKeep.length = 0;
|
|
135
138
|
if (items.length === 0) {
|
|
136
139
|
keepWatch?.disconnect();
|
|
137
140
|
return;
|
|
@@ -139,7 +142,7 @@ export function createSkyHost(options) {
|
|
|
139
142
|
const host = root.host;
|
|
140
143
|
const own = host.getBoundingClientRect();
|
|
141
144
|
for (const item of items)
|
|
142
|
-
|
|
145
|
+
pageKeep.push(keepBox(item, own));
|
|
143
146
|
if (!rewatch)
|
|
144
147
|
return;
|
|
145
148
|
// a box that grows or shrinks is read again and the layer laid out again; the observer is set again only when the list has changed
|
|
@@ -165,9 +168,27 @@ export function createSkyHost(options) {
|
|
|
165
168
|
function markStale() {
|
|
166
169
|
keepStale = true;
|
|
167
170
|
// scrolled or resized while something is kept clear: the names are laid out again at the next frame, once however many events
|
|
168
|
-
if (
|
|
171
|
+
if (pageKeep.length > 0)
|
|
169
172
|
later();
|
|
170
173
|
}
|
|
174
|
+
/** Joins the page's places and the boxes of the layers placed before: the objects are reused, nothing is made at a layout. */
|
|
175
|
+
function mergeKeep() {
|
|
176
|
+
keep.length = 0;
|
|
177
|
+
for (const one of pageKeep)
|
|
178
|
+
keep.push(one);
|
|
179
|
+
const others = options.taken?.();
|
|
180
|
+
if (!others)
|
|
181
|
+
return;
|
|
182
|
+
for (let i = 0; i < others.length; i += 1) {
|
|
183
|
+
const o = others[i];
|
|
184
|
+
const one = (ext[i] ??= { l: 0, t: 0, r: 0, b: 0 });
|
|
185
|
+
one.l = o.left;
|
|
186
|
+
one.t = o.top;
|
|
187
|
+
one.r = o.left + o.width;
|
|
188
|
+
one.b = o.top + o.height;
|
|
189
|
+
keep.push(one);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
171
192
|
let keepRewatch = true;
|
|
172
193
|
const attach = () => {
|
|
173
194
|
if (attached)
|
|
@@ -980,6 +1001,7 @@ export function createSkyHost(options) {
|
|
|
980
1001
|
measureKeep(keepRewatch);
|
|
981
1002
|
keepRewatch = false;
|
|
982
1003
|
}
|
|
1004
|
+
mergeKeep();
|
|
983
1005
|
takenStale = true;
|
|
984
1006
|
hulls.length = 0;
|
|
985
1007
|
if (names)
|
|
@@ -1059,6 +1081,10 @@ export function createSkyHost(options) {
|
|
|
1059
1081
|
configure();
|
|
1060
1082
|
compute();
|
|
1061
1083
|
},
|
|
1084
|
+
relayout() {
|
|
1085
|
+
if (module && wanted() && last)
|
|
1086
|
+
compute();
|
|
1087
|
+
},
|
|
1062
1088
|
setKeepClear(areas) {
|
|
1063
1089
|
keepList = areas ? [...areas] : [];
|
|
1064
1090
|
keepRewatch = true;
|
|
@@ -245,6 +245,7 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
245
245
|
language: () => ((this.closest("[lang]")?.getAttribute("lang") ?? "").toLowerCase().startsWith("ja") ? "ja" : "en"),
|
|
246
246
|
onError: (error) => this.dispatchEvent(new CustomEvent("chikyu-sky-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } })),
|
|
247
247
|
loadFont: loadMichroma,
|
|
248
|
+
taken: () => this.#boxesBeforeSky(),
|
|
248
249
|
});
|
|
249
250
|
this.#sky.setStyle(this.#skyStyle);
|
|
250
251
|
this.#sky.setKeepClear(this.#keepClear);
|
|
@@ -258,7 +259,7 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
258
259
|
attribute: (name) => this.getAttribute(name),
|
|
259
260
|
language: () => ((this.closest("[lang]")?.getAttribute("lang") ?? "").toLowerCase().startsWith("ja") ? "ja" : "en"),
|
|
260
261
|
onError: (error) => this.dispatchEvent(new CustomEvent("chikyu-city-names-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } })),
|
|
261
|
-
onLayout: () => this.#
|
|
262
|
+
onLayout: () => this.#relayNames(false, true),
|
|
262
263
|
});
|
|
263
264
|
this.#cities.setStyle(this.#citiesStyle);
|
|
264
265
|
Object.assign(this.#model.borders, readBorders(this.getAttribute("borders")));
|
|
@@ -298,6 +299,7 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
298
299
|
cap: () => this.#textureCap(),
|
|
299
300
|
air: () => airFor(this.getAttribute("air")),
|
|
300
301
|
invalidate: () => this.#gate?.request(),
|
|
302
|
+
onBodies: () => this.#showBodiesCredit(),
|
|
301
303
|
onError: (error) => this.#fail(error instanceof Error ? error.message : String(error)),
|
|
302
304
|
onTier: (layer, width) => {
|
|
303
305
|
this.#tiers[layer] = width;
|
|
@@ -486,15 +488,29 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
486
488
|
this.setAttribute("tiles", value);
|
|
487
489
|
}
|
|
488
490
|
/** The body painter's credit under the picture, in the element's or the page's language: shown while the painter draws the bodies (not `plain`), unless `bodies-credit` is `off`. */
|
|
491
|
+
/** The painter's credit as last told to the page (`chikyu-bodies-credit`): both languages, or empty for none. */
|
|
492
|
+
#creditKey = "";
|
|
489
493
|
#showBodiesCredit() {
|
|
490
494
|
const note = this.#bodiesNote;
|
|
491
495
|
if (!note)
|
|
492
496
|
return;
|
|
493
497
|
const lang = (this.closest("[lang]")?.getAttribute("lang") ?? "").toLowerCase().startsWith("ja") ? "ja" : "en";
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
+
// read again at each redraw a body asks for (a picture arrived, a window of tiles changed): a painter's credit names the pictures on the screen now. Written only when the text changed, never at every frame.
|
|
499
|
+
const given = painter?.credit;
|
|
500
|
+
// a page that writes the credit itself (`bodies-credit="off"`) hears when the painter's credit changed
|
|
501
|
+
const key = given ? `${given.en}\n${given.ja}` : "";
|
|
502
|
+
if (key !== this.#creditKey) {
|
|
503
|
+
this.#creditKey = key;
|
|
504
|
+
this.dispatchEvent(new CustomEvent("chikyu-bodies-credit", { detail: given ? { en: given.en, ja: given.ja } : null }));
|
|
505
|
+
}
|
|
506
|
+
const credit = given?.[lang] ?? "";
|
|
507
|
+
if (note.textContent !== credit)
|
|
508
|
+
note.textContent = credit;
|
|
509
|
+
if (note.lang !== lang)
|
|
510
|
+
note.lang = lang;
|
|
511
|
+
const hidden = credit === "" || this.bodies === "plain" || this.getAttribute("bodies-credit") === "off";
|
|
512
|
+
if (note.hidden !== hidden)
|
|
513
|
+
note.hidden = hidden;
|
|
498
514
|
}
|
|
499
515
|
/**
|
|
500
516
|
* True for the full-screen mode (the `immersive` attribute): the element fills its box in any shape (the Earth fits the shorter side with its glow inside it, `earth-size`), a plain wheel zooms instead of scrolling
|
|
@@ -705,9 +721,37 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
705
721
|
}
|
|
706
722
|
/** Tells the names of cities, then of countries, where the Earth is in the picture just drawn; the countries' names keep clear of the bodies', the places' and the cities'. */
|
|
707
723
|
#nameFrame(frame) {
|
|
708
|
-
this.#cities?.frame(frame);
|
|
709
724
|
this.#lastNameFrame = frame;
|
|
725
|
+
this.#relayNames(true, false);
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Lays the names that come after the places out on the last frame, in the order of the layers: the cities' names clear of the bodies' names and the places' names, rings and marks; the countries' names clear of those and the cities'; the stars' and constellations' names
|
|
729
|
+
* clear of all of them. `cities` says whether the cities are laid out again (a new frame), or only what follows them (the cities told that they changed); `sky` says whether the stars' names are laid out again, which a draw does itself after the names.
|
|
730
|
+
*/
|
|
731
|
+
#relayNames(cities, sky) {
|
|
732
|
+
if (cities)
|
|
733
|
+
this.#cities?.frame(this.#lastNameFrame, this.#boxesBeforeCities());
|
|
710
734
|
this.#countryFrame();
|
|
735
|
+
if (sky)
|
|
736
|
+
this.#sky?.relayout();
|
|
737
|
+
}
|
|
738
|
+
/** What the cities' names keep off: the bodies' names and what the places layer takes (names, rings, marks). The list is refilled, not made again. */
|
|
739
|
+
#beforeCities = [];
|
|
740
|
+
#boxesBeforeCities() {
|
|
741
|
+
const out = this.#beforeCities;
|
|
742
|
+
out.length = 0;
|
|
743
|
+
out.push(...this.#bodyNameBoxes(), ...(this.#placeLayer?.boxes ?? []));
|
|
744
|
+
return out;
|
|
745
|
+
}
|
|
746
|
+
/** What the stars' and constellations' names keep off: everything before them, the cities' names last. The list is refilled, not made again. */
|
|
747
|
+
#beforeSky = [];
|
|
748
|
+
#boxesBeforeSky() {
|
|
749
|
+
const out = this.#beforeSky;
|
|
750
|
+
out.length = 0;
|
|
751
|
+
if (!this.#lastNameFrame)
|
|
752
|
+
return out;
|
|
753
|
+
out.push(...this.#bodyNameBoxes(), ...(this.#placeLayer?.boxes ?? []), ...(this.#cities?.boxes ?? []));
|
|
754
|
+
return out;
|
|
711
755
|
}
|
|
712
756
|
/** The frame the names were last laid out on. */
|
|
713
757
|
#lastNameFrame = null;
|
package/dist/space/scene.d.ts
CHANGED
|
@@ -413,6 +413,8 @@ export interface SpaceDeps {
|
|
|
413
413
|
satellitePainter?: () => SatellitePainter | undefined;
|
|
414
414
|
/** The painter could not make a body (the three.js parts handed over lack something it needs); the body is drawn plain instead. */
|
|
415
415
|
onPainterError?: (error: unknown) => void;
|
|
416
|
+
/** A body the painter drew changed (a picture arrived, a window of its tiles changed, a body was made): the painter's credit, which names the pictures on the screen now, may have changed. Told before the redraw is asked for. */
|
|
417
|
+
onBodies?: () => void;
|
|
416
418
|
/** The map source of each layer now (the folder of the `tiles` attribute), or none: the Earth then keeps the package's own pictures. Read at every draw. */
|
|
417
419
|
sources?: () => TileSources;
|
|
418
420
|
/** Told once when the tile set has been read: the width in pixels of the finest level of each of its layers. */
|
package/dist/space/scene.js
CHANGED
|
@@ -250,6 +250,7 @@ export function createSpaceItem(model, deps) {
|
|
|
250
250
|
}
|
|
251
251
|
slot.drawing = made;
|
|
252
252
|
scene.add(made.object);
|
|
253
|
+
deps.onBodies?.();
|
|
253
254
|
deps.invalidate();
|
|
254
255
|
};
|
|
255
256
|
const fail = (error) => {
|
|
@@ -263,7 +264,7 @@ export function createSpaceItem(model, deps) {
|
|
|
263
264
|
}
|
|
264
265
|
};
|
|
265
266
|
try {
|
|
266
|
-
const made = (slot.plain || look === "plain" ? plainPainter : painter).make(three, slot.name, { look, invalidate: () => deps.invalidate(), ratio: model.ratio(), maxTexture: deps.cap(), mapped: true });
|
|
267
|
+
const made = (slot.plain || look === "plain" ? plainPainter : painter).make(three, slot.name, { look, invalidate: () => (deps.onBodies?.(), deps.invalidate()), ratio: model.ratio(), maxTexture: deps.cap(), mapped: true });
|
|
267
268
|
if (typeof made.then === "function")
|
|
268
269
|
made.then(arrive, fail);
|
|
269
270
|
else
|
|
@@ -832,6 +833,38 @@ export function createSpaceItem(model, deps) {
|
|
|
832
833
|
if (model.bodyLabel.settings && !nameOn)
|
|
833
834
|
nameOn = createBodyLabelLayer(three, earth, model.bodyLabel, { invalidate: () => deps.invalidate(), ...(deps.onLabelError ? { onError: deps.onLabelError } : {}) });
|
|
834
835
|
nameOn?.sync(camera, rideFrom ? 0 : Math.min(px.Earth, 1e5));
|
|
836
|
+
if (deps.onCities) {
|
|
837
|
+
if (hidden === "Earth")
|
|
838
|
+
deps.onCities(null);
|
|
839
|
+
else {
|
|
840
|
+
// a place on the ground, turned with the Earth (the Earth is at the middle, one unit in radius): in sight when the viewer is above its horizon, found through the camera
|
|
841
|
+
const ground = new three.Vector3();
|
|
842
|
+
const eye = camera.position;
|
|
843
|
+
const turned = earth.quaternion;
|
|
844
|
+
ground.set(0, 0, 0).project(camera);
|
|
845
|
+
const disc = { x: ((ground.x + 1) / 2) * size.width, y: ((1 - ground.y) / 2) * size.height, radius: Math.min(px.Earth, 1e5) };
|
|
846
|
+
deps.onCities({
|
|
847
|
+
width: size.width,
|
|
848
|
+
height: size.height,
|
|
849
|
+
radius: Math.min(px.Earth, 1e5),
|
|
850
|
+
...(ground.z > -1 && ground.z < 1 ? { disc } : {}),
|
|
851
|
+
project(lon, lat, out) {
|
|
852
|
+
const phi = lat * RAD;
|
|
853
|
+
const lambda = lon * RAD;
|
|
854
|
+
ground.set(Math.cos(phi) * Math.sin(lambda), Math.sin(phi), Math.cos(phi) * Math.cos(lambda)).applyQuaternion(turned);
|
|
855
|
+
const dx = eye.x - ground.x;
|
|
856
|
+
const dy = eye.y - ground.y;
|
|
857
|
+
const dz = eye.z - ground.z;
|
|
858
|
+
const facing = (ground.x * dx + ground.y * dy + ground.z * dz) / (Math.hypot(dx, dy, dz) || 1);
|
|
859
|
+
ground.project(camera);
|
|
860
|
+
out.x = ((ground.x + 1) / 2) * size.width;
|
|
861
|
+
out.y = ((1 - ground.y) / 2) * size.height;
|
|
862
|
+
return ground.z > 1 || ground.z < -1 ? -1 : facing;
|
|
863
|
+
},
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
// the sky after the places and the city names, so its names keep clear of what they take as it is laid out
|
|
835
868
|
if (deps.onSky) {
|
|
836
869
|
const sky = new three.Vector3();
|
|
837
870
|
// stars are directions: a point far along the direction from the camera, in the scene's axes (x to the vernal equinox, y north, z completing the hand), seen through the camera
|
|
@@ -869,37 +902,6 @@ export function createSpaceItem(model, deps) {
|
|
|
869
902
|
},
|
|
870
903
|
});
|
|
871
904
|
}
|
|
872
|
-
if (deps.onCities) {
|
|
873
|
-
if (hidden === "Earth")
|
|
874
|
-
deps.onCities(null);
|
|
875
|
-
else {
|
|
876
|
-
// a place on the ground, turned with the Earth (the Earth is at the middle, one unit in radius): in sight when the viewer is above its horizon, found through the camera
|
|
877
|
-
const ground = new three.Vector3();
|
|
878
|
-
const eye = camera.position;
|
|
879
|
-
const turned = earth.quaternion;
|
|
880
|
-
ground.set(0, 0, 0).project(camera);
|
|
881
|
-
const disc = { x: ((ground.x + 1) / 2) * size.width, y: ((1 - ground.y) / 2) * size.height, radius: Math.min(px.Earth, 1e5) };
|
|
882
|
-
deps.onCities({
|
|
883
|
-
width: size.width,
|
|
884
|
-
height: size.height,
|
|
885
|
-
radius: Math.min(px.Earth, 1e5),
|
|
886
|
-
...(ground.z > -1 && ground.z < 1 ? { disc } : {}),
|
|
887
|
-
project(lon, lat, out) {
|
|
888
|
-
const phi = lat * RAD;
|
|
889
|
-
const lambda = lon * RAD;
|
|
890
|
-
ground.set(Math.cos(phi) * Math.sin(lambda), Math.sin(phi), Math.cos(phi) * Math.cos(lambda)).applyQuaternion(turned);
|
|
891
|
-
const dx = eye.x - ground.x;
|
|
892
|
-
const dy = eye.y - ground.y;
|
|
893
|
-
const dz = eye.z - ground.z;
|
|
894
|
-
const facing = (ground.x * dx + ground.y * dy + ground.z * dz) / (Math.hypot(dx, dy, dz) || 1);
|
|
895
|
-
ground.project(camera);
|
|
896
|
-
out.x = ((ground.x + 1) / 2) * size.width;
|
|
897
|
-
out.y = ((1 - ground.y) / 2) * size.height;
|
|
898
|
-
return ground.z > 1 || ground.z < -1 ? -1 : facing;
|
|
899
|
-
},
|
|
900
|
-
});
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
905
|
if (layer && deps.onSelected) {
|
|
904
906
|
const at = model.satellites.selected ? layer.place(camera, size) : null;
|
|
905
907
|
if (at || selectedShown)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/chikyu-earth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "Chikyu Earth 地球 — A line-drawn globe for the web: country outlines that turn at the Earth's own rate, centred on the place you give it, with an optional realistic Earth from space (three.js), the Sun, Moon and planets, satellites on their orbits, and markers for any place. A web component and an SVG string.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"earth",
|
|
@@ -255,7 +255,7 @@
|
|
|
255
255
|
"@johnmorrisdotca/hata": "^1.8.0",
|
|
256
256
|
"@johnmorrisdotca/hoshi-stars": "^0.30.0",
|
|
257
257
|
"@johnmorrisdotca/kuni": "^1.6.1",
|
|
258
|
-
"@johnmorrisdotca/wakusei-planets": "^0.
|
|
258
|
+
"@johnmorrisdotca/wakusei-planets": "^0.39.0",
|
|
259
259
|
"@playwright/test": "1.64.0",
|
|
260
260
|
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
261
261
|
"@types/d3-geo": "^3.1.0",
|