maplibre-gl-geo-editor 0.10.0 → 0.10.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.
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
22
  mod
23
23
  ));
24
- const maplibregl = require("maplibre-gl");
24
+ const maplibreGl = require("maplibre-gl");
25
25
  var earthRadius = 63710088e-1;
26
26
  var factors = {
27
27
  centimeters: earthRadius * 100,
@@ -18490,6 +18490,10 @@ class GeoEditor {
18490
18490
  pendingOperation = null;
18491
18491
  // Snapping state (independent of other modes)
18492
18492
  snappingEnabled = false;
18493
+ // Monotonic token identifying the most recent enableDrawMode() request. Each
18494
+ // call bumps it so a tool armed after an async teardown can bail if a newer
18495
+ // selection has since superseded it (see enableDrawMode).
18496
+ drawRequestId = 0;
18493
18497
  // Last known feature operations
18494
18498
  lastCreatedFeature = null;
18495
18499
  lastEditedFeature = null;
@@ -19073,7 +19077,7 @@ class GeoEditor {
19073
19077
  this.closeRotatePopup();
19074
19078
  }
19075
19079
  });
19076
- this.rotatePopup = new maplibregl.Popup({
19080
+ this.rotatePopup = new maplibreGl.Popup({
19077
19081
  maxWidth: "240px",
19078
19082
  closeButton: false,
19079
19083
  closeOnClick: false,
@@ -19415,13 +19419,18 @@ class GeoEditor {
19415
19419
  * Enable a draw mode
19416
19420
  */
19417
19421
  enableDrawMode(mode) {
19418
- this.disableAllModes();
19419
- if (mode === "freehand") {
19420
- this.enableFreehandMode();
19421
- } else if (this.geoman) {
19422
- this.geoman.enableDraw(mode);
19423
- setTimeout(() => this.applyVertexMarkerStyles(), 50);
19424
- }
19422
+ const requestId = ++this.drawRequestId;
19423
+ const teardown = this.disableAllModes();
19424
+ const activate = () => {
19425
+ if (this.drawRequestId !== requestId) return;
19426
+ if (mode === "freehand") {
19427
+ this.enableFreehandMode();
19428
+ } else if (this.geoman) {
19429
+ this.geoman.enableDraw(mode);
19430
+ setTimeout(() => this.applyVertexMarkerStyles(), 50);
19431
+ }
19432
+ };
19433
+ teardown.then(activate).catch(activate);
19425
19434
  this.state.activeDrawMode = mode;
19426
19435
  this.state.isDrawing = true;
19427
19436
  this.options.onModeChange?.(mode);
@@ -19561,10 +19570,12 @@ class GeoEditor {
19561
19570
  this.state.isEditing = false;
19562
19571
  this.updateToolbarState();
19563
19572
  if (geomanDisable && typeof geomanDisable.then === "function") {
19564
- geomanDisable.then(() => this.applySnappingState()).catch(() => this.applySnappingState());
19565
- } else {
19566
- this.applySnappingState();
19573
+ const settled = geomanDisable;
19574
+ settled.then(() => this.applySnappingState()).catch(() => this.applySnappingState());
19575
+ return settled;
19567
19576
  }
19577
+ this.applySnappingState();
19578
+ return Promise.resolve();
19568
19579
  }
19569
19580
  // ============================================================================
19570
19581
  // Finish polygon/line draw on double-click or right-click
@@ -19932,7 +19943,7 @@ class GeoEditor {
19932
19943
  const centroid$1 = centroid(feature2);
19933
19944
  const coordinates = centroid$1.geometry.coordinates;
19934
19945
  const html = this.formatPropertiesHtml(feature2.properties);
19935
- this.propertiesPopup = new maplibregl.Popup({
19946
+ this.propertiesPopup = new maplibreGl.Popup({
19936
19947
  maxWidth: "300px",
19937
19948
  closeButton: true,
19938
19949
  closeOnClick: false,
@@ -22105,4 +22116,4 @@ exports.safeUnion = safeUnion;
22105
22116
  exports.selectFeaturesWithinLasso = selectFeaturesWithinLasso;
22106
22117
  exports.toSelectedFeatures = toSelectedFeatures;
22107
22118
  exports.toggleInSelection = toggleInSelection;
22108
- //# sourceMappingURL=geo-editor-BmXZmyoe.cjs.map
22119
+ //# sourceMappingURL=geo-editor-BP0sEowl.cjs.map