@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.mjs CHANGED
@@ -10,6 +10,7 @@ import { saveAs } from "file-saver";
10
10
  import { MousePointer2, Square, Hexagon, Circle, MoreVertical, ChevronDown, Filter, X, Move, Ruler, Search, Scan, Pencil, Database, MapPin, Minus, Pentagon, Type, MoveRight, Undo2, Redo2, Trash2, Navigation, Loader2, Map as Map$1, Satellite, FolderOpen, Upload, Download, MoreHorizontal, Focus, Box, Layers, Plus, ChevronRight, Eye, EyeOff, Lock, Smile, Package, Copy, FolderInput, Save, Calendar, Palette, Blend, RefreshCw, ExternalLink, Info, SkipBack, Pause, Play, Clock, AlertTriangle, TestTube, Users, GripVertical, Plane, FileJson, Check, Phone, Car, AlertCircle } from "lucide-react";
11
11
  import { clsx } from "clsx";
12
12
  import { twMerge } from "tailwind-merge";
13
+ import { createPortal } from "react-dom";
13
14
  import { format } from "date-fns";
14
15
  import { create } from "zustand";
15
16
  import dayjs from "dayjs";
@@ -2951,7 +2952,7 @@ function RecordFieldsSection({ feature }) {
2951
2952
  );
2952
2953
  }
2953
2954
  let persistedTabPreference = "properties";
2954
- 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 }) {
2955
+ 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 }) {
2955
2956
  var _a, _b, _c, _d, _e;
2956
2957
  const feature = selectedFeatures[0];
2957
2958
  const { toast } = useToast();
@@ -2987,6 +2988,28 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
2987
2988
  }
2988
2989
  prevMultiSelection.current = hasMultipleSelection;
2989
2990
  }, [hasMultipleSelection, entityCardProvider]);
2991
+ const [anchorRect, setAnchorRect] = useState(
2992
+ () => anchorEl ? anchorEl.getBoundingClientRect() : null
2993
+ );
2994
+ useEffect(() => {
2995
+ if (!anchorEl) {
2996
+ setAnchorRect(null);
2997
+ return;
2998
+ }
2999
+ const update = () => {
3000
+ setAnchorRect(anchorEl.getBoundingClientRect());
3001
+ };
3002
+ update();
3003
+ window.addEventListener("resize", update, { passive: true });
3004
+ window.addEventListener("scroll", update, { capture: true, passive: true });
3005
+ const observer = typeof ResizeObserver !== "undefined" ? new ResizeObserver(update) : null;
3006
+ observer == null ? void 0 : observer.observe(anchorEl);
3007
+ return () => {
3008
+ window.removeEventListener("resize", update);
3009
+ window.removeEventListener("scroll", update, { capture: true });
3010
+ observer == null ? void 0 : observer.disconnect();
3011
+ };
3012
+ }, [anchorEl]);
2990
3013
  const featureIds = selectedFeatures.map((f) => f.id);
2991
3014
  const targetLayers = (layers == null ? void 0 : layers.filter((l) => l.id !== layerId && !l.readOnly)) ?? [];
2992
3015
  const hasLayerActions = targetLayers.length > 0 || onCreateLayerAndMoveFeatures || onCreateLayerAndCopyFeatures;
@@ -4073,12 +4096,43 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
4073
4096
  ] })
4074
4097
  ] });
4075
4098
  const panelContent = isRecord ? recordContent : propertiesContent;
4099
+ const COMMON_PANEL_CLASSES = "bg-background/95 floating-panel rounded-lg shadow-lg border border-border flex flex-col overflow-hidden";
4100
+ const EDGE_MARGIN = 16;
4101
+ const BOTTOM_MARGIN = 32;
4102
+ const computePanelPosition = (panelWidthPx, widthClass) => {
4103
+ if (!anchorEl) {
4104
+ return {
4105
+ className: `absolute top-4 right-4 z-10 ${widthClass} ${COMMON_PANEL_CLASSES}`,
4106
+ style: { maxHeight: "calc(100vh - 6rem)" }
4107
+ };
4108
+ }
4109
+ const anchorHidden = !anchorRect || anchorRect.width === 0 || anchorRect.height === 0 || anchorRect.bottom <= 0 || anchorRect.top >= window.innerHeight || anchorRect.right <= 0 || anchorRect.left >= window.innerWidth;
4110
+ if (anchorHidden) {
4111
+ return {
4112
+ className: `fixed ${widthClass} ${COMMON_PANEL_CLASSES} opacity-0 pointer-events-none`,
4113
+ // `display:none` (not just opacity:0) so the panel truly cannot
4114
+ // intercept clicks while hidden, even with `pointer-events: none`
4115
+ // disabled by a stray CSS rule somewhere upstream.
4116
+ style: { top: 0, left: 0, maxHeight: "calc(100vh - 6rem)", zIndex: 1e3, display: "none" }
4117
+ };
4118
+ }
4119
+ const top = Math.max(EDGE_MARGIN, anchorRect.top + EDGE_MARGIN);
4120
+ const desiredRight = window.innerWidth - anchorRect.right + EDGE_MARGIN;
4121
+ const right = Math.max(EDGE_MARGIN, Math.min(desiredRight, window.innerWidth - panelWidthPx - EDGE_MARGIN));
4122
+ const maxHeight = Math.max(160, window.innerHeight - top - BOTTOM_MARGIN);
4123
+ return {
4124
+ className: `fixed ${widthClass} ${COMMON_PANEL_CLASSES}`,
4125
+ style: { top, right, maxHeight, zIndex: 1e3 }
4126
+ };
4127
+ };
4128
+ const portalIfAnchored = (jsx2) => anchorEl ? createPortal(jsx2, document.body) : jsx2;
4076
4129
  if (entityCardProvider) {
4077
- return /* @__PURE__ */ jsxs(
4130
+ const cardsPositioned = computePanelPosition(320, "w-80");
4131
+ const cardsPanel = /* @__PURE__ */ jsxs(
4078
4132
  "div",
4079
4133
  {
4080
- 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",
4081
- style: { maxHeight: "calc(100vh - 6rem)" },
4134
+ className: cardsPositioned.className,
4135
+ style: cardsPositioned.style,
4082
4136
  "data-testid": "panel-properties",
4083
4137
  children: [
4084
4138
  /* @__PURE__ */ 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: [
@@ -4206,12 +4260,14 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
4206
4260
  ]
4207
4261
  }
4208
4262
  );
4263
+ return portalIfAnchored(cardsPanel);
4209
4264
  }
4210
- return /* @__PURE__ */ jsxs(
4265
+ const positioned = computePanelPosition(288, "w-72");
4266
+ const panelJsx = /* @__PURE__ */ jsxs(
4211
4267
  "div",
4212
4268
  {
4213
- 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",
4214
- style: { maxHeight: "calc(100vh - 6rem)" },
4269
+ className: positioned.className,
4270
+ style: positioned.style,
4215
4271
  "data-testid": "panel-properties",
4216
4272
  children: [
4217
4273
  /* @__PURE__ */ 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: [
@@ -4303,6 +4359,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
4303
4359
  ]
4304
4360
  }
4305
4361
  );
4362
+ return portalIfAnchored(panelJsx);
4306
4363
  }
4307
4364
  function StatusIndicator({ featureCount, selectedCount = 0 }) {
4308
4365
  const hasSelection = selectedCount > 0;
@@ -5777,6 +5834,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
5777
5834
  const handleMapStyleChangeRef = useRef(null);
5778
5835
  const flightPath3DLayerId = useRef(null);
5779
5836
  const update3DFlightPathsRef = useRef(null);
5837
+ const moveLabelsBeforeBasemapSymbolsRef = useRef(null);
5780
5838
  const tooltipProviderRef = useRef(tooltipProvider);
5781
5839
  tooltipProviderRef.current = tooltipProvider;
5782
5840
  const restoreEnrichedGeoJSONRef = useRef(null);
@@ -5871,6 +5929,11 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
5871
5929
  window.removeEventListener("error", handleGlobalError, true);
5872
5930
  window.removeEventListener("unhandledrejection", handleUnhandledRejection, true);
5873
5931
  if (tooltipElRef.current) {
5932
+ const cleanup = tooltipElRef.current._cleanup;
5933
+ try {
5934
+ cleanup == null ? void 0 : cleanup();
5935
+ } catch {
5936
+ }
5874
5937
  try {
5875
5938
  (_a = tooltipElRef.current.parentElement) == null ? void 0 : _a.removeChild(tooltipElRef.current);
5876
5939
  } catch {
@@ -6191,7 +6254,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6191
6254
  const sourceData = {
6192
6255
  type: "FeatureCollection",
6193
6256
  features: allFeatures.map((f) => {
6194
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
6257
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
6195
6258
  const featureId = String(f.id);
6196
6259
  const layer = featureToLayer.get(featureId);
6197
6260
  const visualConfig = layer == null ? void 0 : layer.visualConfig;
@@ -6284,6 +6347,22 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6284
6347
  });
6285
6348
  }
6286
6349
  const isFeatureSelected = selectedIds.includes(featureId) ? 1 : 0;
6350
+ let labelPriority = 100;
6351
+ if (isFeatureSelected) {
6352
+ labelPriority = 0;
6353
+ } else if (traceLabel) {
6354
+ labelPriority = 5;
6355
+ } else if (((_l = f.properties) == null ? void 0 : _l.kind) === "text") {
6356
+ labelPriority = ((_m = f.properties) == null ? void 0 : _m.fontWeight) === "bold" ? 8 : 10;
6357
+ } else {
6358
+ const idStr = String(featureId);
6359
+ let h = 0;
6360
+ for (let i = 0; i < idStr.length; i++) {
6361
+ h = (h << 5) - h + idStr.charCodeAt(i);
6362
+ h |= 0;
6363
+ }
6364
+ labelPriority = 100 + Math.abs(h) % 1e3;
6365
+ }
6287
6366
  return {
6288
6367
  type: "Feature",
6289
6368
  id: featureId,
@@ -6306,10 +6385,11 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6306
6385
  "stroke-width": strokeWidth,
6307
6386
  "stroke-opacity": hideFlatFor3DOnly ? 0 : isTimelineVisible ? baseOpacity : 0,
6308
6387
  fill: strokeColor,
6309
- "fill-opacity": hideFlatFor3DOnly ? 0 : isTimelineVisible ? ((_l = f.properties) == null ? void 0 : _l["fill-opacity"]) ?? 0.2 : 0,
6388
+ "fill-opacity": hideFlatFor3DOnly ? 0 : isTimelineVisible ? ((_n = f.properties) == null ? void 0 : _n["fill-opacity"]) ?? 0.2 : 0,
6310
6389
  pointRadius,
6311
6390
  isHiddenFor3DOnly: hideFlatFor3DOnly ? 1 : 0,
6312
- isTimelineHidden: isTimelineVisible ? 0 : 1
6391
+ isTimelineHidden: isTimelineVisible ? 0 : 1,
6392
+ _labelPriority: labelPriority
6313
6393
  }
6314
6394
  };
6315
6395
  })
@@ -6977,28 +7057,36 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6977
7057
  // Text features: center anchor; others: top anchor
6978
7058
  "text-anchor": ["case", ["==", ["get", "kind"], "text"], "center", "top"],
6979
7059
  "text-offset": ["case", ["==", ["get", "kind"], "text"], ["literal", [0, 0]], ["literal", [0, 0.8]]],
6980
- // Collision behaviour for entity labels.
7060
+ // Native collision-based de-overlap.
6981
7061
  //
6982
- // `kind === 'text'` features are sticky-note style annotations
6983
- // where the text IS the content (this layer has no icon-image,
6984
- // and `text-optional` cannot fall back to anything). If we let
6985
- // collision detection hide them, the user is left with a tiny
6986
- // 5px circle and no visible note. Same for trace endpoint
6987
- // labels — the label IS the meaningful marker.
7062
+ // History: a prior PR turned collision off (`text-allow-overlap: true`)
7063
+ // because basemap symbol layers (city / POI / street names from Carto
7064
+ // Voyager etc.) were processed FIRST by MapLibre's collision pipeline
7065
+ // (lower z-order = placed earlier), so our entity labels lost against
7066
+ // every basemap label -- even on near-empty maps. With `false`, freshly
7067
+ // dropped points rendered no label at all.
6988
7068
  //
6989
- // Plain entity-name labels are supplementary to the icon/dot,
6990
- // so it's safe to let MapLibre thin them out in dense areas
6991
- // (this is the "no more black mass of stacked labels" win).
6992
- "text-allow-overlap": [
6993
- "case",
6994
- ["==", ["get", "kind"], "text"],
6995
- true,
6996
- ["==", ["get", "isTraceLabel"], true],
6997
- true,
6998
- false
6999
- ],
7069
+ // The fix has two parts:
7070
+ // 1. (here) Re-enable collision and use `symbol-sort-key` to control
7071
+ // intra-layer priority. Selected/text/trace features win against
7072
+ // ordinary points so they keep their labels when crowded.
7073
+ // 2. (see `moveLabelsBeforeBasemapSymbols` below) After each basemap
7074
+ // load, move `custom-labels` BEFORE basemap symbol layers in the
7075
+ // style stack. MapLibre processes collision in painter order, so
7076
+ // placing our layer earlier makes entity labels claim space
7077
+ // first and basemap labels yield to us.
7078
+ //
7079
+ // Net effect: dense clusters de-overlap automatically, important
7080
+ // features keep their labels, and basemap labels no longer suppress
7081
+ // entity labels. The auto-label threshold (autoLabelConfig.threshold)
7082
+ // remains as a hard cap for very dense viewports.
7083
+ "text-allow-overlap": false,
7000
7084
  "text-ignore-placement": false,
7001
7085
  "text-optional": true,
7086
+ "text-padding": 2,
7087
+ // Lower value = higher collision priority (placed first).
7088
+ // Computed per-feature in syncFeaturesToCustomLayers.
7089
+ "symbol-sort-key": ["coalesce", ["get", "_labelPriority"], 100],
7002
7090
  // Bold font for text features with fontWeight=bold, trace labels, others regular
7003
7091
  "text-font": [
7004
7092
  "case",
@@ -7090,12 +7178,17 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
7090
7178
  }
7091
7179
  });
7092
7180
  if (tooltipElRef.current) {
7181
+ const prevCleanup = tooltipElRef.current._cleanup;
7182
+ try {
7183
+ prevCleanup == null ? void 0 : prevCleanup();
7184
+ } catch {
7185
+ }
7093
7186
  (_a = tooltipElRef.current.parentElement) == null ? void 0 : _a.removeChild(tooltipElRef.current);
7094
7187
  }
7095
7188
  const tooltipEl2 = document.createElement("div");
7096
7189
  tooltipEl2.className = "feature-tooltip-fixed";
7097
- tooltipEl2.style.cssText = "position:absolute;z-index:50;pointer-events:auto;display:none;max-width:320px;";
7098
- mapInstance.getContainer().appendChild(tooltipEl2);
7190
+ tooltipEl2.style.cssText = "position:fixed;z-index:1000;pointer-events:auto;display:none;max-width:480px;";
7191
+ document.body.appendChild(tooltipEl2);
7099
7192
  tooltipElRef.current = tooltipEl2;
7100
7193
  let tooltipLngLat = null;
7101
7194
  let tooltipHideTimeout = null;
@@ -7110,17 +7203,20 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
7110
7203
  if (!tooltipLngLat || tooltipEl2.style.display === "none") return;
7111
7204
  const point = mapInstance.project(tooltipLngLat);
7112
7205
  const container = mapInstance.getContainer();
7113
- const cw = container.clientWidth;
7114
- const ch = container.clientHeight;
7115
- tooltipEl2.style.maxWidth = Math.min(320, cw - 24) + "px";
7206
+ const rect = container.getBoundingClientRect();
7207
+ const ax = rect.left + point.x;
7208
+ const ay = rect.top + point.y;
7209
+ const vw = window.innerWidth;
7210
+ const vh = window.innerHeight;
7211
+ tooltipEl2.style.maxWidth = Math.min(480, vw - 24) + "px";
7116
7212
  const tw = tooltipEl2.offsetWidth || 200;
7117
7213
  const th = tooltipEl2.offsetHeight || 80;
7118
7214
  const gap = 12;
7119
- let left = point.x < cw / 2 ? point.x + gap : point.x - tw - gap;
7120
- let top = point.y - th - gap;
7121
- if (top < 4) top = point.y + gap;
7122
- if (left + tw > cw - 4) left = cw - tw - 4;
7123
- if (top + th > ch - 4) top = ch - th - 4;
7215
+ let left = ax < vw / 2 ? ax + gap : ax - tw - gap;
7216
+ let top = ay - th - gap;
7217
+ if (top < 4) top = ay + gap;
7218
+ if (left + tw > vw - 4) left = vw - tw - 4;
7219
+ if (top + th > vh - 4) top = vh - th - 4;
7124
7220
  left = Math.max(4, left);
7125
7221
  top = Math.max(4, top);
7126
7222
  tooltipEl2.style.left = left + "px";
@@ -7146,6 +7242,13 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
7146
7242
  tooltipLngLatForPagination = null;
7147
7243
  };
7148
7244
  mapInstance.on("move", positionTooltip);
7245
+ const onWindowReposition = () => positionTooltip();
7246
+ window.addEventListener("scroll", onWindowReposition, { capture: true, passive: true });
7247
+ window.addEventListener("resize", onWindowReposition, { passive: true });
7248
+ tooltipEl2._cleanup = () => {
7249
+ window.removeEventListener("scroll", onWindowReposition, { capture: true });
7250
+ window.removeEventListener("resize", onWindowReposition);
7251
+ };
7149
7252
  const scheduleTooltipHide = () => {
7150
7253
  if (tooltipHideTimeout) clearTimeout(tooltipHideTimeout);
7151
7254
  tooltipHideTimeout = setTimeout(() => {
@@ -7474,6 +7577,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
7474
7577
  if (styleUrl) {
7475
7578
  const prefix = BASEMAP_LAYER_PREFIXES[baseMapStyle] || `${baseMapStyle}-`;
7476
7579
  fetch(styleUrl).then((res) => res.json()).then((externalStyle) => {
7580
+ var _a2;
7477
7581
  const addedLayerIds = [];
7478
7582
  const resolveUrl = (url) => {
7479
7583
  if (/^https?:\/\//.test(url)) return url;
@@ -7529,6 +7633,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
7529
7633
  }
7530
7634
  basemapLayerIds.current.set(baseMapStyle, addedLayerIds);
7531
7635
  loadedBasemaps.current.add(baseMapStyle);
7636
+ (_a2 = moveLabelsBeforeBasemapSymbolsRef.current) == null ? void 0 : _a2.call(moveLabelsBeforeBasemapSymbolsRef);
7532
7637
  const triggerResize = () => {
7533
7638
  try {
7534
7639
  mapInstance.resize();
@@ -9583,6 +9688,38 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
9583
9688
  });
9584
9689
  return total;
9585
9690
  }, [layers, getLayerUnsavedCount]);
9691
+ const moveLabelsBeforeBasemapSymbols = useCallback(() => {
9692
+ if (!map.current) return;
9693
+ const m = map.current;
9694
+ if (!m.getLayer("custom-labels")) return;
9695
+ const style = m.getStyle();
9696
+ const allLayers = (style == null ? void 0 : style.layers) || [];
9697
+ const basemapPrefixes = Object.values(BASEMAP_LAYER_PREFIXES);
9698
+ const isVisible = (l) => {
9699
+ var _a;
9700
+ const v = (_a = l.layout) == null ? void 0 : _a.visibility;
9701
+ return v === void 0 || v === "visible";
9702
+ };
9703
+ const firstVisibleBasemapSymbol = allLayers.find(
9704
+ (l) => l.type === "symbol" && basemapPrefixes.some((p) => l.id.startsWith(p)) && isVisible(l)
9705
+ );
9706
+ try {
9707
+ if (firstVisibleBasemapSymbol) {
9708
+ m.moveLayer("custom-labels", firstVisibleBasemapSymbol.id);
9709
+ if (m.getLayer("custom-arrow-labels")) {
9710
+ m.moveLayer("custom-arrow-labels", firstVisibleBasemapSymbol.id);
9711
+ }
9712
+ } else {
9713
+ m.moveLayer("custom-labels");
9714
+ if (m.getLayer("custom-arrow-labels")) {
9715
+ m.moveLayer("custom-arrow-labels");
9716
+ }
9717
+ }
9718
+ } catch (e) {
9719
+ console.warn("[map-component] moveLabelsBeforeBasemapSymbols failed:", (e == null ? void 0 : e.message) ?? e);
9720
+ }
9721
+ }, []);
9722
+ moveLabelsBeforeBasemapSymbolsRef.current = moveLabelsBeforeBasemapSymbols;
9586
9723
  const loadBasemapStyle = useCallback(async (styleName) => {
9587
9724
  if (!map.current) return [];
9588
9725
  const mapInstance = map.current;
@@ -9646,12 +9783,13 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
9646
9783
  }
9647
9784
  }
9648
9785
  }
9786
+ moveLabelsBeforeBasemapSymbols();
9649
9787
  return addedLayerIds;
9650
9788
  } catch (e) {
9651
9789
  console.error(`Failed to load basemap style ${styleName}:`, e);
9652
9790
  return [];
9653
9791
  }
9654
- }, []);
9792
+ }, [moveLabelsBeforeBasemapSymbols]);
9655
9793
  const setBasemapVisibility = useCallback((styleName, visible) => {
9656
9794
  if (!map.current) return;
9657
9795
  const mapInstance = map.current;
@@ -9703,7 +9841,8 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
9703
9841
  }
9704
9842
  setBasemapVisibility(style, true);
9705
9843
  setCurrentMapStyle(style);
9706
- }, [loadBasemapStyle, setBasemapVisibility]);
9844
+ moveLabelsBeforeBasemapSymbols();
9845
+ }, [loadBasemapStyle, setBasemapVisibility, moveLabelsBeforeBasemapSymbols]);
9707
9846
  handleMapStyleChangeRef.current = handleMapStyleChange;
9708
9847
  const handleUpdateTraceConfig = useCallback((layerId, config) => {
9709
9848
  setLayers((prev) => prev.map(
@@ -12364,7 +12503,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
12364
12503
  }
12365
12504
  ),
12366
12505
  showProperties && selectedFeatures.length > 0 && (() => {
12367
- var _a;
12506
+ var _a, _b;
12368
12507
  const firstFeatureId = (_a = selectedFeatures[0]) == null ? void 0 : _a.id;
12369
12508
  const featureLayer = layers.find((l) => l.featureIds.includes(firstFeatureId));
12370
12509
  const layerName = featureLayer == null ? void 0 : featureLayer.name;
@@ -12400,7 +12539,8 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
12400
12539
  onCopyFeaturesToLayer: handleCopyFeaturesToLayer,
12401
12540
  onCreateLayerAndMoveFeatures: handleCreateLayerAndMoveFeatures,
12402
12541
  onCreateLayerAndCopyFeatures: handleCreateLayerAndCopyFeatures,
12403
- getFeatureColor: (featureId) => selectedFeatureColors.get(featureId)
12542
+ getFeatureColor: (featureId) => selectedFeatureColors.get(featureId),
12543
+ anchorEl: isMapLoaded ? ((_b = map.current) == null ? void 0 : _b.getContainer()) ?? null : null
12404
12544
  }
12405
12545
  );
12406
12546
  })(),