@octostar/map-component 0.1.34 → 0.1.35

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
@@ -1153,7 +1153,20 @@ function DrawingToolbar({
1153
1153
  showShortcutHint: showShortcutHints
1154
1154
  }
1155
1155
  ),
1156
- !hiddenDrawingTools.includes("polygon") && /* @__PURE__ */ jsxRuntime.jsx(
1156
+ !hiddenDrawingTools.includes("polygon") && hiddenDrawingTools.includes("rectangle") && /* @__PURE__ */ jsxRuntime.jsx(
1157
+ ToolButton,
1158
+ {
1159
+ mode: "draw_polygon",
1160
+ activeMode,
1161
+ onModeChange,
1162
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pentagon, { className: "w-5 h-5" }),
1163
+ label: "Draw Polygon",
1164
+ shortcut: "G",
1165
+ disabled: drawingDisabled,
1166
+ showShortcutHint: showShortcutHints
1167
+ }
1168
+ ),
1169
+ !hiddenDrawingTools.includes("polygon") && !hiddenDrawingTools.includes("rectangle") && /* @__PURE__ */ jsxRuntime.jsx(
1157
1170
  antd.Dropdown,
1158
1171
  {
1159
1172
  menu: {
@@ -7962,7 +7975,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7962
7975
  });
7963
7976
  setSelectedFeatureIds(ids);
7964
7977
  selectedFeatureIdsRef.current = ids;
7965
- setShowProperties(ids.length > 0);
7978
+ if (enableProperties) setShowProperties(ids.length > 0);
7966
7979
  syncRef.current();
7967
7980
  onFeatureSelect == null ? void 0 : onFeatureSelect(e.features);
7968
7981
  });
@@ -9157,6 +9170,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9157
9170
  handleModeChange(activeMode === "draw_polygon" ? "simple_select" : "draw_polygon");
9158
9171
  break;
9159
9172
  case "b":
9173
+ if (hiddenDrawingTools.includes("rectangle")) break;
9160
9174
  e.preventDefault();
9161
9175
  handleModeChange(activeMode === "draw_rectangle" ? "simple_select" : "draw_rectangle");
9162
9176
  break;
@@ -9179,7 +9193,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9179
9193
  };
9180
9194
  container.addEventListener("keydown", handleKeyDown);
9181
9195
  return () => container.removeEventListener("keydown", handleKeyDown);
9182
- }, [isMapLoaded, enableKeyboardShortcuts, isEditMode, activeMode, handleToggleEditMode, handleUndo, handleRedo, handleModeChange, selectedFeatureIds, handleDeleteSelected, canDeleteSelected]);
9196
+ }, [isMapLoaded, enableKeyboardShortcuts, isEditMode, activeMode, handleToggleEditMode, handleUndo, handleRedo, handleModeChange, selectedFeatureIds, handleDeleteSelected, canDeleteSelected, hiddenDrawingTools]);
9183
9197
  const createPointAtCoords = react.useCallback((lng, lat) => {
9184
9198
  if (!draw.current || !isMapLoaded) return;
9185
9199
  if (!isEditModeRef.current) {
@@ -9211,13 +9225,13 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9211
9225
  });
9212
9226
  draw.current.changeMode("simple_select", { featureIds: [id] });
9213
9227
  setSelectedFeatureIds([id]);
9214
- setShowProperties(true);
9228
+ if (enableProperties) setShowProperties(true);
9215
9229
  updateFeatureCount();
9216
9230
  scheduleTimelineUpdate();
9217
9231
  saveStateForUndo();
9218
9232
  syncFeaturesToCustomLayers();
9219
9233
  onFeatureCreate == null ? void 0 : onFeatureCreate(feature);
9220
- }, [isMapLoaded, externalPersistence, saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, syncFeaturesToCustomLayers, onFeatureCreate]);
9234
+ }, [isMapLoaded, externalPersistence, enableProperties, saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, syncFeaturesToCustomLayers, onFeatureCreate]);
9221
9235
  const handleFeatureContextMenu = react.useCallback((e) => {
9222
9236
  var _a, _b;
9223
9237
  contextMenuFiredRef.current = true;
@@ -10919,7 +10933,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10919
10933
  map.current.getCanvas().style.cursor = "";
10920
10934
  }
10921
10935
  };
10922
- }, [activeMode, isMapLoaded, onFeatureCreate]);
10936
+ }, [activeMode, isMapLoaded, onFeatureCreate, enableProperties]);
10923
10937
  react.useEffect(() => {
10924
10938
  if (!map.current || !isMapLoaded || !draw.current) return;
10925
10939
  if (activeMode !== "draw_rectangle") {
@@ -11014,7 +11028,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
11014
11028
  drawInstance.changeMode("simple_select", { featureIds: [featureId] });
11015
11029
  setActiveMode("simple_select");
11016
11030
  setSelectedFeatureIds([featureId]);
11017
- setShowProperties(true);
11031
+ if (enableProperties) setShowProperties(true);
11018
11032
  if (onFeatureCreate) {
11019
11033
  onFeatureCreate(rectFeature);
11020
11034
  }
@@ -11047,7 +11061,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
11047
11061
  map.current.getCanvas().style.cursor = "";
11048
11062
  }
11049
11063
  };
11050
- }, [activeMode, isMapLoaded, onFeatureCreate]);
11064
+ }, [activeMode, isMapLoaded, onFeatureCreate, enableProperties]);
11051
11065
  const measurePointsRef = react.useRef([]);
11052
11066
  react.useEffect(() => {
11053
11067
  measurePointsRef.current = measurePoints;