@aguacerowx/mapsgl 0.0.50 → 0.0.52

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aguacerowx/mapsgl",
3
- "version": "0.0.50",
3
+ "version": "0.0.52",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -21,7 +21,7 @@
21
21
  "esbuild": "^0.21.5"
22
22
  },
23
23
  "dependencies": {
24
- "@aguacerowx/javascript-sdk": "^0.0.21",
24
+ "@aguacerowx/javascript-sdk": "^0.0.23",
25
25
  "buffer": "^6.0.3",
26
26
  "fzstd": "^0.1.1",
27
27
  "mapbox-gl": "^3.4.0",
@@ -8,7 +8,7 @@ import { MapboxRadarLayer } from './nexrad/MapboxRadarLayer.bundled.js';
8
8
  import { nexradBinGroupIdForKey, variableToNexradGroup } from '@aguacerowx/javascript-sdk';
9
9
  import { sampleNexradFrameAtLatLon } from './nexrad/nexradCrossSectionSampleAtLatLon.bundled.js';
10
10
  import { prepareRadarFrameForGpuReadout } from './nexrad/radarFrameGpuMatch.bundled.js';
11
- import { mapboxFrameUploadOptionsForNexradState } from './nexrad/nexradMapboxFrameOpts.js';
11
+ import { mapboxFrameUploadOptionsForNexradState } from './nexrad/nexradMapboxFrameOpts.ts';
12
12
 
13
13
  function pickNearestLevel3ObjectKey(unixTime, timeToKeyMap, maxDeltaSec = 600) {
14
14
  const direct = timeToKeyMap[String(unixTime)];
@@ -153,7 +153,8 @@ export class NexradWeatherController {
153
153
  this.core = core;
154
154
  this.layerId = options.nexradLayerId || 'aguacero-nexrad-layer';
155
155
  this.mapboxLayer = null;
156
- this._lastFetchKey = null;
156
+ /** Includes tilt/timestamp so elevation changes always re-upload (see {@link _syncIdentity}). */
157
+ this._lastSyncKey = null;
157
158
  this._abort = null;
158
159
  this._interpolateColormap = options.interpolateNexradColormap !== false;
159
160
  this._gateSmoothing = options.nexradGateSmoothing === true;
@@ -176,7 +177,7 @@ export class NexradWeatherController {
176
177
  this.map.removeLayer(this.mapboxLayer.id);
177
178
  }
178
179
  this.mapboxLayer = null;
179
- this._lastFetchKey = null;
180
+ this._lastSyncKey = null;
180
181
  }
181
182
 
182
183
  _resolveListingContext(state) {
@@ -227,7 +228,25 @@ export class NexradWeatherController {
227
228
  .filter((t) => Number.isFinite(t))
228
229
  .sort((a, b) => a - b)
229
230
  .join(',');
230
- return `${nk}|${ts}|sr:${state.nexradStormRelative ? 1 : 0}`;
231
+ const tilt =
232
+ state.nexradTilt != null && Number.isFinite(Number(state.nexradTilt))
233
+ ? Number(state.nexradTilt).toFixed(3)
234
+ : '';
235
+ return `${nk}|${ts}|sr:${state.nexradStormRelative ? 1 : 0}|tilt:${tilt}`;
236
+ }
237
+
238
+ /**
239
+ * Identity for whether the visible radar frame + upload options match (tilt affects L3 mesh keys and listing object paths).
240
+ * @param {object} state
241
+ * @param {{ fetchKey: string }} p
242
+ * @param {number} unix
243
+ */
244
+ _syncIdentity(state, p, unix) {
245
+ const tilt =
246
+ state.nexradTilt != null && Number.isFinite(Number(state.nexradTilt))
247
+ ? Number(state.nexradTilt).toFixed(3)
248
+ : '';
249
+ return `${p.fetchKey}|tilt:${tilt}|u:${unix}`;
231
250
  }
232
251
 
233
252
  /**
@@ -341,7 +360,8 @@ export class NexradWeatherController {
341
360
  return;
342
361
  }
343
362
 
344
- if (p.fetchKey === this._lastFetchKey && this.mapboxLayer) {
363
+ const syncKey = this._syncIdentity(state, p, unix);
364
+ if (syncKey === this._lastSyncKey && this.mapboxLayer) {
345
365
  this._applyStyle(state);
346
366
  return;
347
367
  }
@@ -350,12 +370,10 @@ export class NexradWeatherController {
350
370
  if (cached) {
351
371
  this._ensureLayer();
352
372
  this._uploadFrame(state, cached);
353
- this._lastFetchKey = p.fetchKey;
373
+ this._lastSyncKey = syncKey;
354
374
  return;
355
375
  }
356
376
 
357
- this._lastFetchKey = p.fetchKey;
358
-
359
377
  this._abort?.abort();
360
378
  this._abort = new AbortController();
361
379
 
@@ -375,6 +393,7 @@ export class NexradWeatherController {
375
393
 
376
394
  this._ensureLayer();
377
395
  this._uploadFrame(state, frame);
396
+ this._lastSyncKey = syncKey;
378
397
  }
379
398
 
380
399
  _applyStyle(state) {