leaflet-polydraw 0.8.9 → 0.9.0
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/README.md +0 -13
- package/dist/leaflet-polydraw.css +1 -1
- package/dist/polydraw.es.js +273 -127
- package/dist/polydraw.es.js.map +1 -1
- package/dist/polydraw.umd.min.js +1 -1
- package/dist/polydraw.umd.min.js.map +1 -1
- package/dist/styles/polydraw.css +59 -117
- package/dist/types/managers/event-manager.d.ts +23 -0
- package/dist/types/managers/event-manager.d.ts.map +1 -0
- package/dist/types/managers/mode-manager.d.ts +3 -1
- package/dist/types/managers/mode-manager.d.ts.map +1 -1
- package/dist/types/managers/polygon-draw-manager.d.ts +3 -9
- package/dist/types/managers/polygon-draw-manager.d.ts.map +1 -1
- package/dist/types/managers/polygon-interaction-manager.d.ts +4 -9
- package/dist/types/managers/polygon-interaction-manager.d.ts.map +1 -1
- package/dist/types/managers/polygon-mutation-manager.d.ts +3 -5
- package/dist/types/managers/polygon-mutation-manager.d.ts.map +1 -1
- package/dist/types/polydraw.d.ts +4 -3
- package/dist/types/polydraw.d.ts.map +1 -1
- package/dist/types/polygon.util.d.ts +7 -0
- package/dist/types/polygon.util.d.ts.map +1 -1
- package/dist/types/turf-helper.d.ts +3 -0
- package/dist/types/turf-helper.d.ts.map +1 -1
- package/dist/types/types/polydraw-interfaces.d.ts +2 -0
- package/dist/types/types/polydraw-interfaces.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/polydraw.es.js
CHANGED
|
@@ -11644,6 +11644,52 @@ function convex(geojson, options = {}) {
|
|
|
11644
11644
|
}
|
|
11645
11645
|
return null;
|
|
11646
11646
|
}
|
|
11647
|
+
function centerOfMass(geojson, options = {}) {
|
|
11648
|
+
switch (getType(geojson)) {
|
|
11649
|
+
case "Point":
|
|
11650
|
+
return point(getCoord(geojson), options.properties);
|
|
11651
|
+
case "Polygon":
|
|
11652
|
+
var coords = [];
|
|
11653
|
+
coordEach(geojson, function(coord) {
|
|
11654
|
+
coords.push(coord);
|
|
11655
|
+
});
|
|
11656
|
+
var centre = centroid(geojson, { properties: options.properties });
|
|
11657
|
+
var translation = centre.geometry.coordinates;
|
|
11658
|
+
var sx = 0;
|
|
11659
|
+
var sy = 0;
|
|
11660
|
+
var sArea = 0;
|
|
11661
|
+
var i, pi2, pj, xi, xj, yi, yj, a;
|
|
11662
|
+
var neutralizedPoints = coords.map(function(point2) {
|
|
11663
|
+
return [point2[0] - translation[0], point2[1] - translation[1]];
|
|
11664
|
+
});
|
|
11665
|
+
for (i = 0; i < coords.length - 1; i++) {
|
|
11666
|
+
pi2 = neutralizedPoints[i];
|
|
11667
|
+
xi = pi2[0];
|
|
11668
|
+
yi = pi2[1];
|
|
11669
|
+
pj = neutralizedPoints[i + 1];
|
|
11670
|
+
xj = pj[0];
|
|
11671
|
+
yj = pj[1];
|
|
11672
|
+
a = xi * yj - xj * yi;
|
|
11673
|
+
sArea += a;
|
|
11674
|
+
sx += (xi + xj) * a;
|
|
11675
|
+
sy += (yi + yj) * a;
|
|
11676
|
+
}
|
|
11677
|
+
if (sArea === 0) {
|
|
11678
|
+
return centre;
|
|
11679
|
+
} else {
|
|
11680
|
+
var area2 = sArea * 0.5;
|
|
11681
|
+
var areaFactor = 1 / (6 * area2);
|
|
11682
|
+
return point(
|
|
11683
|
+
[translation[0] + areaFactor * sx, translation[1] + areaFactor * sy],
|
|
11684
|
+
options.properties
|
|
11685
|
+
);
|
|
11686
|
+
}
|
|
11687
|
+
default:
|
|
11688
|
+
var hull = convex(geojson);
|
|
11689
|
+
if (hull) return centerOfMass(hull, { properties: options.properties });
|
|
11690
|
+
else return centroid(geojson, { properties: options.properties });
|
|
11691
|
+
}
|
|
11692
|
+
}
|
|
11647
11693
|
function clone$1(geojson) {
|
|
11648
11694
|
if (!geojson) {
|
|
11649
11695
|
throw new Error("geojson is required");
|
|
@@ -16060,6 +16106,9 @@ class TurfHelper {
|
|
|
16060
16106
|
const length$12 = length(poly, { units: "kilometers" });
|
|
16061
16107
|
return length$12;
|
|
16062
16108
|
}
|
|
16109
|
+
getCenterOfMass(feature2) {
|
|
16110
|
+
return centerOfMass(feature2);
|
|
16111
|
+
}
|
|
16063
16112
|
getDoubleElbowLatLngs(points) {
|
|
16064
16113
|
const doubleized = [];
|
|
16065
16114
|
const len = points.length;
|
|
@@ -16997,6 +17046,18 @@ class PolygonUtil {
|
|
|
16997
17046
|
const bounds = polyLine.getBounds();
|
|
16998
17047
|
return bounds;
|
|
16999
17048
|
}
|
|
17049
|
+
/**
|
|
17050
|
+
* Calculates the center of mass of the polygon.
|
|
17051
|
+
* @param polygon A GeoJSON polygon.
|
|
17052
|
+
* @returns The center LatLng.
|
|
17053
|
+
*/
|
|
17054
|
+
static getCenterOfMass(polygon2) {
|
|
17055
|
+
const centerOfMass2 = this.turfHelper.getCenterOfMass(polygon2);
|
|
17056
|
+
return {
|
|
17057
|
+
lat: centerOfMass2.geometry.coordinates[1],
|
|
17058
|
+
lng: centerOfMass2.geometry.coordinates[0]
|
|
17059
|
+
};
|
|
17060
|
+
}
|
|
17000
17061
|
}
|
|
17001
17062
|
__publicField(PolygonUtil, "turfHelper", new TurfHelper(defaultConfig));
|
|
17002
17063
|
class PolygonInfo {
|
|
@@ -17214,11 +17275,57 @@ class MapStateService {
|
|
|
17214
17275
|
updatePolygons(polygons) {
|
|
17215
17276
|
}
|
|
17216
17277
|
}
|
|
17278
|
+
class EventManager {
|
|
17279
|
+
constructor() {
|
|
17280
|
+
__publicField(this, "eventListeners", /* @__PURE__ */ new Map());
|
|
17281
|
+
}
|
|
17282
|
+
/**
|
|
17283
|
+
* Register an event listener.
|
|
17284
|
+
* @param event - The event to listen for.
|
|
17285
|
+
* @param callback - The callback to execute when the event is emitted.
|
|
17286
|
+
*/
|
|
17287
|
+
on(event, callback) {
|
|
17288
|
+
var _a2;
|
|
17289
|
+
if (!this.eventListeners.has(event)) {
|
|
17290
|
+
this.eventListeners.set(event, []);
|
|
17291
|
+
}
|
|
17292
|
+
(_a2 = this.eventListeners.get(event)) == null ? void 0 : _a2.push(callback);
|
|
17293
|
+
}
|
|
17294
|
+
/**
|
|
17295
|
+
* Unregister an event listener.
|
|
17296
|
+
* @param event - The event to stop listening for.
|
|
17297
|
+
* @param callback - The specific callback to remove.
|
|
17298
|
+
*/
|
|
17299
|
+
off(event, callback) {
|
|
17300
|
+
if (this.eventListeners.has(event)) {
|
|
17301
|
+
const listeners = this.eventListeners.get(event);
|
|
17302
|
+
if (listeners) {
|
|
17303
|
+
const index = listeners.indexOf(callback);
|
|
17304
|
+
if (index > -1) {
|
|
17305
|
+
listeners.splice(index, 1);
|
|
17306
|
+
}
|
|
17307
|
+
}
|
|
17308
|
+
}
|
|
17309
|
+
}
|
|
17310
|
+
/**
|
|
17311
|
+
* Emit an event.
|
|
17312
|
+
* @param event - The event to emit.
|
|
17313
|
+
* @param data - The data to pass to the event listeners.
|
|
17314
|
+
*/
|
|
17315
|
+
emit(event, data) {
|
|
17316
|
+
var _a2;
|
|
17317
|
+
if (this.eventListeners.has(event)) {
|
|
17318
|
+
(_a2 = this.eventListeners.get(event)) == null ? void 0 : _a2.forEach((callback) => callback(data));
|
|
17319
|
+
}
|
|
17320
|
+
}
|
|
17321
|
+
}
|
|
17217
17322
|
class ModeManager {
|
|
17218
|
-
constructor(config) {
|
|
17323
|
+
constructor(config, eventManager) {
|
|
17219
17324
|
__publicField(this, "state");
|
|
17220
17325
|
__publicField(this, "config");
|
|
17326
|
+
__publicField(this, "eventManager");
|
|
17221
17327
|
this.config = config;
|
|
17328
|
+
this.eventManager = eventManager;
|
|
17222
17329
|
this.state = this.createInitialState();
|
|
17223
17330
|
}
|
|
17224
17331
|
/**
|
|
@@ -17268,6 +17375,7 @@ class ModeManager {
|
|
|
17268
17375
|
break;
|
|
17269
17376
|
}
|
|
17270
17377
|
this.state.isDrawingActive = mode !== DrawMode.Off;
|
|
17378
|
+
this.eventManager.emit("polydraw:mode:change", { mode });
|
|
17271
17379
|
}
|
|
17272
17380
|
/**
|
|
17273
17381
|
* Set interaction state for Off mode (normal editing)
|
|
@@ -17401,8 +17509,8 @@ class PolygonDrawManager {
|
|
|
17401
17509
|
__publicField(this, "map");
|
|
17402
17510
|
__publicField(this, "config");
|
|
17403
17511
|
__publicField(this, "modeManager");
|
|
17512
|
+
__publicField(this, "eventManager");
|
|
17404
17513
|
__publicField(this, "tracer");
|
|
17405
|
-
__publicField(this, "eventListeners", /* @__PURE__ */ new Map());
|
|
17406
17514
|
// Point-to-Point drawing state
|
|
17407
17515
|
__publicField(this, "p2pMarkers", []);
|
|
17408
17516
|
__publicField(this, "isModifierKeyHeld", false);
|
|
@@ -17411,28 +17519,9 @@ class PolygonDrawManager {
|
|
|
17411
17519
|
this.map = dependencies.map;
|
|
17412
17520
|
this.config = dependencies.config;
|
|
17413
17521
|
this.modeManager = dependencies.modeManager;
|
|
17522
|
+
this.eventManager = dependencies.eventManager;
|
|
17414
17523
|
this.tracer = dependencies.tracer;
|
|
17415
17524
|
}
|
|
17416
|
-
/**
|
|
17417
|
-
* Add event listener
|
|
17418
|
-
*/
|
|
17419
|
-
on(event, callback) {
|
|
17420
|
-
console.log("PolygonDrawManager on");
|
|
17421
|
-
if (!this.eventListeners.has(event)) {
|
|
17422
|
-
this.eventListeners.set(event, []);
|
|
17423
|
-
}
|
|
17424
|
-
this.eventListeners.get(event).push(callback);
|
|
17425
|
-
}
|
|
17426
|
-
/**
|
|
17427
|
-
* Emit event to all listeners
|
|
17428
|
-
*/
|
|
17429
|
-
emit(event, data) {
|
|
17430
|
-
console.log("PolygonDrawManager emit");
|
|
17431
|
-
const listeners = this.eventListeners.get(event);
|
|
17432
|
-
if (listeners) {
|
|
17433
|
-
listeners.forEach((callback) => callback(data));
|
|
17434
|
-
}
|
|
17435
|
-
}
|
|
17436
17525
|
/**
|
|
17437
17526
|
* Handle mouse move during freehand drawing
|
|
17438
17527
|
*/
|
|
@@ -17475,7 +17564,7 @@ class PolygonDrawManager {
|
|
|
17475
17564
|
error: "Invalid polygon created from trace"
|
|
17476
17565
|
};
|
|
17477
17566
|
}
|
|
17478
|
-
this.emit("
|
|
17567
|
+
this.eventManager.emit("polydraw:polygon:created", {
|
|
17479
17568
|
polygon: geoPos,
|
|
17480
17569
|
mode: this.modeManager.getCurrentMode()
|
|
17481
17570
|
});
|
|
@@ -17606,7 +17695,7 @@ class PolygonDrawManager {
|
|
|
17606
17695
|
const geoPos = this.turfHelper.getMultiPolygon([[coordinates]]);
|
|
17607
17696
|
this.clearP2pMarkers();
|
|
17608
17697
|
this.resetTracer();
|
|
17609
|
-
this.emit("
|
|
17698
|
+
this.eventManager.emit("polydraw:polygon:created", {
|
|
17610
17699
|
polygon: geoPos,
|
|
17611
17700
|
mode: DrawMode.PointToPoint,
|
|
17612
17701
|
isPointToPoint: true
|
|
@@ -17624,7 +17713,9 @@ class PolygonDrawManager {
|
|
|
17624
17713
|
console.log("PolygonDrawManager cancelPointToPointDrawing");
|
|
17625
17714
|
this.clearP2pMarkers();
|
|
17626
17715
|
this.resetTracer();
|
|
17627
|
-
this.emit("
|
|
17716
|
+
this.eventManager.emit("polydraw:draw:cancel", {
|
|
17717
|
+
mode: DrawMode.PointToPoint
|
|
17718
|
+
});
|
|
17628
17719
|
}
|
|
17629
17720
|
/**
|
|
17630
17721
|
* Clear all P2P markers
|
|
@@ -18321,11 +18412,12 @@ class PolygonInteractionManager {
|
|
|
18321
18412
|
__publicField(this, "map");
|
|
18322
18413
|
__publicField(this, "config");
|
|
18323
18414
|
__publicField(this, "modeManager");
|
|
18324
|
-
__publicField(this, "
|
|
18415
|
+
__publicField(this, "eventManager");
|
|
18325
18416
|
// Polygon drag state
|
|
18326
18417
|
__publicField(this, "currentDragPolygon", null);
|
|
18327
18418
|
__publicField(this, "currentModifierDragMode", false);
|
|
18328
18419
|
__publicField(this, "isModifierKeyHeld", false);
|
|
18420
|
+
__publicField(this, "_openMenuPopup", null);
|
|
18329
18421
|
// Read-only access to feature groups
|
|
18330
18422
|
__publicField(this, "getFeatureGroups");
|
|
18331
18423
|
__publicField(this, "addFeatureGroup");
|
|
@@ -18404,30 +18496,11 @@ class PolygonInteractionManager {
|
|
|
18404
18496
|
this.map = dependencies.map;
|
|
18405
18497
|
this.config = dependencies.config;
|
|
18406
18498
|
this.modeManager = dependencies.modeManager;
|
|
18499
|
+
this.eventManager = dependencies.eventManager;
|
|
18407
18500
|
this.getFeatureGroups = featureGroupAccess.getFeatureGroups;
|
|
18408
18501
|
this.addFeatureGroup = featureGroupAccess.addFeatureGroup;
|
|
18409
18502
|
this.removeFeatureGroup = featureGroupAccess.removeFeatureGroup;
|
|
18410
18503
|
}
|
|
18411
|
-
/**
|
|
18412
|
-
* Add event listener
|
|
18413
|
-
*/
|
|
18414
|
-
on(event, callback) {
|
|
18415
|
-
console.log("PolygonInteractionManager on");
|
|
18416
|
-
if (!this.eventListeners.has(event)) {
|
|
18417
|
-
this.eventListeners.set(event, []);
|
|
18418
|
-
}
|
|
18419
|
-
this.eventListeners.get(event).push(callback);
|
|
18420
|
-
}
|
|
18421
|
-
/**
|
|
18422
|
-
* Emit event to all listeners
|
|
18423
|
-
*/
|
|
18424
|
-
emit(event, data) {
|
|
18425
|
-
console.log("PolygonInteractionManager emit");
|
|
18426
|
-
const listeners = this.eventListeners.get(event);
|
|
18427
|
-
if (listeners) {
|
|
18428
|
-
listeners.forEach((callback) => callback(data));
|
|
18429
|
-
}
|
|
18430
|
-
}
|
|
18431
18504
|
/**
|
|
18432
18505
|
* Add markers to a polygon feature group
|
|
18433
18506
|
*/
|
|
@@ -18459,6 +18532,7 @@ class PolygonInteractionManager {
|
|
|
18459
18532
|
iconClasses = this.config.markers.markerInfoIcon.styleClasses;
|
|
18460
18533
|
}
|
|
18461
18534
|
const processedClasses = Array.isArray(iconClasses) ? iconClasses : [iconClasses];
|
|
18535
|
+
const isSpecialMarker = i === menuMarkerIdx && this.config.markers.menuMarker || i === deleteMarkerIdx && this.config.markers.deleteMarker || i === infoMarkerIdx && this.config.markers.infoMarker;
|
|
18462
18536
|
const marker = new L.Marker(latlng, {
|
|
18463
18537
|
icon: this.createDivIcon(processedClasses),
|
|
18464
18538
|
draggable: this.config.modes.dragElbow,
|
|
@@ -18504,7 +18578,7 @@ class PolygonInteractionManager {
|
|
|
18504
18578
|
e.preventDefault();
|
|
18505
18579
|
e.stopPropagation();
|
|
18506
18580
|
marker.fire("click");
|
|
18507
|
-
if (this.isDraggingMarker) {
|
|
18581
|
+
if (this.isDraggingMarker && !isSpecialMarker) {
|
|
18508
18582
|
const fg = marker._polydrawFeatureGroup;
|
|
18509
18583
|
if (this.modeManager.canPerformAction("markerDrag") && fg) {
|
|
18510
18584
|
this.markerDragEnd(fg);
|
|
@@ -18531,12 +18605,25 @@ class PolygonInteractionManager {
|
|
|
18531
18605
|
marker.options.zIndexOffset = this.config.markers.markerMenuIcon.zIndexOffset ?? this.config.markers.zIndexOffset;
|
|
18532
18606
|
marker.on("click", () => {
|
|
18533
18607
|
console.log("menu marker clicked");
|
|
18534
|
-
|
|
18608
|
+
const polygonGeoJSON = this.getPolygonGeoJSONFromFeatureGroup(featureGroup);
|
|
18609
|
+
const centerOfMass2 = PolygonUtil.getCenterOfMass(polygonGeoJSON);
|
|
18535
18610
|
const menuPopup = this.generateMenuMarkerPopup(latlngs, featureGroup);
|
|
18536
|
-
|
|
18537
|
-
marker.openPopup();
|
|
18611
|
+
menuPopup.setLatLng(centerOfMass2).openOn(this.map);
|
|
18538
18612
|
});
|
|
18539
|
-
marker.on("popupopen", () => {
|
|
18613
|
+
marker.on("popupopen", (e) => {
|
|
18614
|
+
const popup = e.popup;
|
|
18615
|
+
const popupContent = popup.getElement();
|
|
18616
|
+
if (!popupContent) return;
|
|
18617
|
+
setTimeout(() => {
|
|
18618
|
+
const mapContainer = this.map.getContainer();
|
|
18619
|
+
const mapBounds = mapContainer.getBoundingClientRect();
|
|
18620
|
+
const popupBounds = popupContent.getBoundingClientRect();
|
|
18621
|
+
if (popupBounds.left < mapBounds.left) {
|
|
18622
|
+
popupContent.style.transform = `translateX(${mapBounds.left - popupBounds.left}px)`;
|
|
18623
|
+
} else if (popupBounds.right > mapBounds.right) {
|
|
18624
|
+
popupContent.style.transform = `translateX(${mapBounds.right - popupBounds.right}px)`;
|
|
18625
|
+
}
|
|
18626
|
+
}, 0);
|
|
18540
18627
|
console.log("popupopen, setting touchAction to manipulation");
|
|
18541
18628
|
const container2 = this.map.getContainer();
|
|
18542
18629
|
if (container2) {
|
|
@@ -18558,12 +18645,24 @@ class PolygonInteractionManager {
|
|
|
18558
18645
|
marker.options.zIndexOffset = this.config.markers.markerInfoIcon.zIndexOffset ?? this.config.markers.zIndexOffset;
|
|
18559
18646
|
marker.on("click", () => {
|
|
18560
18647
|
console.log("info marker clicked");
|
|
18561
|
-
marker.unbindPopup();
|
|
18562
18648
|
const infoPopup = this.generateInfoMarkerPopup(area2, perimeter);
|
|
18563
|
-
|
|
18564
|
-
|
|
18649
|
+
const centerOfMass2 = PolygonUtil.getCenterOfMass(polygonGeoJSON);
|
|
18650
|
+
infoPopup.setLatLng(centerOfMass2).openOn(this.map);
|
|
18565
18651
|
});
|
|
18566
|
-
marker.on("popupopen", () => {
|
|
18652
|
+
marker.on("popupopen", (e) => {
|
|
18653
|
+
const popup = e.popup;
|
|
18654
|
+
const popupContent = popup.getElement();
|
|
18655
|
+
if (!popupContent) return;
|
|
18656
|
+
setTimeout(() => {
|
|
18657
|
+
const mapContainer = this.map.getContainer();
|
|
18658
|
+
const mapBounds = mapContainer.getBoundingClientRect();
|
|
18659
|
+
const popupBounds = popupContent.getBoundingClientRect();
|
|
18660
|
+
if (popupBounds.left < mapBounds.left) {
|
|
18661
|
+
popupContent.style.transform = `translateX(${mapBounds.left - popupBounds.left}px)`;
|
|
18662
|
+
} else if (popupBounds.right > mapBounds.right) {
|
|
18663
|
+
popupContent.style.transform = `translateX(${mapBounds.right - popupBounds.right}px)`;
|
|
18664
|
+
}
|
|
18665
|
+
}, 0);
|
|
18567
18666
|
console.log("popupopen, setting touchAction to manipulation");
|
|
18568
18667
|
const container2 = this.map.getContainer();
|
|
18569
18668
|
if (container2) {
|
|
@@ -18596,9 +18695,10 @@ class PolygonInteractionManager {
|
|
|
18596
18695
|
}
|
|
18597
18696
|
} else {
|
|
18598
18697
|
if (i === deleteMarkerIdx && this.config.markers.deleteMarker) {
|
|
18698
|
+
this.map.closePopup();
|
|
18599
18699
|
this.removeFeatureGroup(featureGroup);
|
|
18600
18700
|
this.polygonInformation.createPolygonInformationStorage(this.getFeatureGroups());
|
|
18601
|
-
this.emit("
|
|
18701
|
+
this.eventManager.emit("polydraw:polygon:deleted", void 0);
|
|
18602
18702
|
}
|
|
18603
18703
|
}
|
|
18604
18704
|
}
|
|
@@ -18862,7 +18962,7 @@ class PolygonInteractionManager {
|
|
|
18862
18962
|
const polydrawPolygon = parentPolygon;
|
|
18863
18963
|
const optimizationLevel = polydrawPolygon._polydrawOptimizationLevel || 0;
|
|
18864
18964
|
this.removeFeatureGroup(parentFeatureGroup);
|
|
18865
|
-
this.emit("
|
|
18965
|
+
this.eventManager.emit("polydraw:polygon:updated", {
|
|
18866
18966
|
operation: "addVertex",
|
|
18867
18967
|
polygon: newPolygon,
|
|
18868
18968
|
optimizationLevel
|
|
@@ -18934,7 +19034,7 @@ class PolygonInteractionManager {
|
|
|
18934
19034
|
this.removeFeatureGroup(currentFeatureGroup);
|
|
18935
19035
|
}
|
|
18936
19036
|
const newPolygon = this.turfHelper.getMultiPolygon([newAllRings]);
|
|
18937
|
-
this.emit("
|
|
19037
|
+
this.eventManager.emit("polydraw:polygon:updated", {
|
|
18938
19038
|
operation: "removeVertex",
|
|
18939
19039
|
polygon: newPolygon
|
|
18940
19040
|
});
|
|
@@ -19036,6 +19136,9 @@ class PolygonInteractionManager {
|
|
|
19036
19136
|
console.log("PolygonInteractionManager markerDragEnd");
|
|
19037
19137
|
this.polygonInformation.deletePolygonInformationStorage();
|
|
19038
19138
|
const featureCollection2 = featureGroup.toGeoJSON();
|
|
19139
|
+
if (!featureCollection2.features || featureCollection2.features.length === 0) {
|
|
19140
|
+
return;
|
|
19141
|
+
}
|
|
19039
19142
|
this.removeFeatureGroup(featureGroup);
|
|
19040
19143
|
if (featureCollection2.features[0].geometry.coordinates.length > 1) {
|
|
19041
19144
|
for (const element of featureCollection2.features[0].geometry.coordinates) {
|
|
@@ -19043,14 +19146,14 @@ class PolygonInteractionManager {
|
|
|
19043
19146
|
if (this.turfHelper.hasKinks(feature2)) {
|
|
19044
19147
|
const unkink = this.turfHelper.getKinks(feature2);
|
|
19045
19148
|
for (const polygon2 of unkink) {
|
|
19046
|
-
this.emit("
|
|
19149
|
+
this.eventManager.emit("polydraw:polygon:updated", {
|
|
19047
19150
|
operation: "markerDrag",
|
|
19048
19151
|
polygon: this.turfHelper.getTurfPolygon(polygon2),
|
|
19049
19152
|
allowMerge: true
|
|
19050
19153
|
});
|
|
19051
19154
|
}
|
|
19052
19155
|
} else {
|
|
19053
|
-
this.emit("
|
|
19156
|
+
this.eventManager.emit("polydraw:polygon:updated", {
|
|
19054
19157
|
operation: "markerDrag",
|
|
19055
19158
|
polygon: feature2,
|
|
19056
19159
|
allowMerge: true
|
|
@@ -19064,14 +19167,24 @@ class PolygonInteractionManager {
|
|
|
19064
19167
|
if (this.turfHelper.hasKinks(feature2)) {
|
|
19065
19168
|
const unkink = this.turfHelper.getKinks(feature2);
|
|
19066
19169
|
for (const polygon2 of unkink) {
|
|
19067
|
-
this.emit("
|
|
19170
|
+
this.eventManager.emit("polydraw:polygon:updated", {
|
|
19171
|
+
operation: "markerDrag",
|
|
19172
|
+
polygon: this.turfHelper.getTurfPolygon(polygon2),
|
|
19173
|
+
allowMerge: true
|
|
19174
|
+
});
|
|
19175
|
+
this.eventManager.emit("polydraw:polygon:updated", {
|
|
19068
19176
|
operation: "markerDrag",
|
|
19069
19177
|
polygon: this.turfHelper.getTurfPolygon(polygon2),
|
|
19070
19178
|
allowMerge: true
|
|
19071
19179
|
});
|
|
19072
19180
|
}
|
|
19073
19181
|
} else {
|
|
19074
|
-
this.emit("
|
|
19182
|
+
this.eventManager.emit("polydraw:polygon:updated", {
|
|
19183
|
+
operation: "markerDrag",
|
|
19184
|
+
polygon: feature2,
|
|
19185
|
+
allowMerge: true
|
|
19186
|
+
});
|
|
19187
|
+
this.eventManager.emit("polydraw:polygon:updated", {
|
|
19075
19188
|
operation: "markerDrag",
|
|
19076
19189
|
polygon: feature2,
|
|
19077
19190
|
allowMerge: true
|
|
@@ -19177,7 +19290,7 @@ class PolygonInteractionManager {
|
|
|
19177
19290
|
}
|
|
19178
19291
|
this.removeFeatureGroup(featureGroup);
|
|
19179
19292
|
const feature2 = this.turfHelper.getTurfPolygon(newGeoJSON);
|
|
19180
|
-
this.emit("
|
|
19293
|
+
this.eventManager.emit("polydraw:polygon:updated", {
|
|
19181
19294
|
operation: "polygonDrag",
|
|
19182
19295
|
polygon: feature2,
|
|
19183
19296
|
allowMerge: true
|
|
@@ -19333,7 +19446,7 @@ class PolygonInteractionManager {
|
|
|
19333
19446
|
const coords = this.turfHelper.getCoords(difference3);
|
|
19334
19447
|
for (const coordSet of coords) {
|
|
19335
19448
|
const individualPolygon = this.turfHelper.getMultiPolygon([coordSet]);
|
|
19336
|
-
this.emit("
|
|
19449
|
+
this.eventManager.emit("polydraw:polygon:updated", {
|
|
19337
19450
|
operation: "modifierSubtract",
|
|
19338
19451
|
polygon: this.turfHelper.getTurfPolygon(individualPolygon),
|
|
19339
19452
|
allowMerge: false
|
|
@@ -19343,7 +19456,7 @@ class PolygonInteractionManager {
|
|
|
19343
19456
|
}
|
|
19344
19457
|
} catch (differenceError) {
|
|
19345
19458
|
console.warn("Failed to perform difference operation:", differenceError);
|
|
19346
|
-
this.emit("
|
|
19459
|
+
this.eventManager.emit("polydraw:polygon:updated", {
|
|
19347
19460
|
operation: "modifierSubtractFallback",
|
|
19348
19461
|
polygon: existingPolygon,
|
|
19349
19462
|
allowMerge: false
|
|
@@ -19528,8 +19641,6 @@ class PolygonInteractionManager {
|
|
|
19528
19641
|
outerWrapper.classList.add("alter-marker-outer-wrapper");
|
|
19529
19642
|
const wrapper = document.createElement("div");
|
|
19530
19643
|
wrapper.classList.add("alter-marker-wrapper");
|
|
19531
|
-
const invertedCorner = document.createElement("i");
|
|
19532
|
-
invertedCorner.classList.add("inverted-corner");
|
|
19533
19644
|
const markerContent = document.createElement("div");
|
|
19534
19645
|
markerContent.classList.add("content");
|
|
19535
19646
|
const markerContentWrapper = document.createElement("div");
|
|
@@ -19553,7 +19664,6 @@ class PolygonInteractionManager {
|
|
|
19553
19664
|
const separator = document.createElement("div");
|
|
19554
19665
|
separator.classList.add("separator");
|
|
19555
19666
|
outerWrapper.appendChild(wrapper);
|
|
19556
|
-
wrapper.appendChild(invertedCorner);
|
|
19557
19667
|
wrapper.appendChild(markerContent);
|
|
19558
19668
|
markerContent.appendChild(markerContentWrapper);
|
|
19559
19669
|
markerContentWrapper.appendChild(simplify3);
|
|
@@ -19563,42 +19673,83 @@ class PolygonInteractionManager {
|
|
|
19563
19673
|
markerContentWrapper.appendChild(bbox2);
|
|
19564
19674
|
markerContentWrapper.appendChild(separator.cloneNode());
|
|
19565
19675
|
markerContentWrapper.appendChild(bezier2);
|
|
19676
|
+
const closePopupIfOpen = () => {
|
|
19677
|
+
if (this._openMenuPopup) {
|
|
19678
|
+
this.map.closePopup(this._openMenuPopup);
|
|
19679
|
+
this._openMenuPopup = null;
|
|
19680
|
+
}
|
|
19681
|
+
};
|
|
19566
19682
|
simplify3.addEventListener("touchend", (e) => {
|
|
19567
|
-
console.log("simplify touchend");
|
|
19568
19683
|
e.preventDefault();
|
|
19569
19684
|
e.stopPropagation();
|
|
19570
|
-
this.emit("
|
|
19685
|
+
this.eventManager.emit("polydraw:menu:action", {
|
|
19686
|
+
action: "simplify",
|
|
19687
|
+
latLngs,
|
|
19688
|
+
featureGroup
|
|
19689
|
+
});
|
|
19690
|
+
closePopupIfOpen();
|
|
19571
19691
|
});
|
|
19572
19692
|
simplify3.onclick = () => {
|
|
19573
|
-
|
|
19574
|
-
|
|
19693
|
+
this.eventManager.emit("polydraw:menu:action", {
|
|
19694
|
+
action: "simplify",
|
|
19695
|
+
latLngs,
|
|
19696
|
+
featureGroup
|
|
19697
|
+
});
|
|
19698
|
+
closePopupIfOpen();
|
|
19575
19699
|
};
|
|
19576
19700
|
bbox2.addEventListener("touchend", (e) => {
|
|
19577
|
-
console.log("bbox touchend");
|
|
19578
19701
|
e.preventDefault();
|
|
19579
19702
|
e.stopPropagation();
|
|
19580
|
-
this.emit("
|
|
19703
|
+
this.eventManager.emit("polydraw:menu:action", {
|
|
19704
|
+
action: "bbox",
|
|
19705
|
+
latLngs,
|
|
19706
|
+
featureGroup
|
|
19707
|
+
});
|
|
19708
|
+
closePopupIfOpen();
|
|
19581
19709
|
});
|
|
19582
19710
|
bbox2.onclick = () => {
|
|
19583
|
-
this.emit("
|
|
19711
|
+
this.eventManager.emit("polydraw:menu:action", {
|
|
19712
|
+
action: "bbox",
|
|
19713
|
+
latLngs,
|
|
19714
|
+
featureGroup
|
|
19715
|
+
});
|
|
19716
|
+
closePopupIfOpen();
|
|
19584
19717
|
};
|
|
19585
19718
|
doubleElbows.addEventListener("touchend", (e) => {
|
|
19586
|
-
console.log("doubleElbows touchend");
|
|
19587
19719
|
e.preventDefault();
|
|
19588
19720
|
e.stopPropagation();
|
|
19589
|
-
this.emit("
|
|
19721
|
+
this.eventManager.emit("polydraw:menu:action", {
|
|
19722
|
+
action: "doubleElbows",
|
|
19723
|
+
latLngs,
|
|
19724
|
+
featureGroup
|
|
19725
|
+
});
|
|
19726
|
+
closePopupIfOpen();
|
|
19590
19727
|
});
|
|
19591
19728
|
doubleElbows.onclick = () => {
|
|
19592
|
-
this.emit("
|
|
19729
|
+
this.eventManager.emit("polydraw:menu:action", {
|
|
19730
|
+
action: "doubleElbows",
|
|
19731
|
+
latLngs,
|
|
19732
|
+
featureGroup
|
|
19733
|
+
});
|
|
19734
|
+
closePopupIfOpen();
|
|
19593
19735
|
};
|
|
19594
19736
|
bezier2.addEventListener("touchend", (e) => {
|
|
19595
|
-
console.log("bezier touchend");
|
|
19596
19737
|
e.preventDefault();
|
|
19597
19738
|
e.stopPropagation();
|
|
19598
|
-
this.emit("
|
|
19739
|
+
this.eventManager.emit("polydraw:menu:action", {
|
|
19740
|
+
action: "bezier",
|
|
19741
|
+
latLngs,
|
|
19742
|
+
featureGroup
|
|
19743
|
+
});
|
|
19744
|
+
closePopupIfOpen();
|
|
19599
19745
|
});
|
|
19600
19746
|
bezier2.onclick = () => {
|
|
19601
|
-
this.emit("
|
|
19747
|
+
this.eventManager.emit("polydraw:menu:action", {
|
|
19748
|
+
action: "bezier",
|
|
19749
|
+
latLngs,
|
|
19750
|
+
featureGroup
|
|
19751
|
+
});
|
|
19752
|
+
closePopupIfOpen();
|
|
19602
19753
|
};
|
|
19603
19754
|
L.DomEvent.disableClickPropagation(outerWrapper);
|
|
19604
19755
|
outerWrapper.style.pointerEvents = "auto";
|
|
@@ -19606,7 +19757,13 @@ class PolygonInteractionManager {
|
|
|
19606
19757
|
btn.style.pointerEvents = "auto";
|
|
19607
19758
|
btn.addEventListener("click", (e) => e.stopPropagation());
|
|
19608
19759
|
});
|
|
19609
|
-
|
|
19760
|
+
const popup = L.popup({
|
|
19761
|
+
closeButton: true,
|
|
19762
|
+
autoClose: true,
|
|
19763
|
+
className: "menu-popup"
|
|
19764
|
+
}).setContent(outerWrapper);
|
|
19765
|
+
this._openMenuPopup = popup;
|
|
19766
|
+
return popup;
|
|
19610
19767
|
}
|
|
19611
19768
|
getPolygonGeoJSONFromFeatureGroup(featureGroup) {
|
|
19612
19769
|
console.log("PolygonInteractionManager getPolygonGeoJSONFromFeatureGroup");
|
|
@@ -19693,8 +19850,6 @@ class PolygonInteractionManager {
|
|
|
19693
19850
|
outerWrapper.classList.add("info-marker-outer-wrapper");
|
|
19694
19851
|
const wrapper = document.createElement("div");
|
|
19695
19852
|
wrapper.classList.add("info-marker-wrapper");
|
|
19696
|
-
const invertedCorner = document.createElement("i");
|
|
19697
|
-
invertedCorner.classList.add("inverted-corner");
|
|
19698
19853
|
const markerContent = document.createElement("div");
|
|
19699
19854
|
markerContent.classList.add("content");
|
|
19700
19855
|
const infoContentWrapper = document.createElement("div");
|
|
@@ -19709,7 +19864,6 @@ class PolygonInteractionManager {
|
|
|
19709
19864
|
infoContentWrapper.appendChild(perimeterDiv);
|
|
19710
19865
|
markerContent.appendChild(infoContentWrapper);
|
|
19711
19866
|
outerWrapper.appendChild(wrapper);
|
|
19712
|
-
wrapper.appendChild(invertedCorner);
|
|
19713
19867
|
wrapper.appendChild(markerContent);
|
|
19714
19868
|
L.DomEvent.disableClickPropagation(outerWrapper);
|
|
19715
19869
|
outerWrapper.style.pointerEvents = "auto";
|
|
@@ -19717,7 +19871,12 @@ class PolygonInteractionManager {
|
|
|
19717
19871
|
btn.style.pointerEvents = "auto";
|
|
19718
19872
|
btn.addEventListener("click", (e) => e.stopPropagation());
|
|
19719
19873
|
});
|
|
19720
|
-
|
|
19874
|
+
const popup = L.popup({
|
|
19875
|
+
closeButton: true,
|
|
19876
|
+
autoClose: true,
|
|
19877
|
+
className: "info-popup"
|
|
19878
|
+
}).setContent(outerWrapper);
|
|
19879
|
+
return popup;
|
|
19721
19880
|
}
|
|
19722
19881
|
}
|
|
19723
19882
|
class PolygonMutationManager {
|
|
@@ -19727,8 +19886,8 @@ class PolygonMutationManager {
|
|
|
19727
19886
|
__publicField(this, "map");
|
|
19728
19887
|
__publicField(this, "config");
|
|
19729
19888
|
__publicField(this, "modeManager");
|
|
19889
|
+
__publicField(this, "eventManager");
|
|
19730
19890
|
__publicField(this, "getFeatureGroups");
|
|
19731
|
-
__publicField(this, "eventListeners", /* @__PURE__ */ new Map());
|
|
19732
19891
|
// Specialized managers
|
|
19733
19892
|
__publicField(this, "geometryManager");
|
|
19734
19893
|
__publicField(this, "drawManager");
|
|
@@ -19738,6 +19897,7 @@ class PolygonMutationManager {
|
|
|
19738
19897
|
this.map = dependencies.map;
|
|
19739
19898
|
this.config = dependencies.config;
|
|
19740
19899
|
this.modeManager = dependencies.modeManager;
|
|
19900
|
+
this.eventManager = dependencies.eventManager;
|
|
19741
19901
|
this.getFeatureGroups = dependencies.getFeatureGroups;
|
|
19742
19902
|
this.initializeSpecializedManagers(dependencies);
|
|
19743
19903
|
}
|
|
@@ -19755,6 +19915,7 @@ class PolygonMutationManager {
|
|
|
19755
19915
|
map: dependencies.map,
|
|
19756
19916
|
config: dependencies.config,
|
|
19757
19917
|
modeManager: dependencies.modeManager,
|
|
19918
|
+
eventManager: this.eventManager,
|
|
19758
19919
|
tracer: placeholderTracer
|
|
19759
19920
|
});
|
|
19760
19921
|
this.interactionManager = new PolygonInteractionManager(
|
|
@@ -19763,7 +19924,8 @@ class PolygonMutationManager {
|
|
|
19763
19924
|
polygonInformation: dependencies.polygonInformation,
|
|
19764
19925
|
map: dependencies.map,
|
|
19765
19926
|
config: dependencies.config,
|
|
19766
|
-
modeManager: dependencies.modeManager
|
|
19927
|
+
modeManager: dependencies.modeManager,
|
|
19928
|
+
eventManager: this.eventManager
|
|
19767
19929
|
},
|
|
19768
19930
|
{
|
|
19769
19931
|
getFeatureGroups: this.getFeatureGroups,
|
|
@@ -19777,38 +19939,29 @@ class PolygonMutationManager {
|
|
|
19777
19939
|
* Set up event forwarding from specialized managers to facade
|
|
19778
19940
|
*/
|
|
19779
19941
|
setupEventForwarding() {
|
|
19780
|
-
this.
|
|
19781
|
-
this.handleDrawCompleted(data);
|
|
19782
|
-
});
|
|
19783
|
-
this.drawManager.on("drawCancelled", (data) => {
|
|
19942
|
+
this.eventManager.on("polydraw:draw:cancel", (data) => {
|
|
19784
19943
|
this.emit("drawCancelled", data);
|
|
19785
19944
|
});
|
|
19786
|
-
this.
|
|
19945
|
+
this.eventManager.on("polydraw:polygon:updated", (data) => {
|
|
19787
19946
|
this.handlePolygonModified(data);
|
|
19788
19947
|
});
|
|
19789
|
-
this.
|
|
19948
|
+
this.eventManager.on("polydraw:menu:action", (data) => {
|
|
19790
19949
|
this.handleMenuAction(data);
|
|
19791
19950
|
});
|
|
19792
|
-
this.
|
|
19951
|
+
this.eventManager.on("polydraw:check:intersection", (data) => {
|
|
19793
19952
|
const hasIntersection = this.geometryManager.checkPolygonIntersection(
|
|
19794
19953
|
data.polygon1,
|
|
19795
19954
|
data.polygon2
|
|
19796
19955
|
);
|
|
19797
19956
|
data.callback(hasIntersection);
|
|
19798
19957
|
});
|
|
19799
|
-
this.
|
|
19958
|
+
this.eventManager.on("polydraw:subtract", (data) => {
|
|
19800
19959
|
this.subtractPolygon(data.subtractPolygon);
|
|
19801
19960
|
});
|
|
19802
|
-
this.
|
|
19961
|
+
this.eventManager.on("polydraw:polygon:deleted", () => {
|
|
19803
19962
|
this.emit("polygonDeleted");
|
|
19804
19963
|
});
|
|
19805
19964
|
}
|
|
19806
|
-
/**
|
|
19807
|
-
* Handle draw completion from draw manager
|
|
19808
|
-
*/
|
|
19809
|
-
async handleDrawCompleted(data) {
|
|
19810
|
-
await this.addPolygon(data.polygon, { simplify: true });
|
|
19811
|
-
}
|
|
19812
19965
|
/**
|
|
19813
19966
|
* Handle polygon modification from interaction manager
|
|
19814
19967
|
*/
|
|
@@ -19863,19 +20016,13 @@ class PolygonMutationManager {
|
|
|
19863
20016
|
* Add event listener
|
|
19864
20017
|
*/
|
|
19865
20018
|
on(event, callback) {
|
|
19866
|
-
|
|
19867
|
-
this.eventListeners.set(event, []);
|
|
19868
|
-
}
|
|
19869
|
-
this.eventListeners.get(event).push(callback);
|
|
20019
|
+
this.eventManager.on(event, callback);
|
|
19870
20020
|
}
|
|
19871
20021
|
/**
|
|
19872
20022
|
* Emit event to all listeners
|
|
19873
20023
|
*/
|
|
19874
20024
|
emit(event, data) {
|
|
19875
|
-
|
|
19876
|
-
if (listeners) {
|
|
19877
|
-
listeners.forEach((callback) => callback(data));
|
|
19878
|
-
}
|
|
20025
|
+
this.eventManager.emit(event, data);
|
|
19879
20026
|
}
|
|
19880
20027
|
/**
|
|
19881
20028
|
* Add a polygon with optional merging logic
|
|
@@ -20455,6 +20602,7 @@ class Polydraw extends L.Control {
|
|
|
20455
20602
|
__publicField(this, "subContainer");
|
|
20456
20603
|
__publicField(this, "config");
|
|
20457
20604
|
__publicField(this, "mapStateService");
|
|
20605
|
+
__publicField(this, "eventManager");
|
|
20458
20606
|
__publicField(this, "polygonInformation");
|
|
20459
20607
|
__publicField(this, "modeManager");
|
|
20460
20608
|
__publicField(this, "polygonDrawManager");
|
|
@@ -20528,8 +20676,9 @@ class Polydraw extends L.Control {
|
|
|
20528
20676
|
initializeComponents() {
|
|
20529
20677
|
this.turfHelper = new TurfHelper(this.config);
|
|
20530
20678
|
this.mapStateService = new MapStateService();
|
|
20679
|
+
this.eventManager = new EventManager();
|
|
20531
20680
|
this.polygonInformation = new PolygonInformationService(this.mapStateService);
|
|
20532
|
-
this.modeManager = new ModeManager(this.config);
|
|
20681
|
+
this.modeManager = new ModeManager(this.config, this.eventManager);
|
|
20533
20682
|
this.polygonInformation.onPolygonInfoUpdated((_k) => {
|
|
20534
20683
|
this.updateActivateButtonIndicator();
|
|
20535
20684
|
});
|
|
@@ -20613,7 +20762,7 @@ class Polydraw extends L.Control {
|
|
|
20613
20762
|
this.polygonInformation.saveCurrentState();
|
|
20614
20763
|
};
|
|
20615
20764
|
const onEraseClick = (e) => {
|
|
20616
|
-
|
|
20765
|
+
this.map.closePopup();
|
|
20617
20766
|
if (e) {
|
|
20618
20767
|
e.preventDefault();
|
|
20619
20768
|
e.stopPropagation();
|
|
@@ -20663,6 +20812,7 @@ class Polydraw extends L.Control {
|
|
|
20663
20812
|
map: this.map,
|
|
20664
20813
|
config: this.config,
|
|
20665
20814
|
modeManager: this.modeManager,
|
|
20815
|
+
eventManager: this.eventManager,
|
|
20666
20816
|
tracer: this.tracer
|
|
20667
20817
|
});
|
|
20668
20818
|
this.polygonMutationManager = new PolygonMutationManager({
|
|
@@ -20671,6 +20821,7 @@ class Polydraw extends L.Control {
|
|
|
20671
20821
|
map: this.map,
|
|
20672
20822
|
config: this.config,
|
|
20673
20823
|
modeManager: this.modeManager,
|
|
20824
|
+
eventManager: this.eventManager,
|
|
20674
20825
|
getFeatureGroups: () => this.arrayOfFeatureGroups
|
|
20675
20826
|
});
|
|
20676
20827
|
this.polygonMutationManager.on("polygonOperationComplete", (data) => {
|
|
@@ -20699,7 +20850,7 @@ class Polydraw extends L.Control {
|
|
|
20699
20850
|
this.polygonMutationManager.on("polygonDeleted", () => {
|
|
20700
20851
|
this.updateActivateButtonIndicator();
|
|
20701
20852
|
});
|
|
20702
|
-
this.
|
|
20853
|
+
this.eventManager.on("polydraw:polygon:created", async (data) => {
|
|
20703
20854
|
this.stopDraw();
|
|
20704
20855
|
if (data.isPointToPoint) {
|
|
20705
20856
|
await this.polygonMutationManager.addPolygon(data.polygon, {
|
|
@@ -20711,7 +20862,7 @@ class Polydraw extends L.Control {
|
|
|
20711
20862
|
}
|
|
20712
20863
|
this.polygonInformation.createPolygonInformationStorage(this.arrayOfFeatureGroups);
|
|
20713
20864
|
});
|
|
20714
|
-
this.
|
|
20865
|
+
this.eventManager.on("polydraw:draw:cancel", () => {
|
|
20715
20866
|
this.stopDraw();
|
|
20716
20867
|
this.setDrawMode(DrawMode.Off);
|
|
20717
20868
|
});
|
|
@@ -20831,19 +20982,17 @@ class Polydraw extends L.Control {
|
|
|
20831
20982
|
console.log("getDrawMode");
|
|
20832
20983
|
return this.modeManager.getCurrentMode();
|
|
20833
20984
|
}
|
|
20834
|
-
|
|
20835
|
-
|
|
20836
|
-
this.drawModeListeners.push(callback);
|
|
20985
|
+
on(event, callback) {
|
|
20986
|
+
this.eventManager.on(event, callback);
|
|
20837
20987
|
}
|
|
20838
|
-
|
|
20839
|
-
|
|
20840
|
-
const index = this.drawModeListeners.indexOf(callback);
|
|
20841
|
-
if (index > -1) {
|
|
20842
|
-
this.drawModeListeners.splice(index, 1);
|
|
20843
|
-
}
|
|
20988
|
+
off(event, callback) {
|
|
20989
|
+
this.eventManager.off(event, callback);
|
|
20844
20990
|
}
|
|
20845
20991
|
emitDrawModeChanged() {
|
|
20846
20992
|
console.log("emitDrawModeChanged");
|
|
20993
|
+
this.eventManager.emit("polydraw:mode:change", {
|
|
20994
|
+
mode: this.modeManager.getCurrentMode()
|
|
20995
|
+
});
|
|
20847
20996
|
for (const cb of this.drawModeListeners) {
|
|
20848
20997
|
cb(this.modeManager.getCurrentMode());
|
|
20849
20998
|
}
|
|
@@ -21133,9 +21282,6 @@ class Polydraw extends L.Control {
|
|
|
21133
21282
|
*/
|
|
21134
21283
|
isModifierKeyPressed(event) {
|
|
21135
21284
|
console.log("isModifierKeyPressed");
|
|
21136
|
-
if (isTouchDevice()) {
|
|
21137
|
-
return false;
|
|
21138
|
-
}
|
|
21139
21285
|
const userAgent = navigator.userAgent.toLowerCase();
|
|
21140
21286
|
const isMac = userAgent.includes("mac");
|
|
21141
21287
|
if (isMac) {
|