@orbat-mapper/tactical-draw-adapter-maplibre 0.4.0 → 0.4.2
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/dist/index.d.mts +2 -0
- package/dist/index.mjs +21 -6
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -65,6 +65,8 @@ declare class PinLayer implements CustomLayerInterface {
|
|
|
65
65
|
private version;
|
|
66
66
|
private resourceRevision;
|
|
67
67
|
private needsDepth;
|
|
68
|
+
/** Whether a pin hit outranks an overlapping ordinary graphic during selection. */
|
|
69
|
+
prioritizesSelection: boolean;
|
|
68
70
|
private elevationCache;
|
|
69
71
|
private pendingElevation;
|
|
70
72
|
private removed;
|
package/dist/index.mjs
CHANGED
|
@@ -495,6 +495,8 @@ var PinLayer = class {
|
|
|
495
495
|
version = 0;
|
|
496
496
|
resourceRevision = -1;
|
|
497
497
|
needsDepth = false;
|
|
498
|
+
/** Whether a pin hit outranks an overlapping ordinary graphic during selection. */
|
|
499
|
+
prioritizesSelection = false;
|
|
498
500
|
elevationCache = /* @__PURE__ */ new Map();
|
|
499
501
|
pendingElevation = /* @__PURE__ */ new Set();
|
|
500
502
|
removed = false;
|
|
@@ -523,10 +525,21 @@ var PinLayer = class {
|
|
|
523
525
|
const cached = this.elevationCache.get(key);
|
|
524
526
|
if (cached !== void 0) return cached;
|
|
525
527
|
const terrain = this.map.terrain;
|
|
526
|
-
const
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
const
|
|
528
|
+
const manager = terrain.tileManager ?? terrain.sourceCache;
|
|
529
|
+
const source = terrain.tileManager ? terrain.tileManager.getSource() : terrain.sourceCache.sourceCache.getSource();
|
|
530
|
+
const { tileID, mercatorX, mercatorY } = terrain._getOverscaledTileIDFromLngLatZoom(new LngLat(position[0], position[1]), Math.min(manager.maxzoom, source.maxzoom + manager.deltaZoom));
|
|
531
|
+
const x = mercatorX % 8192;
|
|
532
|
+
const y = mercatorY % 8192;
|
|
533
|
+
const getSampler = terrain.getElevationSampler ?? terrain._getElevationSampler;
|
|
534
|
+
let value;
|
|
535
|
+
if (getSampler) {
|
|
536
|
+
const sampler = getSampler.call(terrain, tileID);
|
|
537
|
+
if (!sampler) return NaN;
|
|
538
|
+
value = sampler(x, y, 8192) * terrain.exaggeration;
|
|
539
|
+
} else {
|
|
540
|
+
if (!manager.getSourceTile(tileID, true)?.dem) return NaN;
|
|
541
|
+
value = terrain.getElevation(tileID, x, y, 8192);
|
|
542
|
+
}
|
|
530
543
|
this.elevationCache.set(key, value);
|
|
531
544
|
return value;
|
|
532
545
|
}
|
|
@@ -627,6 +640,7 @@ var PinLayer = class {
|
|
|
627
640
|
}
|
|
628
641
|
}
|
|
629
642
|
this.pins = pins;
|
|
643
|
+
this.prioritizesSelection = pins[0]?.presentation.prioritizePins ?? false;
|
|
630
644
|
if (this.elevationCache.size > pins.length * 60 + 1e3) this.elevationCache.clear();
|
|
631
645
|
if (!this.program) {
|
|
632
646
|
this.onStatus?.({
|
|
@@ -2600,7 +2614,7 @@ var MapLibreAdapter = class extends BaseMapAdapter {
|
|
|
2600
2614
|
bearing: this.getBearing()
|
|
2601
2615
|
});
|
|
2602
2616
|
const pinHit = this.pinHit(layerId, [x, y], tol);
|
|
2603
|
-
if (pinHit && (!candidate || pinHit.order >= (this.getFeatureGroupOrder(layerId, candidate.feature.id) ?? -1))) {
|
|
2617
|
+
if (pinHit && (pinHit.prioritize || !candidate || pinHit.order >= (this.getFeatureGroupOrder(layerId, candidate.feature.id) ?? -1))) {
|
|
2604
2618
|
handler({
|
|
2605
2619
|
id: pinHit.id,
|
|
2606
2620
|
feature: pinHit.feature,
|
|
@@ -2685,7 +2699,8 @@ var MapLibreAdapter = class extends BaseMapAdapter {
|
|
|
2685
2699
|
if (feature) return {
|
|
2686
2700
|
id,
|
|
2687
2701
|
feature,
|
|
2688
|
-
order: this.getFeatureGroupOrder(layerId, feature.id) ?? 0
|
|
2702
|
+
order: this.getFeatureGroupOrder(layerId, feature.id) ?? 0,
|
|
2703
|
+
prioritize: pinLayer.prioritizesSelection
|
|
2689
2704
|
};
|
|
2690
2705
|
}
|
|
2691
2706
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orbat-mapper/tactical-draw-adapter-maplibre",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
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",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@orbat-mapper/control-measures": "^0.27.0",
|
|
41
|
-
"@orbat-mapper/tactical-draw": "^0.9.
|
|
41
|
+
"@orbat-mapper/tactical-draw": "^0.9.2"
|
|
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.
|
|
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",
|