ixmaps-gl 0.2.0 → 0.2.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/README.md +6 -4
- package/ixmaps-gl.js +21 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -181,7 +181,9 @@ script. For brokers that query by view, like flat's bbox data providers, ixmaps-
|
|
|
181
181
|
`ixmaps.getBoundingBox()`, `ixmaps.refreshTheme(id)` (loads the theme's data again, in place),
|
|
182
182
|
`ixmaps.setTitle(html)`/`setTitleBox(text, color)`, `ixmaps.getThemeObj(id).fVisible` (false for a
|
|
183
183
|
FEATURE theme out of scale) and calls a page's `ixmaps.htmlgui_onZoomAndPan(zoom)` after each zoom
|
|
184
|
-
or pan
|
|
184
|
+
or pan — and also during a zoom, at the pace of the layer refresh (about every 150 ms, zoom changes only),
|
|
185
|
+
so zoom-dependent page state (e.g. a basemap opacity ramp) changes in step with the scale gates
|
|
186
|
+
(`featurelower`, `chartupper`, …) instead of after the gesture has ended. Scripts that reach further into flat's internals (`ixmaps.parentApi`, other `htmlgui_*`
|
|
185
187
|
hooks) aren't supported. `test/project-report.mjs` shows which themes
|
|
186
188
|
of your own project files gl can render.
|
|
187
189
|
|
|
@@ -190,7 +192,7 @@ of your own project files gl can render.
|
|
|
190
192
|
Load the engine from jsDelivr, pinned to a release tag (or `@main` for the latest commit):
|
|
191
193
|
|
|
192
194
|
```html
|
|
193
|
-
<script src="https://cdn.jsdelivr.net/gh/gjrichter/ixmaps-gl@v0.2.
|
|
195
|
+
<script src="https://cdn.jsdelivr.net/gh/gjrichter/ixmaps-gl@v0.2.1/ixmaps-gl.js"></script>
|
|
194
196
|
```
|
|
195
197
|
|
|
196
198
|
or from unpkg, the npm package [`ixmaps-gl`](https://www.npmjs.com/package/ixmaps-gl)
|
|
@@ -198,13 +200,13 @@ or from unpkg, the npm package [`ixmaps-gl`](https://www.npmjs.com/package/ixmap
|
|
|
198
200
|
browser script, which defines the global `ixmaps`):
|
|
199
201
|
|
|
200
202
|
```html
|
|
201
|
-
<script src="https://unpkg.com/ixmaps-gl@0.2.
|
|
203
|
+
<script src="https://unpkg.com/ixmaps-gl@0.2.1/ixmaps-gl.js"></script>
|
|
202
204
|
```
|
|
203
205
|
|
|
204
206
|
or use a local copy (`<script src="ixmaps-gl.js"></script>`). A minimal page:
|
|
205
207
|
|
|
206
208
|
```html
|
|
207
|
-
<script src="https://cdn.jsdelivr.net/gh/gjrichter/ixmaps-gl@v0.2.
|
|
209
|
+
<script src="https://cdn.jsdelivr.net/gh/gjrichter/ixmaps-gl@v0.2.1/ixmaps-gl.js"></script>
|
|
208
210
|
<div id="map_div" style="position:absolute;inset:0;"></div>
|
|
209
211
|
|
|
210
212
|
<script>
|
package/ixmaps-gl.js
CHANGED
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
// ---------------------------------------------------------------
|
|
81
81
|
// this engine's release (= package.json "version", checked by
|
|
82
82
|
// test/unit/version.test.mjs); ixmaps.glVersion, and logged once at start
|
|
83
|
-
const IXMAPS_GL_VERSION = '0.2.
|
|
83
|
+
const IXMAPS_GL_VERSION = '0.2.1';
|
|
84
84
|
|
|
85
85
|
const LIB_URLS = {
|
|
86
86
|
// Bumped 3.6.2 -> 5.x (2026-09-21, globe-projection compat fix): native
|
|
@@ -2728,6 +2728,16 @@
|
|
|
2728
2728
|
// broker re-queries its data from it. Read at call time: pages wrap
|
|
2729
2729
|
// it after loading. flat passes its SVG zoom scale; this passes the
|
|
2730
2730
|
// flat zoom level, the one value gl has.
|
|
2731
|
+
//
|
|
2732
|
+
// gl also calls it DURING a zoom (notifyZoomAndPanMidGesture, wired
|
|
2733
|
+
// into the throttled refresh below), zoom changes only: the scale
|
|
2734
|
+
// gates (featurelower/chartupper ...) switch on the live zoom while
|
|
2735
|
+
// the gesture runs, so a page that ties something zoom-dependent to
|
|
2736
|
+
// this hook (e.g. a basemap opacity ramp) must be told in the same
|
|
2737
|
+
// tick — from 'moveend' alone it arrived after the gate had already
|
|
2738
|
+
// flipped (FEATURE gone, basemap still at the old, faint opacity: a
|
|
2739
|
+
// blank background until the zoom ended).
|
|
2740
|
+
let notifyZoomAndPanMidGesture = () => {};
|
|
2731
2741
|
{
|
|
2732
2742
|
let last = null;
|
|
2733
2743
|
map.on('moveend', () => {
|
|
@@ -2739,6 +2749,14 @@
|
|
|
2739
2749
|
if (z === prev.z && Math.abs(p.x - q.x) <= 10 && Math.abs(p.y - q.y) <= 10) return;
|
|
2740
2750
|
try { hook.call(global.ixmaps, mapLibreToFlatZoom(z)); } catch (e) { console.error('[ixmaps-gl] htmlgui_onZoomAndPan:', e); }
|
|
2741
2751
|
});
|
|
2752
|
+
notifyZoomAndPanMidGesture = () => {
|
|
2753
|
+
const hook = pageIxmaps() && pageIxmaps().htmlgui_onZoomAndPan;
|
|
2754
|
+
if (typeof hook !== 'function' || !last) return;
|
|
2755
|
+
const z = map.getZoom();
|
|
2756
|
+
if (z === last.z) return; // a pan alone waits for 'moveend' (and its 10 px rule)
|
|
2757
|
+
last = { z, c: map.getCenter() };
|
|
2758
|
+
try { hook.call(global.ixmaps, mapLibreToFlatZoom(z)); } catch (e) { console.error('[ixmaps-gl] htmlgui_onZoomAndPan:', e); }
|
|
2759
|
+
};
|
|
2742
2760
|
// flat calls it on the first draw too (its old zoom is unset then)
|
|
2743
2761
|
map.once('load', () => {
|
|
2744
2762
|
last = { z: map.getZoom(), c: map.getCenter() };
|
|
@@ -3878,10 +3896,11 @@
|
|
|
3878
3896
|
const elapsed = now - lastRefreshAt;
|
|
3879
3897
|
if (elapsed >= REFRESH_INTERVAL_MS) {
|
|
3880
3898
|
lastRefreshAt = now;
|
|
3899
|
+
notifyZoomAndPanMidGesture();
|
|
3881
3900
|
refreshLayers();
|
|
3882
3901
|
} else {
|
|
3883
3902
|
clearTimeout(refreshTimer);
|
|
3884
|
-
refreshTimer = setTimeout(() => { lastRefreshAt = Date.now(); refreshLayers(); }, REFRESH_INTERVAL_MS - elapsed);
|
|
3903
|
+
refreshTimer = setTimeout(() => { lastRefreshAt = Date.now(); notifyZoomAndPanMidGesture(); refreshLayers(); }, REFRESH_INTERVAL_MS - elapsed);
|
|
3885
3904
|
}
|
|
3886
3905
|
scheduleNotifyRedraw();
|
|
3887
3906
|
}
|