@octostar/map-component 0.1.29 → 0.1.31

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.cjs CHANGED
@@ -12,6 +12,7 @@ const fileSaver = require("file-saver");
12
12
  const lucideReact = require("lucide-react");
13
13
  const clsx = require("clsx");
14
14
  const tailwindMerge = require("tailwind-merge");
15
+ const reactDom = require("react-dom");
15
16
  const dateFns = require("date-fns");
16
17
  const zustand = require("zustand");
17
18
  const dayjs = require("dayjs");
@@ -2972,7 +2973,7 @@ function RecordFieldsSection({ feature }) {
2972
2973
  );
2973
2974
  }
2974
2975
  let persistedTabPreference = "properties";
2975
- function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometry, onClose, isEditMode = true, isReadOnlyLayer = false, layerName, layerId, autoFocusLabel = false, entityCardProvider, typePickerProvider, featureSaveProvider, featureRefreshProvider, onFeatureSaved, onDeleteFeatures, onOpenInNewTab, onEntityContextMenu, layers, onMoveFeaturesToLayer, onCopyFeaturesToLayer, onCreateLayerAndMoveFeatures, onCreateLayerAndCopyFeatures, getFeatureColor }) {
2976
+ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometry, onClose, isEditMode = true, isReadOnlyLayer = false, layerName, layerId, autoFocusLabel = false, entityCardProvider, typePickerProvider, featureSaveProvider, featureRefreshProvider, onFeatureSaved, onDeleteFeatures, onOpenInNewTab, onEntityContextMenu, layers, onMoveFeaturesToLayer, onCopyFeaturesToLayer, onCreateLayerAndMoveFeatures, onCreateLayerAndCopyFeatures, getFeatureColor, anchorEl }) {
2976
2977
  var _a, _b, _c, _d, _e;
2977
2978
  const feature = selectedFeatures[0];
2978
2979
  const { toast } = useToast();
@@ -3008,6 +3009,28 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3008
3009
  }
3009
3010
  prevMultiSelection.current = hasMultipleSelection;
3010
3011
  }, [hasMultipleSelection, entityCardProvider]);
3012
+ const [anchorRect, setAnchorRect] = react.useState(
3013
+ () => anchorEl ? anchorEl.getBoundingClientRect() : null
3014
+ );
3015
+ react.useEffect(() => {
3016
+ if (!anchorEl) {
3017
+ setAnchorRect(null);
3018
+ return;
3019
+ }
3020
+ const update = () => {
3021
+ setAnchorRect(anchorEl.getBoundingClientRect());
3022
+ };
3023
+ update();
3024
+ window.addEventListener("resize", update, { passive: true });
3025
+ window.addEventListener("scroll", update, { capture: true, passive: true });
3026
+ const observer = typeof ResizeObserver !== "undefined" ? new ResizeObserver(update) : null;
3027
+ observer == null ? void 0 : observer.observe(anchorEl);
3028
+ return () => {
3029
+ window.removeEventListener("resize", update);
3030
+ window.removeEventListener("scroll", update, { capture: true });
3031
+ observer == null ? void 0 : observer.disconnect();
3032
+ };
3033
+ }, [anchorEl]);
3011
3034
  const featureIds = selectedFeatures.map((f) => f.id);
3012
3035
  const targetLayers = (layers == null ? void 0 : layers.filter((l) => l.id !== layerId && !l.readOnly)) ?? [];
3013
3036
  const hasLayerActions = targetLayers.length > 0 || onCreateLayerAndMoveFeatures || onCreateLayerAndCopyFeatures;
@@ -4094,12 +4117,43 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
4094
4117
  ] })
4095
4118
  ] });
4096
4119
  const panelContent = isRecord ? recordContent : propertiesContent;
4120
+ const COMMON_PANEL_CLASSES = "bg-background/95 floating-panel rounded-lg shadow-lg border border-border flex flex-col overflow-hidden";
4121
+ const EDGE_MARGIN = 16;
4122
+ const BOTTOM_MARGIN = 32;
4123
+ const computePanelPosition = (panelWidthPx, widthClass) => {
4124
+ if (!anchorEl) {
4125
+ return {
4126
+ className: `absolute top-4 right-4 z-10 ${widthClass} ${COMMON_PANEL_CLASSES}`,
4127
+ style: { maxHeight: "calc(100vh - 6rem)" }
4128
+ };
4129
+ }
4130
+ const anchorHidden = !anchorRect || anchorRect.width === 0 || anchorRect.height === 0 || anchorRect.bottom <= 0 || anchorRect.top >= window.innerHeight || anchorRect.right <= 0 || anchorRect.left >= window.innerWidth;
4131
+ if (anchorHidden) {
4132
+ return {
4133
+ className: `fixed ${widthClass} ${COMMON_PANEL_CLASSES} opacity-0 pointer-events-none`,
4134
+ // `display:none` (not just opacity:0) so the panel truly cannot
4135
+ // intercept clicks while hidden, even with `pointer-events: none`
4136
+ // disabled by a stray CSS rule somewhere upstream.
4137
+ style: { top: 0, left: 0, maxHeight: "calc(100vh - 6rem)", zIndex: 1e3, display: "none" }
4138
+ };
4139
+ }
4140
+ const top = Math.max(EDGE_MARGIN, anchorRect.top + EDGE_MARGIN);
4141
+ const desiredRight = window.innerWidth - anchorRect.right + EDGE_MARGIN;
4142
+ const right = Math.max(EDGE_MARGIN, Math.min(desiredRight, window.innerWidth - panelWidthPx - EDGE_MARGIN));
4143
+ const maxHeight = Math.max(160, window.innerHeight - top - BOTTOM_MARGIN);
4144
+ return {
4145
+ className: `fixed ${widthClass} ${COMMON_PANEL_CLASSES}`,
4146
+ style: { top, right, maxHeight, zIndex: 1e3 }
4147
+ };
4148
+ };
4149
+ const portalIfAnchored = (jsx2) => anchorEl ? reactDom.createPortal(jsx2, document.body) : jsx2;
4097
4150
  if (entityCardProvider) {
4098
- return /* @__PURE__ */ jsxRuntime.jsxs(
4151
+ const cardsPositioned = computePanelPosition(320, "w-80");
4152
+ const cardsPanel = /* @__PURE__ */ jsxRuntime.jsxs(
4099
4153
  "div",
4100
4154
  {
4101
- className: "absolute top-4 right-4 z-10 w-80 bg-background/95 floating-panel rounded-lg shadow-lg border border-border flex flex-col overflow-hidden",
4102
- style: { maxHeight: "calc(100vh - 6rem)" },
4155
+ className: cardsPositioned.className,
4156
+ style: cardsPositioned.style,
4103
4157
  "data-testid": "panel-properties",
4104
4158
  children: [
4105
4159
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2 px-3 py-2.5 border-b border-border shrink-0 bg-background/95", children: [
@@ -4227,12 +4281,14 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
4227
4281
  ]
4228
4282
  }
4229
4283
  );
4284
+ return portalIfAnchored(cardsPanel);
4230
4285
  }
4231
- return /* @__PURE__ */ jsxRuntime.jsxs(
4286
+ const positioned = computePanelPosition(288, "w-72");
4287
+ const panelJsx = /* @__PURE__ */ jsxRuntime.jsxs(
4232
4288
  "div",
4233
4289
  {
4234
- className: "absolute top-4 right-4 z-10 w-72 bg-background/95 floating-panel rounded-lg shadow-lg border border-border flex flex-col overflow-hidden",
4235
- style: { maxHeight: "calc(100vh - 6rem)" },
4290
+ className: positioned.className,
4291
+ style: positioned.style,
4236
4292
  "data-testid": "panel-properties",
4237
4293
  children: [
4238
4294
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2 px-3 py-2.5 border-b border-border shrink-0 bg-background/95", children: [
@@ -4324,6 +4380,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
4324
4380
  ]
4325
4381
  }
4326
4382
  );
4383
+ return portalIfAnchored(panelJsx);
4327
4384
  }
4328
4385
  function StatusIndicator({ featureCount, selectedCount = 0 }) {
4329
4386
  const hasSelection = selectedCount > 0;
@@ -5798,6 +5855,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
5798
5855
  const handleMapStyleChangeRef = react.useRef(null);
5799
5856
  const flightPath3DLayerId = react.useRef(null);
5800
5857
  const update3DFlightPathsRef = react.useRef(null);
5858
+ const moveLabelsBeforeBasemapSymbolsRef = react.useRef(null);
5801
5859
  const tooltipProviderRef = react.useRef(tooltipProvider);
5802
5860
  tooltipProviderRef.current = tooltipProvider;
5803
5861
  const restoreEnrichedGeoJSONRef = react.useRef(null);
@@ -5892,6 +5950,11 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
5892
5950
  window.removeEventListener("error", handleGlobalError, true);
5893
5951
  window.removeEventListener("unhandledrejection", handleUnhandledRejection, true);
5894
5952
  if (tooltipElRef.current) {
5953
+ const cleanup = tooltipElRef.current._cleanup;
5954
+ try {
5955
+ cleanup == null ? void 0 : cleanup();
5956
+ } catch {
5957
+ }
5895
5958
  try {
5896
5959
  (_a = tooltipElRef.current.parentElement) == null ? void 0 : _a.removeChild(tooltipElRef.current);
5897
5960
  } catch {
@@ -6212,7 +6275,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
6212
6275
  const sourceData = {
6213
6276
  type: "FeatureCollection",
6214
6277
  features: allFeatures.map((f) => {
6215
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
6278
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
6216
6279
  const featureId = String(f.id);
6217
6280
  const layer = featureToLayer.get(featureId);
6218
6281
  const visualConfig = layer == null ? void 0 : layer.visualConfig;
@@ -6305,6 +6368,22 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
6305
6368
  });
6306
6369
  }
6307
6370
  const isFeatureSelected = selectedIds.includes(featureId) ? 1 : 0;
6371
+ let labelPriority = 100;
6372
+ if (isFeatureSelected) {
6373
+ labelPriority = 0;
6374
+ } else if (traceLabel) {
6375
+ labelPriority = 5;
6376
+ } else if (((_l = f.properties) == null ? void 0 : _l.kind) === "text") {
6377
+ labelPriority = ((_m = f.properties) == null ? void 0 : _m.fontWeight) === "bold" ? 8 : 10;
6378
+ } else {
6379
+ const idStr = String(featureId);
6380
+ let h = 0;
6381
+ for (let i = 0; i < idStr.length; i++) {
6382
+ h = (h << 5) - h + idStr.charCodeAt(i);
6383
+ h |= 0;
6384
+ }
6385
+ labelPriority = 100 + Math.abs(h) % 1e3;
6386
+ }
6308
6387
  return {
6309
6388
  type: "Feature",
6310
6389
  id: featureId,
@@ -6327,10 +6406,11 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
6327
6406
  "stroke-width": strokeWidth,
6328
6407
  "stroke-opacity": hideFlatFor3DOnly ? 0 : isTimelineVisible ? baseOpacity : 0,
6329
6408
  fill: strokeColor,
6330
- "fill-opacity": hideFlatFor3DOnly ? 0 : isTimelineVisible ? ((_l = f.properties) == null ? void 0 : _l["fill-opacity"]) ?? 0.2 : 0,
6409
+ "fill-opacity": hideFlatFor3DOnly ? 0 : isTimelineVisible ? ((_n = f.properties) == null ? void 0 : _n["fill-opacity"]) ?? 0.2 : 0,
6331
6410
  pointRadius,
6332
6411
  isHiddenFor3DOnly: hideFlatFor3DOnly ? 1 : 0,
6333
- isTimelineHidden: isTimelineVisible ? 0 : 1
6412
+ isTimelineHidden: isTimelineVisible ? 0 : 1,
6413
+ _labelPriority: labelPriority
6334
6414
  }
6335
6415
  };
6336
6416
  })
@@ -6998,28 +7078,36 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
6998
7078
  // Text features: center anchor; others: top anchor
6999
7079
  "text-anchor": ["case", ["==", ["get", "kind"], "text"], "center", "top"],
7000
7080
  "text-offset": ["case", ["==", ["get", "kind"], "text"], ["literal", [0, 0]], ["literal", [0, 0.8]]],
7001
- // Collision behaviour for entity labels.
7081
+ // Native collision-based de-overlap.
7002
7082
  //
7003
- // `kind === 'text'` features are sticky-note style annotations
7004
- // where the text IS the content (this layer has no icon-image,
7005
- // and `text-optional` cannot fall back to anything). If we let
7006
- // collision detection hide them, the user is left with a tiny
7007
- // 5px circle and no visible note. Same for trace endpoint
7008
- // labels — the label IS the meaningful marker.
7083
+ // History: a prior PR turned collision off (`text-allow-overlap: true`)
7084
+ // because basemap symbol layers (city / POI / street names from Carto
7085
+ // Voyager etc.) were processed FIRST by MapLibre's collision pipeline
7086
+ // (lower z-order = placed earlier), so our entity labels lost against
7087
+ // every basemap label -- even on near-empty maps. With `false`, freshly
7088
+ // dropped points rendered no label at all.
7009
7089
  //
7010
- // Plain entity-name labels are supplementary to the icon/dot,
7011
- // so it's safe to let MapLibre thin them out in dense areas
7012
- // (this is the "no more black mass of stacked labels" win).
7013
- "text-allow-overlap": [
7014
- "case",
7015
- ["==", ["get", "kind"], "text"],
7016
- true,
7017
- ["==", ["get", "isTraceLabel"], true],
7018
- true,
7019
- false
7020
- ],
7090
+ // The fix has two parts:
7091
+ // 1. (here) Re-enable collision and use `symbol-sort-key` to control
7092
+ // intra-layer priority. Selected/text/trace features win against
7093
+ // ordinary points so they keep their labels when crowded.
7094
+ // 2. (see `moveLabelsBeforeBasemapSymbols` below) After each basemap
7095
+ // load, move `custom-labels` BEFORE basemap symbol layers in the
7096
+ // style stack. MapLibre processes collision in painter order, so
7097
+ // placing our layer earlier makes entity labels claim space
7098
+ // first and basemap labels yield to us.
7099
+ //
7100
+ // Net effect: dense clusters de-overlap automatically, important
7101
+ // features keep their labels, and basemap labels no longer suppress
7102
+ // entity labels. The auto-label threshold (autoLabelConfig.threshold)
7103
+ // remains as a hard cap for very dense viewports.
7104
+ "text-allow-overlap": false,
7021
7105
  "text-ignore-placement": false,
7022
7106
  "text-optional": true,
7107
+ "text-padding": 2,
7108
+ // Lower value = higher collision priority (placed first).
7109
+ // Computed per-feature in syncFeaturesToCustomLayers.
7110
+ "symbol-sort-key": ["coalesce", ["get", "_labelPriority"], 100],
7023
7111
  // Bold font for text features with fontWeight=bold, trace labels, others regular
7024
7112
  "text-font": [
7025
7113
  "case",
@@ -7111,12 +7199,17 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7111
7199
  }
7112
7200
  });
7113
7201
  if (tooltipElRef.current) {
7202
+ const prevCleanup = tooltipElRef.current._cleanup;
7203
+ try {
7204
+ prevCleanup == null ? void 0 : prevCleanup();
7205
+ } catch {
7206
+ }
7114
7207
  (_a = tooltipElRef.current.parentElement) == null ? void 0 : _a.removeChild(tooltipElRef.current);
7115
7208
  }
7116
7209
  const tooltipEl2 = document.createElement("div");
7117
7210
  tooltipEl2.className = "feature-tooltip-fixed";
7118
- tooltipEl2.style.cssText = "position:absolute;z-index:50;pointer-events:auto;display:none;max-width:320px;";
7119
- mapInstance.getContainer().appendChild(tooltipEl2);
7211
+ tooltipEl2.style.cssText = "position:fixed;z-index:1000;pointer-events:auto;display:none;max-width:480px;";
7212
+ document.body.appendChild(tooltipEl2);
7120
7213
  tooltipElRef.current = tooltipEl2;
7121
7214
  let tooltipLngLat = null;
7122
7215
  let tooltipHideTimeout = null;
@@ -7131,17 +7224,20 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7131
7224
  if (!tooltipLngLat || tooltipEl2.style.display === "none") return;
7132
7225
  const point = mapInstance.project(tooltipLngLat);
7133
7226
  const container = mapInstance.getContainer();
7134
- const cw = container.clientWidth;
7135
- const ch = container.clientHeight;
7136
- tooltipEl2.style.maxWidth = Math.min(320, cw - 24) + "px";
7227
+ const rect = container.getBoundingClientRect();
7228
+ const ax = rect.left + point.x;
7229
+ const ay = rect.top + point.y;
7230
+ const vw = window.innerWidth;
7231
+ const vh = window.innerHeight;
7232
+ tooltipEl2.style.maxWidth = Math.min(480, vw - 24) + "px";
7137
7233
  const tw = tooltipEl2.offsetWidth || 200;
7138
7234
  const th = tooltipEl2.offsetHeight || 80;
7139
7235
  const gap = 12;
7140
- let left = point.x < cw / 2 ? point.x + gap : point.x - tw - gap;
7141
- let top = point.y - th - gap;
7142
- if (top < 4) top = point.y + gap;
7143
- if (left + tw > cw - 4) left = cw - tw - 4;
7144
- if (top + th > ch - 4) top = ch - th - 4;
7236
+ let left = ax < vw / 2 ? ax + gap : ax - tw - gap;
7237
+ let top = ay - th - gap;
7238
+ if (top < 4) top = ay + gap;
7239
+ if (left + tw > vw - 4) left = vw - tw - 4;
7240
+ if (top + th > vh - 4) top = vh - th - 4;
7145
7241
  left = Math.max(4, left);
7146
7242
  top = Math.max(4, top);
7147
7243
  tooltipEl2.style.left = left + "px";
@@ -7167,6 +7263,13 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7167
7263
  tooltipLngLatForPagination = null;
7168
7264
  };
7169
7265
  mapInstance.on("move", positionTooltip);
7266
+ const onWindowReposition = () => positionTooltip();
7267
+ window.addEventListener("scroll", onWindowReposition, { capture: true, passive: true });
7268
+ window.addEventListener("resize", onWindowReposition, { passive: true });
7269
+ tooltipEl2._cleanup = () => {
7270
+ window.removeEventListener("scroll", onWindowReposition, { capture: true });
7271
+ window.removeEventListener("resize", onWindowReposition);
7272
+ };
7170
7273
  const scheduleTooltipHide = () => {
7171
7274
  if (tooltipHideTimeout) clearTimeout(tooltipHideTimeout);
7172
7275
  tooltipHideTimeout = setTimeout(() => {
@@ -7495,6 +7598,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7495
7598
  if (styleUrl) {
7496
7599
  const prefix = BASEMAP_LAYER_PREFIXES[baseMapStyle] || `${baseMapStyle}-`;
7497
7600
  fetch(styleUrl).then((res) => res.json()).then((externalStyle) => {
7601
+ var _a2;
7498
7602
  const addedLayerIds = [];
7499
7603
  const resolveUrl = (url) => {
7500
7604
  if (/^https?:\/\//.test(url)) return url;
@@ -7550,6 +7654,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7550
7654
  }
7551
7655
  basemapLayerIds.current.set(baseMapStyle, addedLayerIds);
7552
7656
  loadedBasemaps.current.add(baseMapStyle);
7657
+ (_a2 = moveLabelsBeforeBasemapSymbolsRef.current) == null ? void 0 : _a2.call(moveLabelsBeforeBasemapSymbolsRef);
7553
7658
  const triggerResize = () => {
7554
7659
  try {
7555
7660
  mapInstance.resize();
@@ -9604,6 +9709,38 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9604
9709
  });
9605
9710
  return total;
9606
9711
  }, [layers, getLayerUnsavedCount]);
9712
+ const moveLabelsBeforeBasemapSymbols = react.useCallback(() => {
9713
+ if (!map.current) return;
9714
+ const m = map.current;
9715
+ if (!m.getLayer("custom-labels")) return;
9716
+ const style = m.getStyle();
9717
+ const allLayers = (style == null ? void 0 : style.layers) || [];
9718
+ const basemapPrefixes = Object.values(BASEMAP_LAYER_PREFIXES);
9719
+ const isVisible = (l) => {
9720
+ var _a;
9721
+ const v = (_a = l.layout) == null ? void 0 : _a.visibility;
9722
+ return v === void 0 || v === "visible";
9723
+ };
9724
+ const firstVisibleBasemapSymbol = allLayers.find(
9725
+ (l) => l.type === "symbol" && basemapPrefixes.some((p) => l.id.startsWith(p)) && isVisible(l)
9726
+ );
9727
+ try {
9728
+ if (firstVisibleBasemapSymbol) {
9729
+ m.moveLayer("custom-labels", firstVisibleBasemapSymbol.id);
9730
+ if (m.getLayer("custom-arrow-labels")) {
9731
+ m.moveLayer("custom-arrow-labels", firstVisibleBasemapSymbol.id);
9732
+ }
9733
+ } else {
9734
+ m.moveLayer("custom-labels");
9735
+ if (m.getLayer("custom-arrow-labels")) {
9736
+ m.moveLayer("custom-arrow-labels");
9737
+ }
9738
+ }
9739
+ } catch (e) {
9740
+ console.warn("[map-component] moveLabelsBeforeBasemapSymbols failed:", (e == null ? void 0 : e.message) ?? e);
9741
+ }
9742
+ }, []);
9743
+ moveLabelsBeforeBasemapSymbolsRef.current = moveLabelsBeforeBasemapSymbols;
9607
9744
  const loadBasemapStyle = react.useCallback(async (styleName) => {
9608
9745
  if (!map.current) return [];
9609
9746
  const mapInstance = map.current;
@@ -9667,12 +9804,13 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9667
9804
  }
9668
9805
  }
9669
9806
  }
9807
+ moveLabelsBeforeBasemapSymbols();
9670
9808
  return addedLayerIds;
9671
9809
  } catch (e) {
9672
9810
  console.error(`Failed to load basemap style ${styleName}:`, e);
9673
9811
  return [];
9674
9812
  }
9675
- }, []);
9813
+ }, [moveLabelsBeforeBasemapSymbols]);
9676
9814
  const setBasemapVisibility = react.useCallback((styleName, visible) => {
9677
9815
  if (!map.current) return;
9678
9816
  const mapInstance = map.current;
@@ -9724,7 +9862,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9724
9862
  }
9725
9863
  setBasemapVisibility(style, true);
9726
9864
  setCurrentMapStyle(style);
9727
- }, [loadBasemapStyle, setBasemapVisibility]);
9865
+ moveLabelsBeforeBasemapSymbols();
9866
+ }, [loadBasemapStyle, setBasemapVisibility, moveLabelsBeforeBasemapSymbols]);
9728
9867
  handleMapStyleChangeRef.current = handleMapStyleChange;
9729
9868
  const handleUpdateTraceConfig = react.useCallback((layerId, config) => {
9730
9869
  setLayers((prev) => prev.map(
@@ -12385,7 +12524,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
12385
12524
  }
12386
12525
  ),
12387
12526
  showProperties && selectedFeatures.length > 0 && (() => {
12388
- var _a;
12527
+ var _a, _b;
12389
12528
  const firstFeatureId = (_a = selectedFeatures[0]) == null ? void 0 : _a.id;
12390
12529
  const featureLayer = layers.find((l) => l.featureIds.includes(firstFeatureId));
12391
12530
  const layerName = featureLayer == null ? void 0 : featureLayer.name;
@@ -12421,7 +12560,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
12421
12560
  onCopyFeaturesToLayer: handleCopyFeaturesToLayer,
12422
12561
  onCreateLayerAndMoveFeatures: handleCreateLayerAndMoveFeatures,
12423
12562
  onCreateLayerAndCopyFeatures: handleCreateLayerAndCopyFeatures,
12424
- getFeatureColor: (featureId) => selectedFeatureColors.get(featureId)
12563
+ getFeatureColor: (featureId) => selectedFeatureColors.get(featureId),
12564
+ anchorEl: isMapLoaded ? ((_b = map.current) == null ? void 0 : _b.getContainer()) ?? null : null
12425
12565
  }
12426
12566
  );
12427
12567
  })(),