@orbat-mapper/tactical-draw-adapter-maplibre 0.3.18 → 0.3.20

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 +12 -4
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -28,6 +28,12 @@ function sameOrder(a, b) {
28
28
  for (let index = 0; index < a.length; index++) if (a[index] !== b[index]) return false;
29
29
  return true;
30
30
  }
31
+ /** Absent and empty geometries have no entry in MapLibre's tile index to update. */
32
+ function hasGeometryCoordinates(geometry) {
33
+ if (!geometry) return false;
34
+ if (geometry.type === "GeometryCollection") return geometry.geometries.some(hasGeometryCoordinates);
35
+ return geometry.coordinates.length > 0;
36
+ }
31
37
  /**
32
38
  * Replace the contents of shared-id features while adding/removing ids that
33
39
  * entered or left a stable group bundle. Remove stale keys explicitly instead
@@ -47,7 +53,7 @@ function buildGeoJSONSourceDiff(previousFeatures, nextFeatures) {
47
53
  add.push(feature);
48
54
  continue;
49
55
  }
50
- if (feature.geometry === null) {
56
+ if (!hasGeometryCoordinates(feature.geometry) || !hasGeometryCoordinates(previous.geometry)) {
51
57
  remove.push(feature.id);
52
58
  add.push(feature);
53
59
  continue;
@@ -195,6 +201,7 @@ function buildIconLayer(id, source) {
195
201
  "*",
196
202
  [
197
203
  "coalesce",
204
+ ["get", "iconScreenRotation"],
198
205
  ["get", "iconRotation"],
199
206
  0
200
207
  ],
@@ -1221,9 +1228,8 @@ var MapLibreAdapter = class extends BaseMapAdapter {
1221
1228
  }
1222
1229
  viewChangeEvents() {
1223
1230
  return this.viewChangeMode === "settle" ? ["moveend"] : [
1224
- "zoom",
1225
- "rotate",
1226
- "pitch",
1231
+ "move",
1232
+ "resize",
1227
1233
  "moveend"
1228
1234
  ];
1229
1235
  }
@@ -1247,6 +1253,8 @@ var MapLibreAdapter = class extends BaseMapAdapter {
1247
1253
  const onDown = (e) => {
1248
1254
  const px = [e.point.x, e.point.y];
1249
1255
  const info = {
1256
+ ctrlKey: e.originalEvent.ctrlKey,
1257
+ metaKey: e.originalEvent.metaKey,
1250
1258
  altKey: e.originalEvent.altKey,
1251
1259
  shiftKey: e.originalEvent.shiftKey,
1252
1260
  native: e.originalEvent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbat-mapper/tactical-draw-adapter-maplibre",
3
- "version": "0.3.18",
3
+ "version": "0.3.20",
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.23.0",
41
- "@orbat-mapper/tactical-draw": "^0.7.0"
40
+ "@orbat-mapper/control-measures": "^0.24.0",
41
+ "@orbat-mapper/tactical-draw": "^0.8.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "maplibre-gl": ">=5.8.0 <7.0.0"