@octostar/map-component 0.1.38 → 0.1.39

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
@@ -6489,7 +6489,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
6489
6489
  }
6490
6490
  });
6491
6491
  }
6492
- const isFeatureSelected = selectedIds.includes(featureId) ? 1 : 0;
6492
+ const isFeatureSelected = (enableSelectionRef.current || enableDrawingRef.current) && selectedIds.includes(featureId) ? 1 : 0;
6493
6493
  let labelPriority = 100;
6494
6494
  if (isFeatureSelected) {
6495
6495
  labelPriority = 0;
@@ -8029,6 +8029,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
8029
8029
  });
8030
8030
  mapInstance.on("click", (e) => {
8031
8031
  var _a;
8032
+ if (!enableSelectionRef.current) return;
8032
8033
  if (e.originalEvent.button !== 0) return;
8033
8034
  if (contextMenuFiredRef.current) return;
8034
8035
  if (Date.now() - shiftSelectionRef.current.completedAt < 300) return;
@@ -10430,6 +10431,14 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10430
10431
  react.useEffect(() => {
10431
10432
  selectedFeatureIdsRef.current = selectedFeatureIds;
10432
10433
  }, [selectedFeatureIds]);
10434
+ const enableSelectionRef = react.useRef(enableSelection);
10435
+ react.useEffect(() => {
10436
+ enableSelectionRef.current = enableSelection;
10437
+ }, [enableSelection]);
10438
+ const enableDrawingRef = react.useRef(enableDrawing);
10439
+ react.useEffect(() => {
10440
+ enableDrawingRef.current = enableDrawing;
10441
+ }, [enableDrawing]);
10433
10442
  react.useEffect(() => {
10434
10443
  if (!map.current || !isMapLoaded) {
10435
10444
  return;