@orbat-mapper/tactical-draw-adapter-maplibre 0.2.0-alpha.7 → 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 +18 -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?.();
|
|
@@ -450,23 +453,30 @@ var MapLibreAdapter = class extends BaseMapAdapter {
|
|
|
450
453
|
const px = [e.point.x, e.point.y];
|
|
451
454
|
const info = {
|
|
452
455
|
altKey: e.originalEvent.altKey,
|
|
453
|
-
shiftKey: e.originalEvent.shiftKey
|
|
456
|
+
shiftKey: e.originalEvent.shiftKey,
|
|
457
|
+
native: e.originalEvent
|
|
454
458
|
};
|
|
455
459
|
hub.fireDown(px, info);
|
|
456
460
|
};
|
|
457
461
|
const onMove = (e) => {
|
|
458
462
|
const px = [e.point.x, e.point.y];
|
|
459
|
-
hub.fireMove(px, {
|
|
463
|
+
hub.fireMove(px, {
|
|
464
|
+
shiftKey: e.originalEvent.shiftKey,
|
|
465
|
+
native: e.originalEvent
|
|
466
|
+
});
|
|
460
467
|
};
|
|
461
468
|
const onUp = (e) => {
|
|
462
469
|
const px = [e.point.x, e.point.y];
|
|
463
|
-
hub.fireUp(px, {
|
|
470
|
+
hub.fireUp(px, {
|
|
471
|
+
shiftKey: e.originalEvent.shiftKey,
|
|
472
|
+
native: e.originalEvent
|
|
473
|
+
});
|
|
464
474
|
};
|
|
465
475
|
const onTouchStart = (e) => {
|
|
466
476
|
if (e.points.length !== 1) return;
|
|
467
477
|
const before = dragPanWasEnabled;
|
|
468
478
|
const px = [e.point.x, e.point.y];
|
|
469
|
-
hub.fireDown(px,
|
|
479
|
+
hub.fireDown(px, touchInfo(e));
|
|
470
480
|
touchDragActive = dragPanWasEnabled !== before;
|
|
471
481
|
if (touchDragActive) preventMapEventDefaults(e);
|
|
472
482
|
};
|
|
@@ -475,20 +485,20 @@ var MapLibreAdapter = class extends BaseMapAdapter {
|
|
|
475
485
|
const px = [e.point.x, e.point.y];
|
|
476
486
|
if (touchCount > 1 && touchDragActive && !multiTouchCancelled) {
|
|
477
487
|
multiTouchCancelled = true;
|
|
478
|
-
hub.fireUp(px,
|
|
488
|
+
hub.fireUp(px, touchInfo(e));
|
|
479
489
|
touchDragActive = false;
|
|
480
490
|
preventMapEventDefaults(e);
|
|
481
491
|
return;
|
|
482
492
|
}
|
|
483
493
|
if (touchCount > 1) return;
|
|
484
494
|
if (touchCount === 1) multiTouchCancelled = false;
|
|
485
|
-
hub.fireMove(px,
|
|
495
|
+
hub.fireMove(px, touchInfo(e));
|
|
486
496
|
if (touchDragActive) preventMapEventDefaults(e);
|
|
487
497
|
};
|
|
488
498
|
const onTouchEnd = (e) => {
|
|
489
499
|
multiTouchCancelled = false;
|
|
490
500
|
const px = [e.point.x, e.point.y];
|
|
491
|
-
hub.fireUp(px,
|
|
501
|
+
hub.fireUp(px, touchInfo(e));
|
|
492
502
|
touchDragActive = false;
|
|
493
503
|
};
|
|
494
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"
|