spacemap 0.1.4 → 0.1.5
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 +21 -1
- package/dist/spacemap.iife.js +26 -6
- package/dist/spacemap.js +26 -6
- package/index.d.ts +17 -0
- package/index.js +267 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ your page:
|
|
|
44
44
|
```html
|
|
45
45
|
<div id="map" style="height: 500px"></div>
|
|
46
46
|
<script type="module">
|
|
47
|
-
import { createMap } from 'https://cdn.jsdelivr.net/npm/spacemap@0.1.
|
|
47
|
+
import { createMap } from 'https://cdn.jsdelivr.net/npm/spacemap@0.1.5/dist/spacemap.js';
|
|
48
48
|
const map = await createMap({ container: '#map' });
|
|
49
49
|
</script>
|
|
50
50
|
```
|
|
@@ -235,6 +235,10 @@ an area drawn as a fill alone. The flat map says the same things with the same
|
|
|
235
235
|
words — its version is `FlatShapeStyle`, named apart because a page can hold
|
|
236
236
|
both maps at once — so a drawing described once can be handed to either.
|
|
237
237
|
|
|
238
|
+
A line, in space or on a surface, takes `dash` as the flat map's does: `'4 3'`
|
|
239
|
+
is four pixels drawn and three left out, counted on screen like the width, so
|
|
240
|
+
the dashes read the same from any distance.
|
|
241
|
+
|
|
238
242
|
Two rules fall out of the scene rather than out of taste. Widths are pixels
|
|
239
243
|
because the map spans metres to astronomical units, and a line a kilometre wide
|
|
240
244
|
is a wall from low orbit and nothing at all from the next planet out. And a body
|
|
@@ -466,6 +470,22 @@ flat.isLayerVisible('clouds');
|
|
|
466
470
|
flat.on('layerschange', (layers) => redraw(layers));
|
|
467
471
|
```
|
|
468
472
|
|
|
473
|
+
### Bodies kept in sight
|
|
474
|
+
|
|
475
|
+
The map decides what to name by how far the camera is: a planet's halo and
|
|
476
|
+
orbit drop out once its whole orbit is a few pixels across, and a name gives way
|
|
477
|
+
to a bigger neighbour's. `setPinnedBodies` takes that decision for the bodies a
|
|
478
|
+
page is about:
|
|
479
|
+
|
|
480
|
+
```js
|
|
481
|
+
map.setPinnedBodies(['naif-499', 'spkid-20000433']); // Mars and Eros, from anywhere
|
|
482
|
+
map.setPinnedBodies([]); // back to the map's own judgement
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
A pinned body keeps its halo, name and orbit from however far, and through a
|
|
486
|
+
hidden layer. A moon is the exception: it is only drawn inside the system the
|
|
487
|
+
camera is in, so pin its planet to mark it from outside.
|
|
488
|
+
|
|
469
489
|
## The flat map
|
|
470
490
|
|
|
471
491
|
One body's surface, drawn flat, with layers you can switch and drawings of your
|