@kalyptos/narcissus 0.1.3 → 0.2.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/README.md CHANGED
@@ -43,6 +43,7 @@ npx @kalyptos/narcissus publish ./world remote:bucket/world
43
43
 
44
44
  - [docs/format.md](docs/format.md): the specification of Guldmund Trees
45
45
  - [docs/hosting.md](docs/hosting.md): how to serve, publish and show a world
46
+ - [docs/embedding.md](docs/embedding.md): the hooks for a page that embeds the viewer: layers, masks, picking, graphics and the camera
46
47
  - [docs/architecture.md](docs/architecture.md): how the code is built, and how to add a source or a plugin
47
48
  - [CONTRIBUTING.md](CONTRIBUTING.md)
48
49
 
package/dist/cli/main.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as e } from "../ports-DZRKjdYD.js";
3
3
  import { t } from "../http-DL7R39Nc.js";
4
- import { a as n, r, t as i } from "../tools-NykPVccD.js";
4
+ import { a as n, r, t as i } from "../tools-DnfuHeoO.js";
5
5
  import { createWriteStream as a, statSync as o } from "node:fs";
6
6
  import { pipeline as s } from "node:stream/promises";
7
7
  import { parseArgs as c } from "node:util";
@@ -10,13 +10,21 @@ export declare function smooth(shown: Pose, target: Pose, dt: number, ground: Gr
10
10
  /** map camera: left drag orbits, right/middle/shift drag pans the ground, wheel zooms, f flies */
11
11
  export declare class Controls {
12
12
  #private;
13
+ /** false ignores pointer, wheel and key input; flights still run */
14
+ enabled: boolean;
13
15
  constructor(canvas: HTMLCanvasElement, engine: Engine, ground: Ground, pose: Pose, limits?: Limits);
14
16
  /** the pose the camera shows now */
15
17
  get pose(): Pose;
16
- /** fires on every frame the user moves the camera */
17
- onChange(fn: () => void): () => void;
18
+ /** fires with the shown pose each time it changes, from input, flights and jumps */
19
+ onChange(fn: (pose: Pose) => void): () => void;
18
20
  /** puts the focus on a ground point; heading and tilt stay, a far view closes in */
19
21
  moveTo(e: number, n: number): void;
22
+ /** shows the pose at once; fields left out stay */
23
+ jump(pose: Partial<Pose>): void;
24
+ /** flies to the pose, fields left out staying; false when input, another move, the signal or destroy cuts it short */
25
+ flyTo(pose: Partial<Pose>, options?: {
26
+ signal?: AbortSignal;
27
+ }): Promise<boolean>;
20
28
  destroy(): void;
21
29
  }
22
30
  export {};
@@ -1,4 +1,4 @@
1
- import type { Camera, World } from '../engine/index.ts';
1
+ import type { Box, Camera, World } from '../engine/index.ts';
2
2
  /** easting, northing and height in world coordinates, metres */
3
3
  export interface Point {
4
4
  e: number;
@@ -61,5 +61,12 @@ export declare function fly(p: Pose, right: number, forward: number, up: number)
61
61
  export declare function pan(p: Pose, right: number, forward: number): Pose;
62
62
  /** moves a toward b by fraction t: focus linearly, yaw the short way round, dist in log space */
63
63
  export declare function blend(a: Pose, b: Pose, t: number): Pose;
64
+ /** a pose that shows all of box: focus at its centre, heading and tilt from pose */
65
+ export declare function fit(box: Box, pose: Pose): Pose;
66
+ /** an eased path from one pose to another over ms; a long hop rises so the view keeps its bearings */
67
+ export declare function flight(from: Pose, to: Pose): {
68
+ ms: number;
69
+ at(t: number): Pose;
70
+ };
64
71
  /** close enough that the rest of the way is not visible */
65
72
  export declare function settled(a: Pose, b: Pose): boolean;