@johnmorrisdotca/wakusei-planets 0.26.0 → 0.26.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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.26.1] - 2026-11-09
6
+
7
+ - A planet off the middle of the view is no longer cut by a straight edge (MODULES-739, MODULES-742 part 4). The body, the space view and their pictures fill the whole stage, and the pan, the roll and the turn agree with the shape of the view: the shaded body's pan is in the pixels the controls say on a wide or tall view (it moved by the aspect ratio too far), the portrait's 3D view no longer moves everything twice as far as a pan asks (its camera was put at the centre of the view and the window was too), the body and the space view are laid on the view with its four edges (WebKit left the body as tall as it is wide), and the gesture tests take the square in the middle where they turn a picture. `checkGestures` also runs on the star page and the embed page (a body, and a flat portrait).
8
+
5
9
  ## [0.26.0] - 2026-11-09
6
10
 
7
11
  - **The compressed scale keeps the order of the orbits** (MODULES-742). The Moon was drawn outside Venus's orbit (10 Earth radii out, with the Sun 44 away) and the Earth was not on its own orbit. The Moon is now 3.5 Earth radii out and an astronomical unit is 70 Earth radii; the Sun, the bodies and the orbit lines (the Earth's too) all go through one mapping, `placeBodies` and `orbitLine`, so every body lies on its own orbit line, and the moons of Mars, Jupiter, Saturn, Uranus, Neptune and Pluto are drawn nearer when they would cross the next planet's orbit (`moonDistance`). Tests: every body is on its orbit line at four dates in both scales, and no moon's orbit reaches a neighbouring planet's. `SUN_COMPRESSED` is 70 (was 44) and `MOON_COMPRESSED` 3.5 (was 10).
package/README.md CHANGED
@@ -15,9 +15,9 @@ A clean line drawing, a shaded realistic drawing, or a painted surface map, with
15
15
 
16
16
  <p align="center"><a href="https://johnmorrisdotca.github.io/wakusei-planets/"><strong>Open the demo →</strong></a> · <a href="https://johnmorrisdotca.github.io/wakusei-planets/embed.html">Embed page</a> · <a href="https://johnmorrisdotca.github.io/wakusei-planets/docs/">Docs</a></p>
17
17
 
18
- <p align="center"><img alt="Jupiter and Saturn drawn in the realistic look, and Saturn as a line drawing" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.26.0/docs/images/hero-desk.png" width="640"></p>
18
+ <p align="center"><img alt="Jupiter and Saturn drawn in the realistic look, and Saturn as a line drawing" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.26.1/docs/images/hero-desk.png" width="640"></p>
19
19
 
20
- <p align="center"><img alt="Every body at one scale, the Earth among them: each small body has a magnified picture joined by a line, and the Sun shows only its edge" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.26.0/docs/images/lineup-desk.png" width="640"></p>
20
+ <p align="center"><img alt="Every body at one scale, the Earth among them: each small body has a magnified picture joined by a line, and the Sun shows only its edge" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.26.1/docs/images/lineup-desk.png" width="640"></p>
21
21
 
22
22
  ## One minute
23
23
 
@@ -290,7 +290,7 @@ A body that turns by itself and a moving sky, in HTML:
290
290
 
291
291
  ## The portrait builder
292
292
 
293
- <p align="center"><img alt="The Sun and the planets in an arc, painted, with their names, in the portrait builder" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.26.0/docs/images/portrait-family.png" width="640"></p>
293
+ <p align="center"><img alt="The Sun and the planets in an arc, painted, with their names, in the portrait builder" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.26.1/docs/images/portrait-family.png" width="640"></p>
294
294
 
295
295
  [The portrait builder](https://johnmorrisdotca.github.io/wakusei-planets/portrait.html) puts any bodies in one picture: drag them, size them, turn them, order them front to back, arrange them in a row, an arc, a grid or at true orbit distance (true or readable sizes, a planet's moons round it in orbit order), light them from one direction, and take the code, a PNG or an SVG. The scene is kept in the address, and every body is drawn in one WebGL scene, so the page holds one WebGL context. [The portrait builder](docs/guides/portrait-builder.md) is its guide.
296
296
 
package/dist/element.js CHANGED
@@ -157,7 +157,8 @@ export class WakuseiBody extends HTMLElement {
157
157
  };
158
158
  /** The radius of the body's disc on the screen in CSS pixels, at the picture's own size: what `grab-radius` on the shared view controls wants for a drag that keeps the touched point under the pointer. */
159
159
  get discRadius() {
160
- return (this.getBoundingClientRect().width / 2) * this.#fill();
160
+ const { width, height } = this.getBoundingClientRect();
161
+ return (Math.min(width, height) / 2) * this.#fill();
161
162
  }
162
163
  get body() {
163
164
  if (this.hasAttribute("star"))
@@ -286,7 +287,7 @@ export class WakuseiBody extends HTMLElement {
286
287
  }
287
288
  /** The shared controllers' camera: `yaw` turns the body about its pole, `tilt` tips its top away from you as it grows (a drag up moves the surface up), `roll` turns the picture clockwise about the line of sight, `zoom` scales it, and `panX` and `panY` move it by that many CSS pixels from the middle. */
288
289
  setView(view) {
289
- const half = Math.max(1, this.clientWidth) / 2;
290
+ const half = Math.max(1, Math.min(this.clientWidth, this.clientHeight)) / 2;
290
291
  const [yaw, tilt, roll, zoom, panX, panY] = [view.yaw ?? 0, view.tilt ?? 0, view.roll ?? 0, view.zoom ?? 1, -(view.panX ?? 0) / half, (view.panY ?? 0) / half];
291
292
  if (yaw === this.#yaw && tilt === this.#tilt && roll === this.#roll && zoom === this.#zoom && panX === this.#panX && panY === this.#panY)
292
293
  return;
@@ -58,10 +58,11 @@ export function createPortraitItem(options) {
58
58
  const slot = 7 * Math.max(1e-6, ...placed.map((p) => Math.max(p.r, MIN_RADIUS_PX / pxPerUnit)));
59
59
  const far = (placed.length + 1) * slot;
60
60
  const distance = far + 300 * Math.max(halfW, halfH);
61
- camera.left = cam.x - halfW;
62
- camera.right = cam.x + halfW;
63
- camera.top = cam.y + halfH;
64
- camera.bottom = cam.y - halfH;
61
+ // the camera is placed at the centre of the view below, so the window is round it: putting the centre in the window too moved everything twice as far as the view was moved
62
+ camera.left = -halfW;
63
+ camera.right = halfW;
64
+ camera.top = halfH;
65
+ camera.bottom = -halfH;
65
66
  camera.near = Math.max(1e-6, distance - far - slot);
66
67
  camera.far = distance + slot;
67
68
  camera.position.set(cam.x, cam.y, distance);
@@ -222,8 +222,9 @@ export function createBodyItem(options) {
222
222
  const half = state.extent / Math.max(0.05, state.zoom);
223
223
  const halfW = aspect >= 1 ? half * aspect : half;
224
224
  const halfH = aspect >= 1 ? half : half / aspect;
225
- const cx = state.panX * halfW;
226
- const cy = state.panY * halfH;
225
+ // the pan is in units of the short side's half (what the element divides the pixels by), so a wide or tall view moves by the pixels asked
226
+ const cx = state.panX * half;
227
+ const cy = state.panY * half;
227
228
  camera.left = cx - halfW;
228
229
  camera.right = cx + halfW;
229
230
  camera.top = cy + halfH;
@@ -9,7 +9,7 @@ import type * as THREE from "three";
9
9
  * console.log(TEXTURE_BASE);
10
10
  * ```
11
11
  */
12
- export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.26.0/dist/textures/";
12
+ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.26.1/dist/textures/";
13
13
  /**
14
14
  * Where the sharpest surface pictures are: the files of this exact version in the repository, on jsDelivr's GitHub address. The npm package holds only the two smaller widths, so a page that
15
15
  * never zooms in never fetches them. Set `texture-far-base` on an element to serve them yourself.
@@ -21,7 +21,7 @@ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdot
21
21
  * console.log(TEXTURE_FAR_BASE);
22
22
  * ```
23
23
  */
24
- export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.26.0/textures/";
24
+ export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.26.1/textures/";
25
25
  export declare const slash: (base: string) => string;
26
26
  export declare function texturePaths(element: Element): {
27
27
  textureBase(): string;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.26.0";
1
+ export declare const VERSION = "0.26.1";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.26.0";
1
+ export const VERSION = "0.26.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/wakusei-planets",
3
- "version": "0.26.0",
3
+ "version": "0.26.1",
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",