ixmaps-gl 0.2.30 → 0.2.33
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 +39 -7
- package/ixmaps-gl.js +1129 -128
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,10 +114,10 @@ page. It currently implements:
|
|
|
114
114
|
`window.__setFacetFilter`) for building filterable sidebars
|
|
115
115
|
- Globe (orthographic) projection alongside flat Mercator
|
|
116
116
|
|
|
117
|
-
Not yet implemented:
|
|
118
|
-
`
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
Not yet implemented: the `QUAD`/`WAFFLE` base types. Custom SYMBOL shapes are supported
|
|
118
|
+
as image-URL symbols (`symbols: [...]`), not as built-in shape variants.
|
|
119
|
+
The top-of-file comment in [`ixmaps-gl.js`](./ixmaps-gl.js) is the single source of truth
|
|
120
|
+
for scope; this list only summarises it.
|
|
121
121
|
|
|
122
122
|
### Page scripts, named data and the runtime API
|
|
123
123
|
|
|
@@ -230,6 +230,38 @@ space beside it. `.options({themecopies: true})` (also at runtime) repeats the t
|
|
|
230
230
|
copy. `.options({worldcopies: false})` draws the world once for the map itself, but MapLibre then
|
|
231
231
|
also stops the zoom-out where the world gets narrower than the window.
|
|
232
232
|
|
|
233
|
+
### Map events, bounds and the MapLibre map
|
|
234
|
+
|
|
235
|
+
`map.on("zoomend moveend", fn)` (flat's `mapApi.on`; on the builder chain, the callback object or
|
|
236
|
+
`ixmaps.map()`) fires:
|
|
237
|
+
|
|
238
|
+
| event | when | handler receives |
|
|
239
|
+
|---|---|---|
|
|
240
|
+
| `ready` | the map has loaded (called at once if it already has) | `{type, szMap}` |
|
|
241
|
+
| `viewchange` (`zoompan`) | after every pan or zoom | `{type, szMap, nZoom, zoomChanged, panChanged}` |
|
|
242
|
+
| `zoomend` / `moveend` | the zoom changed / the centre moved without a zoom change | as `viewchange` |
|
|
243
|
+
| `click` (`itemclick`) | an item was clicked — every item, also of a theme bound by geometry only | `{type, szMap, szId, id, theme, record, lngLat, point}` |
|
|
244
|
+
| `mapclick` | any click on the map, background included (gl addition) | `{type, szMap, lngLat: {lng, lat}, point: {x, y}}` |
|
|
245
|
+
| `layerdraw` (`drawtheme`) | after every redraw, once per theme | `{type, szMap, szId, id}` |
|
|
246
|
+
|
|
247
|
+
`szId` is `theme::key` and `id` the key: the theme's selection field value (the `id`, position or lookup
|
|
248
|
+
field), else the feature's `id`, else its position `"lng,lat"`; `record` is the item's data record (gl
|
|
249
|
+
addition). `szMap` is the map's `name` option, or `null`. flat's `frozenDynamic` is not provided.
|
|
250
|
+
`map.off("click", fn)` removes a handler, as in flat; several event names may be given, separated by
|
|
251
|
+
spaces, and the names in brackets are flat's aliases.
|
|
252
|
+
|
|
253
|
+
Differences from flat: `layerdraw` fires for every theme on every redraw, panning included (flat: once per
|
|
254
|
+
theme as it is drawn); `ready` means the MapLibre map has loaded, themes may still be loading; view events
|
|
255
|
+
fire when a movement ends, not during it. The other flat event names (`mouseover`/`itemover`,
|
|
256
|
+
`mouseout`/`itemout`, `resize`, `layeradd`/`newtheme`, `layerremove`/`removetheme`) are accepted but never
|
|
257
|
+
fire; the console says so once. `ixmaps.onItemAction(null, null, {lngLat, point})` gets the click position on
|
|
258
|
+
a background click as a third argument; it is still called for items only when the theme has a selection
|
|
259
|
+
field.
|
|
260
|
+
|
|
261
|
+
`ixmaps.map().getBounds()` returns flat's `[swLat, swLng, neLat, neLng]` (`ixmaps.getBoundingBox()`
|
|
262
|
+
the same box as `[{lat, lng} SW, {lat, lng} NE]`); `ixmaps.map().getMapLibre()` returns the MapLibre
|
|
263
|
+
map itself, or `undefined` until it is built.
|
|
264
|
+
|
|
233
265
|
### Click to action
|
|
234
266
|
|
|
235
267
|
flat's click-to-action (`ui/js/tools/tooltip_to_action.js`, e.g. a click on a country filters every
|
|
@@ -302,7 +334,7 @@ of your own project files gl can render.
|
|
|
302
334
|
Load the engine from jsDelivr, pinned to a release tag (or `@main` for the latest commit):
|
|
303
335
|
|
|
304
336
|
```html
|
|
305
|
-
<script src="https://cdn.jsdelivr.net/gh/gjrichter/ixmaps-gl@v0.2.
|
|
337
|
+
<script src="https://cdn.jsdelivr.net/gh/gjrichter/ixmaps-gl@v0.2.33/ixmaps-gl.js"></script>
|
|
306
338
|
```
|
|
307
339
|
|
|
308
340
|
or from unpkg, the npm package [`ixmaps-gl`](https://www.npmjs.com/package/ixmaps-gl)
|
|
@@ -310,13 +342,13 @@ or from unpkg, the npm package [`ixmaps-gl`](https://www.npmjs.com/package/ixmap
|
|
|
310
342
|
browser script, which defines the global `ixmaps`):
|
|
311
343
|
|
|
312
344
|
```html
|
|
313
|
-
<script src="https://unpkg.com/ixmaps-gl@0.2.
|
|
345
|
+
<script src="https://unpkg.com/ixmaps-gl@0.2.33/ixmaps-gl.js"></script>
|
|
314
346
|
```
|
|
315
347
|
|
|
316
348
|
or use a local copy (`<script src="ixmaps-gl.js"></script>`). A minimal page:
|
|
317
349
|
|
|
318
350
|
```html
|
|
319
|
-
<script src="https://cdn.jsdelivr.net/gh/gjrichter/ixmaps-gl@v0.2.
|
|
351
|
+
<script src="https://cdn.jsdelivr.net/gh/gjrichter/ixmaps-gl@v0.2.33/ixmaps-gl.js"></script>
|
|
320
352
|
<div id="map_div" style="position:absolute;inset:0;"></div>
|
|
321
353
|
|
|
322
354
|
<script>
|