@orbat-mapper/tactical-draw-adapter-maplibre 0.4.0 → 0.4.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.
Files changed (2) hide show
  1. package/dist/index.mjs +15 -4
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -523,10 +523,21 @@ var PinLayer = class {
523
523
  const cached = this.elevationCache.get(key);
524
524
  if (cached !== void 0) return cached;
525
525
  const terrain = this.map.terrain;
526
- const { tileID, mercatorX, mercatorY } = terrain._getOverscaledTileIDFromLngLatZoom(new LngLat(position[0], position[1]), Math.min(terrain.tileManager.maxzoom, terrain.tileManager.getSource().maxzoom + terrain.tileManager.deltaZoom));
527
- const sampler = terrain._getElevationSampler(tileID);
528
- if (!sampler) return NaN;
529
- const value = sampler(mercatorX % 8192, mercatorY % 8192, 8192) * terrain.exaggeration;
526
+ const manager = terrain.tileManager ?? terrain.sourceCache;
527
+ const source = terrain.tileManager ? terrain.tileManager.getSource() : terrain.sourceCache.sourceCache.getSource();
528
+ const { tileID, mercatorX, mercatorY } = terrain._getOverscaledTileIDFromLngLatZoom(new LngLat(position[0], position[1]), Math.min(manager.maxzoom, source.maxzoom + manager.deltaZoom));
529
+ const x = mercatorX % 8192;
530
+ const y = mercatorY % 8192;
531
+ const getSampler = terrain.getElevationSampler ?? terrain._getElevationSampler;
532
+ let value;
533
+ if (getSampler) {
534
+ const sampler = getSampler.call(terrain, tileID);
535
+ if (!sampler) return NaN;
536
+ value = sampler(x, y, 8192) * terrain.exaggeration;
537
+ } else {
538
+ if (!manager.getSourceTile(tileID, true)?.dem) return NaN;
539
+ value = terrain.getElevation(tileID, x, y, 8192);
540
+ }
530
541
  this.elevationCache.set(key, value);
531
542
  return value;
532
543
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbat-mapper/tactical-draw-adapter-maplibre",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "MapLibre GL JS engine adapter for @orbat-mapper/tactical-draw. Draw and edit tactical control measures (MIL-STD-2525 / APP-6) on a MapLibre map.",
5
5
  "license": "MIT",
6
6
  "author": "Orbat Mapper",
@@ -37,8 +37,8 @@
37
37
  "access": "public"
38
38
  },
39
39
  "dependencies": {
40
- "@orbat-mapper/control-measures": "^0.27.0",
41
- "@orbat-mapper/tactical-draw": "^0.9.0"
40
+ "@orbat-mapper/tactical-draw": "^0.9.0",
41
+ "@orbat-mapper/control-measures": "^0.27.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "maplibre-gl": ">=5.8.0 <7.0.0"
@@ -48,7 +48,7 @@
48
48
  "@maplibre/maplibre-gl-style-spec": "^26.2.1",
49
49
  "@types/geojson": "^7946.0.16",
50
50
  "jsdom": "^27.4.0",
51
- "maplibre-gl": "^6.3.0",
51
+ "maplibre-gl": "^6.10.0",
52
52
  "playwright-core": "^1.62.1",
53
53
  "publint": "^0.3.21",
54
54
  "tsdown": "^0.22.2",