@johnmorrisdotca/chikyu-earth 0.34.0 → 0.34.1
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 +5 -0
- package/README.md +1 -1
- package/dist/element.js +1 -1
- package/dist/realistic/earth.js +1 -1
- package/dist/realistic/element.js +1 -1
- package/dist/sky/cover.d.ts +48 -0
- package/dist/sky/cover.js +100 -0
- package/dist/sky/host.js +48 -18
- package/dist/space/element.js +1 -1
- package/dist/space/scene.d.ts +2 -0
- package/dist/space/scene.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.34.1 - 2026-11-11
|
|
6
|
+
|
|
7
|
+
- **The sky is behind the Earth: constellation lines no longer cross it** (MODULES-1103). The lines were drawn over the Earth's disc (in a ride, across the whole globe). Each line is now cut exactly at the Earth's edge, the air's rim included, in the picture's own camera, in the space view and in a ride at any height, on the day side and the night side. A star whose point, ring or name box touches the Earth, the Moon or the Sun has its name and ring left out (a name only partly on the Earth was shown before), and the figure under the pointer is not lit over the Earth.
|
|
8
|
+
- **The element is its own stacking context** (MODULES-1104). `<chikyu-earth>`, `<chikyu-earth-realistic>` and `<chikyu-space>` are each their own stacking context (`isolation: isolate`), so nothing inside the element (the sky's labels, its lines, its markers) takes part in the page's own stacking: it paints as one piece, where the element sits in the page.
|
|
9
|
+
|
|
5
10
|
## 0.34.0 - 2026-11-11
|
|
6
11
|
|
|
7
12
|
- **You are here, and places on the Earth** (MODULES-927). `<chikyu-space>` and `<chikyu-earth-realistic>` take `places`, a list of `{ id, lon, lat, label, kind }` (attribute as JSON, or property), and draw each as a marker standing out of the ground: it turns with the Earth, is hidden on the far side, fades at the edge and keeps its size in pixels at any zoom. `kind: "here"` is the reader's place (taller, brighter, a quiet pulse at its foot); a `favourite` is quieter. `places-look` is `beam` (the default), `pin` or `ring`; colours come from `--chikyu-place-here` and `--chikyu-place-favourite`. Names sit at the top of the markers, `here` first, measured in the page's font and never over one another or the bodies' names. Nothing is drawn again at rest: the places are laid out with the picture, and the pulse is a CSS animation, stopped out of sight and for a reader who asked for less motion. `stats.places` says how many are drawn and named. The package never asks for the reader's place and stores or sends nothing; `nearby` (in `/markers`, with `readPlaces`, `cleanPlaces`, `orthoView` and `layoutPlaces`) rounds a place to about 10 km before a page draws or keeps it. `placeLabels` takes boxes already used by another layer. The demo has "Show where I am" (asked only on the press, rounded, never put in the address) and the three looks. New guide: "You are here, and places on the Earth".
|
package/README.md
CHANGED
|
@@ -590,7 +590,7 @@ console.log(countryList().filter((country) => country.alpha2 === null).map((coun
|
|
|
590
590
|
|
|
591
591
|
## How to cite
|
|
592
592
|
|
|
593
|
-
> Morris, J. (2026). *Chikyu Earth* (version 0.34.
|
|
593
|
+
> Morris, J. (2026). *Chikyu Earth* (version 0.34.1) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
|
|
594
594
|
|
|
595
595
|
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.
|
|
596
596
|
|
package/dist/element.js
CHANGED
|
@@ -21,7 +21,7 @@ const LIVE_MS = 1000 / 30;
|
|
|
21
21
|
const AUTO_MS = 1000;
|
|
22
22
|
/** Tilt to the poles; zoom from a tenth of Fit, which leaves the whole globe small in the view, to 20 times: the outlines are Natural Earth 1:110m, and past about 20 times their straight segments are longer than the view is wide. */
|
|
23
23
|
const LIMITS = { tiltMax: 90, zoomMin: 0.1, zoomMax: 20 };
|
|
24
|
-
const STYLE = ":host{display:block;position:relative}.holder svg{display:block;width:100%;height:auto}.overlay{position:absolute;inset:0;pointer-events:none;transform-origin:50% 50%}";
|
|
24
|
+
const STYLE = ":host{display:block;position:relative;isolation:isolate}.holder svg{display:block;width:100%;height:auto}.overlay{position:absolute;inset:0;pointer-events:none;transform-origin:50% 50%}";
|
|
25
25
|
/**
|
|
26
26
|
* The `<chikyu-earth>` custom element: the line globe, drawn as SVG in its shadow root. Importing this entry point registers the tag once. It takes the attributes `size` (pixels, 320 by default), `center` (`"lon,lat"`; wins over the browser's location), `look` (`line` or `thick`; `style` is the older name for it, and a framework that reads `style` as CSS cannot use it) and `graticule`, and a shared view controller's camera through `setView`.
|
|
27
27
|
* It carries kazoku-ui's controls itself: a drag turns it, two fingers pinch, Ctrl and the wheel zoom (a plain wheel at Fit scrolls the page) and the arrow keys, + and - work once it is focused, from a tenth of Fit to 20 times. `controls="none"` turns them off; `zoom-min` and `zoom-max` change the range. A `<kazoku-view-controls for="...">` on the element takes the hands over, and the page applies its events with `setView`.
|
package/dist/realistic/earth.js
CHANGED
|
@@ -244,7 +244,7 @@ export function createEarthItem(model, deps) {
|
|
|
244
244
|
deps.onSky({
|
|
245
245
|
width: size.width,
|
|
246
246
|
height: size.height,
|
|
247
|
-
discs: [{ x: cx, y: cy, radius }],
|
|
247
|
+
discs: [{ x: cx, y: cy, radius: radius * airTop(model.airThickness) }],
|
|
248
248
|
project(rightAscension, declination, out) {
|
|
249
249
|
const r = rightAscension * RAD;
|
|
250
250
|
const d = declination * RAD;
|
|
@@ -23,7 +23,7 @@ import { createGate, frameCap } from "./gate.js";
|
|
|
23
23
|
import { setSharedRenderer, setThreeLoader, takeRenderer } from "./shared.js";
|
|
24
24
|
export { setSharedRenderer, setThreeLoader };
|
|
25
25
|
import { MAX_TEXTURE, TIERS } from "./tiers.js";
|
|
26
|
-
const STYLE = ":host{display:block;aspect-ratio:1/1;position:relative}:host([immersive]){aspect-ratio:auto;width:100%;height:100%;touch-action:none!important;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}#stage,#overlay{position:absolute;inset:0}#overlay{pointer-events:none}" + PLACE_STYLE + SKY_STYLE + CITY_NAMES_STYLE + METEOR_NOTE_STYLE + NOTES_STYLE;
|
|
26
|
+
const STYLE = ":host{display:block;aspect-ratio:1/1;position:relative;isolation:isolate}:host([immersive]){aspect-ratio:auto;width:100%;height:100%;touch-action:none!important;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}#stage,#overlay{position:absolute;inset:0}#overlay{pointer-events:none}" + PLACE_STYLE + SKY_STYLE + CITY_NAMES_STYLE + METEOR_NOTE_STYLE + NOTES_STYLE;
|
|
27
27
|
const RAD = Math.PI / 180;
|
|
28
28
|
/** The Sun and the clouds are re-placed this often at real time: 15 degrees an hour is 0.25 degree a minute. */
|
|
29
29
|
const LIVE_TICK_MS = 60_000;
|
package/dist/sky/cover.d.ts
CHANGED
|
@@ -25,3 +25,51 @@ export declare function coverBody(position: readonly number[], camera: readonly
|
|
|
25
25
|
* @returns True where the ray meets a body.
|
|
26
26
|
*/
|
|
27
27
|
export declare function covers(bodies: readonly CoverBody[], x: number, y: number, z: number): boolean;
|
|
28
|
+
/** What `pathOutside` draws with: a canvas's context. */
|
|
29
|
+
export interface Path {
|
|
30
|
+
moveTo(x: number, y: number): void;
|
|
31
|
+
lineTo(x: number, y: number): void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Adds a segment to the path, less the part of it a body covers. What a body covers of the picture is convex (a disc, or an ellipse towards the edges of a wide view), so a line meets it once at most: the segment is walked in short steps, and where one step
|
|
35
|
+
* is covered and the next is not, the edge between them is found by halving. Nothing is made; the path takes the pieces.
|
|
36
|
+
*
|
|
37
|
+
* @param path - The path to add the pieces to (a canvas's context).
|
|
38
|
+
* @param x0 - The segment's start, x.
|
|
39
|
+
* @param y0 - The start, y.
|
|
40
|
+
* @param x1 - The end, x.
|
|
41
|
+
* @param y1 - The end, y.
|
|
42
|
+
* @param covered - Whether a body covers a point of the picture, or `undefined` where none does.
|
|
43
|
+
* @param inset - How far, in pixels, a piece is held back from the edge it is cut at: half the line's width and its round end, so the stroke stays off the body.
|
|
44
|
+
*/
|
|
45
|
+
export declare function pathOutside(path: Path, x0: number, y0: number, x1: number, y1: number, covered: ((x: number, y: number) => boolean) | undefined, inset?: number): void;
|
|
46
|
+
/**
|
|
47
|
+
* Whether any part of a label is on a body: the corners and the middle of the name's edges, the star's own point and eight points of the ring round it, and the end of its leader.
|
|
48
|
+
*
|
|
49
|
+
* @param covered - Whether a body covers a point of the picture.
|
|
50
|
+
* @param left - The name's box, from the picture's top left.
|
|
51
|
+
* @param top - The box's top.
|
|
52
|
+
* @param right - The box's right.
|
|
53
|
+
* @param bottom - The box's bottom.
|
|
54
|
+
* @param label - The star's label, for its point, ring and leader.
|
|
55
|
+
* @returns True where some part is over a body.
|
|
56
|
+
*/
|
|
57
|
+
export declare function touches(covered: (x: number, y: number) => boolean, left: number, top: number, right: number, bottom: number, label: {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
ring: number;
|
|
61
|
+
leader?: boolean;
|
|
62
|
+
leaderX1: number;
|
|
63
|
+
leaderY1: number;
|
|
64
|
+
}): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Whether any part of a box is on a body: its corners and the middle of its edges.
|
|
67
|
+
*
|
|
68
|
+
* @param covered - Whether a body covers a point of the picture.
|
|
69
|
+
* @param left - The box's left.
|
|
70
|
+
* @param top - The top.
|
|
71
|
+
* @param right - The right.
|
|
72
|
+
* @param bottom - The bottom.
|
|
73
|
+
* @returns True where some part is over a body.
|
|
74
|
+
*/
|
|
75
|
+
export declare function boxCovered(covered: (x: number, y: number) => boolean, left: number, top: number, right: number, bottom: number): boolean;
|
package/dist/sky/cover.js
CHANGED
|
@@ -30,3 +30,103 @@ export function covers(bodies, x, y, z) {
|
|
|
30
30
|
return true;
|
|
31
31
|
return false;
|
|
32
32
|
}
|
|
33
|
+
/** How far apart, in pixels, a line is tested for the cover: a line that dips under the edge of a body for less is not seen to (at the edge of a large body, a chord of this length is less than a pixel deep). */
|
|
34
|
+
const CLIP_STEP = 6;
|
|
35
|
+
/** How many times the edge of a body is halved to find where a line meets it: 6 narrows a step to a tenth of a pixel. */
|
|
36
|
+
const CLIP_HALVINGS = 6;
|
|
37
|
+
/**
|
|
38
|
+
* Adds a segment to the path, less the part of it a body covers. What a body covers of the picture is convex (a disc, or an ellipse towards the edges of a wide view), so a line meets it once at most: the segment is walked in short steps, and where one step
|
|
39
|
+
* is covered and the next is not, the edge between them is found by halving. Nothing is made; the path takes the pieces.
|
|
40
|
+
*
|
|
41
|
+
* @param path - The path to add the pieces to (a canvas's context).
|
|
42
|
+
* @param x0 - The segment's start, x.
|
|
43
|
+
* @param y0 - The start, y.
|
|
44
|
+
* @param x1 - The end, x.
|
|
45
|
+
* @param y1 - The end, y.
|
|
46
|
+
* @param covered - Whether a body covers a point of the picture, or `undefined` where none does.
|
|
47
|
+
* @param inset - How far, in pixels, a piece is held back from the edge it is cut at: half the line's width and its round end, so the stroke stays off the body.
|
|
48
|
+
*/
|
|
49
|
+
export function pathOutside(path, x0, y0, x1, y1, covered, inset = 0) {
|
|
50
|
+
if (!covered) {
|
|
51
|
+
path.moveTo(x0, y0);
|
|
52
|
+
path.lineTo(x1, y1);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const dx = x1 - x0;
|
|
56
|
+
const dy = y1 - y0;
|
|
57
|
+
const length = Math.hypot(dx, dy);
|
|
58
|
+
const steps = Math.max(1, Math.ceil(length / CLIP_STEP));
|
|
59
|
+
const back = length > 0 ? inset / length : 0;
|
|
60
|
+
let hidden = covered(x0, y0);
|
|
61
|
+
/** Where the piece being walked began along the segment (0 to 1), or -1 while it is under a body. */
|
|
62
|
+
let from = hidden ? -1 : 0;
|
|
63
|
+
let before = 0;
|
|
64
|
+
for (let i = 1; i <= steps; i += 1) {
|
|
65
|
+
const t = i / steps;
|
|
66
|
+
const now = covered(x0 + dx * t, y0 + dy * t);
|
|
67
|
+
if (now !== hidden) {
|
|
68
|
+
// the edge lies between `before` and `t`: `seen` is the side outside the body
|
|
69
|
+
let seen = hidden ? t : before;
|
|
70
|
+
let under = hidden ? before : t;
|
|
71
|
+
for (let h = 0; h < CLIP_HALVINGS; h += 1) {
|
|
72
|
+
const mid = (seen + under) / 2;
|
|
73
|
+
if (covered(x0 + dx * mid, y0 + dy * mid))
|
|
74
|
+
under = mid;
|
|
75
|
+
else
|
|
76
|
+
seen = mid;
|
|
77
|
+
}
|
|
78
|
+
if (now) {
|
|
79
|
+
const end = Math.max(from, seen - back);
|
|
80
|
+
path.moveTo(x0 + dx * from, y0 + dy * from);
|
|
81
|
+
path.lineTo(x0 + dx * end, y0 + dy * end);
|
|
82
|
+
from = -1;
|
|
83
|
+
}
|
|
84
|
+
else
|
|
85
|
+
from = Math.min(1, seen + back);
|
|
86
|
+
hidden = now;
|
|
87
|
+
}
|
|
88
|
+
before = t;
|
|
89
|
+
}
|
|
90
|
+
if (!hidden && from <= 1) {
|
|
91
|
+
path.moveTo(x0 + dx * from, y0 + dy * from);
|
|
92
|
+
path.lineTo(x1, y1);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Whether any part of a label is on a body: the corners and the middle of the name's edges, the star's own point and eight points of the ring round it, and the end of its leader.
|
|
97
|
+
*
|
|
98
|
+
* @param covered - Whether a body covers a point of the picture.
|
|
99
|
+
* @param left - The name's box, from the picture's top left.
|
|
100
|
+
* @param top - The box's top.
|
|
101
|
+
* @param right - The box's right.
|
|
102
|
+
* @param bottom - The box's bottom.
|
|
103
|
+
* @param label - The star's label, for its point, ring and leader.
|
|
104
|
+
* @returns True where some part is over a body.
|
|
105
|
+
*/
|
|
106
|
+
export function touches(covered, left, top, right, bottom, label) {
|
|
107
|
+
if (boxCovered(covered, left, top, right, bottom))
|
|
108
|
+
return true;
|
|
109
|
+
if (covered(label.x, label.y))
|
|
110
|
+
return true;
|
|
111
|
+
// the ring is drawn a pixel wide and round: eight points of it, a pixel out
|
|
112
|
+
const ring = label.ring + 1;
|
|
113
|
+
const diagonal = ring * 0.7071;
|
|
114
|
+
if (label.ring > 0 && (covered(label.x - ring, label.y) || covered(label.x + ring, label.y) || covered(label.x, label.y - ring) || covered(label.x, label.y + ring) || covered(label.x - diagonal, label.y - diagonal) || covered(label.x + diagonal, label.y - diagonal) || covered(label.x - diagonal, label.y + diagonal) || covered(label.x + diagonal, label.y + diagonal)))
|
|
115
|
+
return true;
|
|
116
|
+
return Boolean(label.leader) && covered(label.leaderX1, label.leaderY1);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Whether any part of a box is on a body: its corners and the middle of its edges.
|
|
120
|
+
*
|
|
121
|
+
* @param covered - Whether a body covers a point of the picture.
|
|
122
|
+
* @param left - The box's left.
|
|
123
|
+
* @param top - The top.
|
|
124
|
+
* @param right - The right.
|
|
125
|
+
* @param bottom - The bottom.
|
|
126
|
+
* @returns True where some part is over a body.
|
|
127
|
+
*/
|
|
128
|
+
export function boxCovered(covered, left, top, right, bottom) {
|
|
129
|
+
const middle = (left + right) / 2;
|
|
130
|
+
const centre = (top + bottom) / 2;
|
|
131
|
+
return covered(left, top) || covered(middle, top) || covered(right, top) || covered(left, bottom) || covered(middle, bottom) || covered(right, bottom) || covered(left, centre) || covered(right, centre);
|
|
132
|
+
}
|
package/dist/sky/host.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { canvasRatio } from "../markers/project.js";
|
|
2
|
+
import { boxCovered, pathOutside, touches } from "./cover.js";
|
|
2
3
|
/** The styles of the layer, for an element to add to its own (`#sk-canvas`, `#sk-names` and the labels in its shadow root). */
|
|
3
4
|
export const SKY_STYLE = "#sk-canvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}#sk-names{position:absolute;inset:0;overflow:hidden;pointer-events:none}" +
|
|
4
5
|
".sk-name,.sk-figure,.sk-designation{position:absolute;left:0;top:0;margin:0;white-space:nowrap;pointer-events:none;font-family:var(--hoshi-label-font,Michroma,system-ui,sans-serif);font-size:calc(var(--hoshi-label-size,11) * 1px);font-weight:var(--hoshi-label-weight,400);color:var(--hoshi-label-colour,#e9f1ff);letter-spacing:calc(var(--hoshi-label-letter-spacing,.14) * 1em);font-variant:var(--hoshi-label-case-variant,small-caps);text-transform:var(--hoshi-label-case-transform,none);text-shadow:0 0 calc(var(--hoshi-label-halo-width,3) * 1px) var(--hoshi-label-halo,#0a1230)}" +
|
|
@@ -62,7 +63,8 @@ export function createSkyHost(options) {
|
|
|
62
63
|
if (!lines || event.pointerType === "touch")
|
|
63
64
|
return;
|
|
64
65
|
const at = place(event);
|
|
65
|
-
|
|
66
|
+
// the lines on the Earth are not drawn, so none is lit there
|
|
67
|
+
if ((covered?.(at.x, at.y) ? lines.point() : lines.point(at.x, at.y)))
|
|
66
68
|
drawLines();
|
|
67
69
|
});
|
|
68
70
|
host.addEventListener("pointerleave", (event) => {
|
|
@@ -75,7 +77,7 @@ export function createSkyHost(options) {
|
|
|
75
77
|
if (!lines || event.pointerType !== "touch")
|
|
76
78
|
return;
|
|
77
79
|
const at = place(event);
|
|
78
|
-
if (lines.point(at.x, at.y))
|
|
80
|
+
if ((covered?.(at.x, at.y) ? lines.point() : lines.point(at.x, at.y)))
|
|
79
81
|
drawLines();
|
|
80
82
|
});
|
|
81
83
|
};
|
|
@@ -91,6 +93,34 @@ export function createSkyHost(options) {
|
|
|
91
93
|
context?.setTransform(ratio, 0, 0, ratio, 0, 0);
|
|
92
94
|
return context;
|
|
93
95
|
};
|
|
96
|
+
const spot = { x: 0, y: 0 };
|
|
97
|
+
/**
|
|
98
|
+
* Where the picked figure's name goes: where hoshi-stars put it, or, where a body covers that, the nearest place round it that is clear of every body and inside the picture. Answers `null` where there is none. The name's box is set from its middle, the way it is drawn (up from its point, centred).
|
|
99
|
+
*/
|
|
100
|
+
function placeFigureName(x, y, frame) {
|
|
101
|
+
if (!covered) {
|
|
102
|
+
spot.x = x;
|
|
103
|
+
spot.y = y;
|
|
104
|
+
return spot;
|
|
105
|
+
}
|
|
106
|
+
const box = typeof figureName.getBoundingClientRect === "function" ? figureName.getBoundingClientRect() : undefined;
|
|
107
|
+
const w = box && box.width > 0 ? box.width : 80;
|
|
108
|
+
const h = box && box.height > 0 ? box.height : 14;
|
|
109
|
+
let best = Number.POSITIVE_INFINITY;
|
|
110
|
+
for (const down of [0, -1, 1, -2, 2, -3, 3, -4, 4]) {
|
|
111
|
+
for (const across of [0, -0.5, 0.5, -1, 1, -1.5, 1.5]) {
|
|
112
|
+
const cx = Math.max(w / 2 + 2, Math.min(frame.width - w / 2 - 2, x + across * w));
|
|
113
|
+
const cy = Math.max(h + 2, Math.min(frame.height - 2, y + down * h * 1.4));
|
|
114
|
+
const away = Math.abs(cx - x) + Math.abs(cy - y);
|
|
115
|
+
if (away < best && !boxCovered(covered, cx - w / 2, cy - h, cx + w / 2, cy)) {
|
|
116
|
+
best = away;
|
|
117
|
+
spot.x = cx;
|
|
118
|
+
spot.y = cy;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return best === Number.POSITIVE_INFINITY ? null : spot;
|
|
123
|
+
}
|
|
94
124
|
/** The lines and the rings, and the names: drawn again from what `update` laid out. */
|
|
95
125
|
function drawLines() {
|
|
96
126
|
const frame = last;
|
|
@@ -111,10 +141,8 @@ export function createSkyHost(options) {
|
|
|
111
141
|
continue;
|
|
112
142
|
context.globalAlpha = opacity;
|
|
113
143
|
context.beginPath();
|
|
114
|
-
for (let i = figure.start; i < figure.end; i += 1)
|
|
115
|
-
context
|
|
116
|
-
context.lineTo(lines.segments[i * 4 + 2], lines.segments[i * 4 + 3]);
|
|
117
|
-
}
|
|
144
|
+
for (let i = figure.start; i < figure.end; i += 1)
|
|
145
|
+
pathOutside(context, lines.segments[i * 4], lines.segments[i * 4 + 1], lines.segments[i * 4 + 2], lines.segments[i * 4 + 3], covered, 0.75);
|
|
118
146
|
context.stroke();
|
|
119
147
|
}
|
|
120
148
|
context.globalAlpha = 1;
|
|
@@ -148,7 +176,11 @@ export function createSkyHost(options) {
|
|
|
148
176
|
figureName.hidden = false;
|
|
149
177
|
if (figureName.textContent !== name.text)
|
|
150
178
|
figureName.textContent = name.text;
|
|
151
|
-
|
|
179
|
+
const at = placeFigureName(name.x, name.y, frame);
|
|
180
|
+
if (at)
|
|
181
|
+
figureName.style.transform = `translate(${Math.round(at.x)}px,${Math.round(at.y)}px) translate(-50%,-100%)`;
|
|
182
|
+
else
|
|
183
|
+
figureName.hidden = true;
|
|
152
184
|
}
|
|
153
185
|
else
|
|
154
186
|
figureName.hidden = true;
|
|
@@ -217,18 +249,16 @@ export function createSkyHost(options) {
|
|
|
217
249
|
continue;
|
|
218
250
|
}
|
|
219
251
|
const rect = name.getBoundingClientRect();
|
|
220
|
-
// a name
|
|
252
|
+
// no part of a name or of its ring is drawn over a body (the Earth, the Moon, the Sun): the sky is behind them. hoshi-stars tests the star's own point only, so a name set beside a star at the Earth's edge can run onto it, and the label (name, ring and all) is left out
|
|
221
253
|
const own = covered ? root.host.getBoundingClientRect() : undefined;
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
continue;
|
|
231
|
-
}
|
|
254
|
+
// the catalogue letter set under the name is part of the label
|
|
255
|
+
const under = designations[i].hidden || typeof designations[i].getBoundingClientRect !== "function" ? undefined : designations[i].getBoundingClientRect();
|
|
256
|
+
const bottom = under ? Math.max(rect.bottom, under.bottom) : rect.bottom;
|
|
257
|
+
if (covered && own && touches(covered, rect.left - own.left, rect.top - own.top, rect.right - own.left, bottom - own.top, names.labels[i])) {
|
|
258
|
+
name.hidden = true;
|
|
259
|
+
designations[i].hidden = true;
|
|
260
|
+
culled.push(true);
|
|
261
|
+
continue;
|
|
232
262
|
}
|
|
233
263
|
const over = kept.some((one) => rect.left < one.r && rect.right > one.l && rect.top < one.b && rect.bottom > one.t);
|
|
234
264
|
if (over) {
|
package/dist/space/element.js
CHANGED
|
@@ -98,7 +98,7 @@ const readTime = (value) => {
|
|
|
98
98
|
const ms = Date.parse(value);
|
|
99
99
|
return Number.isFinite(ms) ? ms : "now";
|
|
100
100
|
};
|
|
101
|
-
const 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}.sp-sat{position:absolute;left:0;top:0;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-sat[hidden]{display:none}${PLACE_STYLE}${SKY_STYLE}${CITY_NAMES_STYLE}${METEOR_NOTE_STYLE}${NOTES_STYLE}`;
|
|
101
|
+
const STYLE = `:host{display:block;aspect-ratio:1/1;position:relative;overflow:hidden;isolation:isolate}#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}.sp-sat{position:absolute;left:0;top:0;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-sat[hidden]{display:none}${PLACE_STYLE}${SKY_STYLE}${CITY_NAMES_STYLE}${METEOR_NOTE_STYLE}${NOTES_STYLE}`;
|
|
102
102
|
/**
|
|
103
103
|
* The `<chikyu-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`, `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`), `labels` and `orbits` (`off` hides them); positions are computed in the browser by astronomy-engine, an optional peer dependency. It draws only when something changes, and nothing while it is out of sight.
|
|
104
104
|
*
|
package/dist/space/scene.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export declare function fitDistance(size: number, aspect: number): number;
|
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
export type CameraMode = "ground" | "space" | "sun";
|
|
49
|
+
/** A moon that has been out of sight this long is let go (its pictures too). */
|
|
50
|
+
export declare const MOON_KEEP_MS = 4000;
|
|
49
51
|
/**
|
|
50
52
|
* The eleven bodies the space view places, names and lets a reader choose: the Earth, the Sun, the Moon, the seven other planets and Pluto.
|
|
51
53
|
*
|
package/dist/space/scene.js
CHANGED
|
@@ -41,7 +41,7 @@ const LAYERS = ["day", "night", "clouds", "water", "moon"];
|
|
|
41
41
|
const MOON_MIN_PLANET_PX = 4;
|
|
42
42
|
const MOON_MIN_PX = 2.2;
|
|
43
43
|
/** A moon that has been out of sight this long is let go (its pictures too). */
|
|
44
|
-
const MOON_KEEP_MS = 4000;
|
|
44
|
+
export const MOON_KEEP_MS = 4000;
|
|
45
45
|
const PLAIN_COLOR = (name) => (name === "Sun" ? "#ffb347" : COLORS[name] ?? "#9a948b");
|
|
46
46
|
/**
|
|
47
47
|
* The eleven bodies the space view places, names and lets a reader choose: the Earth, the Sun, the Moon, the seven other planets and Pluto.
|
|
@@ -734,7 +734,7 @@ export function createSpaceItem(model, deps) {
|
|
|
734
734
|
}
|
|
735
735
|
// a body covers the sky where the ray through a pixel passes within the body's angular radius of its centre: exact for any field of view, where a circle on the screen is right only on the axis
|
|
736
736
|
const ray = new three.Vector3();
|
|
737
|
-
const bodies = ["Earth", "Moon", "Sun"].map((name) => coverBody(pos[name], [camera.position.x, camera.position.y, camera.position.z], radiusOf(name)));
|
|
737
|
+
const bodies = ["Earth", "Moon", "Sun"].map((name) => coverBody(pos[name], [camera.position.x, camera.position.y, camera.position.z], name === "Earth" ? radiusOf(name) * airTop(model.airThickness) : radiusOf(name)));
|
|
738
738
|
deps.onSky({
|
|
739
739
|
width: size.width,
|
|
740
740
|
height: size.height,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/chikyu-earth",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.1",
|
|
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",
|