maplibre-gl-geo-editor 0.11.0 → 0.11.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.
package/README.md CHANGED
@@ -438,6 +438,7 @@ function App() {
438
438
  | `attributePanelSideOffset` | `number` | `10` | Offset from left/right side of map container in pixels |
439
439
  | `attributePanelTitle` | `string` | `'Feature Properties'` | Title of the attribute panel |
440
440
  | `onAttributeChange` | `(event) => void` | - | Callback when feature attributes change |
441
+ | `createPopup` | `(options) => GeoEditorPopup` | MapLibre `Popup` | Builds the rotate and feature-properties popups; pass another engine's popup class (for example mapbox-gl's) when the editor runs on a non-MapLibre map |
441
442
  | `enableHistory` | `boolean` | `true` | Enable undo/redo functionality |
442
443
  | `maxHistorySize` | `number` | `50` | Maximum number of history entries |
443
444
  | `onHistoryChange` | `(canUndo, canRedo) => void` | - | Callback when history state changes |
@@ -16813,7 +16813,8 @@ const DEFAULT_OPTIONS = {
16813
16813
  attributePanelMaxHeight: "80vh",
16814
16814
  attributePanelTop: 10,
16815
16815
  attributePanelSideOffset: 10,
16816
- attributePanelTitle: "Feature Properties"
16816
+ attributePanelTitle: "Feature Properties",
16817
+ createPopup: (options) => new maplibreGl.Popup(options)
16817
16818
  };
16818
16819
  const CSS_PREFIX = "geo-editor";
16819
16820
  const INTERNAL_IDS = {
@@ -18743,9 +18744,9 @@ class GeoEditor {
18743
18744
  toolbar = null;
18744
18745
  // Hidden file input for file dialog
18745
18746
  fileInput = null;
18746
- // Feature properties popup
18747
+ // Feature properties popup (built by `options.createPopup`)
18747
18748
  propertiesPopup = null;
18748
- // Numerical-rotation popup
18749
+ // Numerical-rotation popup (built by `options.createPopup`)
18749
18750
  rotatePopup = null;
18750
18751
  // History management (undo/redo)
18751
18752
  historyManager = null;
@@ -19308,7 +19309,7 @@ class GeoEditor {
19308
19309
  this.closeRotatePopup();
19309
19310
  }
19310
19311
  });
19311
- this.rotatePopup = new maplibreGl.Popup({
19312
+ this.rotatePopup = this.options.createPopup({
19312
19313
  maxWidth: "240px",
19313
19314
  closeButton: false,
19314
19315
  closeOnClick: false,
@@ -20174,7 +20175,7 @@ class GeoEditor {
20174
20175
  const centroid$1 = centroid(feature2);
20175
20176
  const coordinates = centroid$1.geometry.coordinates;
20176
20177
  const html = this.formatPropertiesHtml(feature2.properties);
20177
- this.propertiesPopup = new maplibreGl.Popup({
20178
+ this.propertiesPopup = this.options.createPopup({
20178
20179
  maxWidth: "300px",
20179
20180
  closeButton: true,
20180
20181
  closeOnClick: false,
@@ -21787,7 +21788,9 @@ class GeoEditor {
21787
21788
  // ============================================================================
21788
21789
  setupKeyboardShortcuts() {
21789
21790
  this.boundKeyHandler = (e) => {
21790
- const isInputField = e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLElement && e.target.isContentEditable;
21791
+ const target = e.composedPath()[0] ?? e.target;
21792
+ const isInputField = target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
21793
+ if (isInputField) return;
21791
21794
  if ((e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey) {
21792
21795
  this.undo();
21793
21796
  e.preventDefault();
@@ -21806,7 +21809,7 @@ class GeoEditor {
21806
21809
  this.pasteFeatures();
21807
21810
  e.preventDefault();
21808
21811
  }
21809
- if ((e.key === "Delete" || e.key === "Backspace") && !isInputField && !(e.target instanceof Element && e.target.closest(`.${CSS_PREFIX}-attribute-panel`))) {
21812
+ if ((e.key === "Delete" || e.key === "Backspace") && !(e.target instanceof Element && e.target.closest(`.${CSS_PREFIX}-attribute-panel`))) {
21810
21813
  this.deleteSelectedFeatures();
21811
21814
  e.preventDefault();
21812
21815
  }
@@ -22571,4 +22574,4 @@ exports.safeUnion = safeUnion;
22571
22574
  exports.selectFeaturesWithinLasso = selectFeaturesWithinLasso;
22572
22575
  exports.toSelectedFeatures = toSelectedFeatures;
22573
22576
  exports.toggleInSelection = toggleInSelection;
22574
- //# sourceMappingURL=geo-editor-DQK502Ic.cjs.map
22577
+ //# sourceMappingURL=geo-editor-DHuNEfQH.cjs.map