@orbat-mapper/tactical-draw-adapter-maplibre 0.2.0-alpha.6 → 0.2.0-alpha.8
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.mjs +21 -8
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -440,7 +440,10 @@ var MapLibreAdapter = class extends BaseMapAdapter {
|
|
|
440
440
|
let disposed = false;
|
|
441
441
|
let touchDragActive = false;
|
|
442
442
|
let multiTouchCancelled = false;
|
|
443
|
-
const
|
|
443
|
+
const touchInfo = (e) => ({
|
|
444
|
+
hitTolerance: TOUCH_HIT_TOLERANCE_PX,
|
|
445
|
+
native: e.originalEvent
|
|
446
|
+
});
|
|
444
447
|
const preventMapEventDefaults = (e) => {
|
|
445
448
|
e.preventDefault();
|
|
446
449
|
e.originalEvent.preventDefault?.();
|
|
@@ -448,22 +451,32 @@ var MapLibreAdapter = class extends BaseMapAdapter {
|
|
|
448
451
|
};
|
|
449
452
|
const onDown = (e) => {
|
|
450
453
|
const px = [e.point.x, e.point.y];
|
|
451
|
-
const info = {
|
|
454
|
+
const info = {
|
|
455
|
+
altKey: e.originalEvent.altKey,
|
|
456
|
+
shiftKey: e.originalEvent.shiftKey,
|
|
457
|
+
native: e.originalEvent
|
|
458
|
+
};
|
|
452
459
|
hub.fireDown(px, info);
|
|
453
460
|
};
|
|
454
461
|
const onMove = (e) => {
|
|
455
462
|
const px = [e.point.x, e.point.y];
|
|
456
|
-
hub.fireMove(px
|
|
463
|
+
hub.fireMove(px, {
|
|
464
|
+
shiftKey: e.originalEvent.shiftKey,
|
|
465
|
+
native: e.originalEvent
|
|
466
|
+
});
|
|
457
467
|
};
|
|
458
468
|
const onUp = (e) => {
|
|
459
469
|
const px = [e.point.x, e.point.y];
|
|
460
|
-
hub.fireUp(px
|
|
470
|
+
hub.fireUp(px, {
|
|
471
|
+
shiftKey: e.originalEvent.shiftKey,
|
|
472
|
+
native: e.originalEvent
|
|
473
|
+
});
|
|
461
474
|
};
|
|
462
475
|
const onTouchStart = (e) => {
|
|
463
476
|
if (e.points.length !== 1) return;
|
|
464
477
|
const before = dragPanWasEnabled;
|
|
465
478
|
const px = [e.point.x, e.point.y];
|
|
466
|
-
hub.fireDown(px,
|
|
479
|
+
hub.fireDown(px, touchInfo(e));
|
|
467
480
|
touchDragActive = dragPanWasEnabled !== before;
|
|
468
481
|
if (touchDragActive) preventMapEventDefaults(e);
|
|
469
482
|
};
|
|
@@ -472,20 +485,20 @@ var MapLibreAdapter = class extends BaseMapAdapter {
|
|
|
472
485
|
const px = [e.point.x, e.point.y];
|
|
473
486
|
if (touchCount > 1 && touchDragActive && !multiTouchCancelled) {
|
|
474
487
|
multiTouchCancelled = true;
|
|
475
|
-
hub.fireUp(px,
|
|
488
|
+
hub.fireUp(px, touchInfo(e));
|
|
476
489
|
touchDragActive = false;
|
|
477
490
|
preventMapEventDefaults(e);
|
|
478
491
|
return;
|
|
479
492
|
}
|
|
480
493
|
if (touchCount > 1) return;
|
|
481
494
|
if (touchCount === 1) multiTouchCancelled = false;
|
|
482
|
-
hub.fireMove(px,
|
|
495
|
+
hub.fireMove(px, touchInfo(e));
|
|
483
496
|
if (touchDragActive) preventMapEventDefaults(e);
|
|
484
497
|
};
|
|
485
498
|
const onTouchEnd = (e) => {
|
|
486
499
|
multiTouchCancelled = false;
|
|
487
500
|
const px = [e.point.x, e.point.y];
|
|
488
|
-
hub.fireUp(px,
|
|
501
|
+
hub.fireUp(px, touchInfo(e));
|
|
489
502
|
touchDragActive = false;
|
|
490
503
|
};
|
|
491
504
|
map.on("mousedown", onDown);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orbat-mapper/tactical-draw-adapter-maplibre",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.8",
|
|
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.2.0-alpha.15",
|
|
41
|
-
"@orbat-mapper/tactical-draw": "^0.2.0-alpha.
|
|
41
|
+
"@orbat-mapper/tactical-draw": "^0.2.0-alpha.23"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"maplibre-gl": ">=4.0.0 <6.0.0"
|