@octostar/map-component 0.1.17 → 0.1.19
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 +61 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +62 -36
- package/dist/index.mjs.map +1 -1
- package/dist/types/components/drawing-toolbar.d.ts +2 -1
- package/dist/types/components/drawing-toolbar.d.ts.map +1 -1
- package/dist/types/components/map-editor-canvas.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -131,6 +131,7 @@ function DrawingToolbar({
|
|
|
131
131
|
onGoTo,
|
|
132
132
|
onDropPoint,
|
|
133
133
|
showGoToButton = false,
|
|
134
|
+
onFitToFeatures,
|
|
134
135
|
isSelectionToolActive = true,
|
|
135
136
|
onSelectionToolActiveChange,
|
|
136
137
|
showClearFilter = false,
|
|
@@ -627,28 +628,45 @@ function DrawingToolbar({
|
|
|
627
628
|
),
|
|
628
629
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-0.5 !min-w-0" })
|
|
629
630
|
] }),
|
|
630
|
-
onGoTo && /* @__PURE__ */ jsxRuntime.
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
631
|
+
onGoTo && /* @__PURE__ */ jsxRuntime.jsx(
|
|
632
|
+
antd.Tooltip,
|
|
633
|
+
{
|
|
634
|
+
title: "Go To",
|
|
635
|
+
placement: "right",
|
|
636
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
637
|
+
antd.Button,
|
|
638
|
+
{
|
|
639
|
+
type: "text",
|
|
640
|
+
onClick: () => setGoToDialogOpen(true),
|
|
641
|
+
disabled,
|
|
642
|
+
className: "relative transition-all duration-150 flex items-center justify-center !w-9 !h-9 !min-w-0 !p-0",
|
|
643
|
+
"aria-label": "Go To",
|
|
644
|
+
"data-testid": "button-goto-address",
|
|
645
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Navigation, { className: "w-5 h-5" })
|
|
646
|
+
}
|
|
647
|
+
)
|
|
648
|
+
}
|
|
649
|
+
),
|
|
650
|
+
onFitToFeatures && /* @__PURE__ */ jsxRuntime.jsx(
|
|
651
|
+
antd.Tooltip,
|
|
652
|
+
{
|
|
653
|
+
title: "Fit to Data",
|
|
654
|
+
placement: "right",
|
|
655
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
656
|
+
antd.Button,
|
|
657
|
+
{
|
|
658
|
+
type: "text",
|
|
659
|
+
onClick: onFitToFeatures,
|
|
660
|
+
disabled,
|
|
661
|
+
className: "relative transition-all duration-150 flex items-center justify-center !w-9 !h-9 !min-w-0 !p-0",
|
|
662
|
+
"aria-label": "Fit to Data",
|
|
663
|
+
"data-testid": "button-fit-to-data",
|
|
664
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Scan, { className: "w-5 h-5" })
|
|
665
|
+
}
|
|
666
|
+
)
|
|
667
|
+
}
|
|
668
|
+
),
|
|
669
|
+
(onGoTo || onFitToFeatures) && !enableMeasurement && /* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-0.5 !min-w-0" }),
|
|
652
670
|
!selectionOnly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
653
671
|
antd.Tooltip,
|
|
654
672
|
{
|
|
@@ -9239,18 +9257,24 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
9239
9257
|
}
|
|
9240
9258
|
}, [onWorkspaceSave, toast]);
|
|
9241
9259
|
const handleFitToFeatures = react.useCallback(() => {
|
|
9242
|
-
if (!map.current
|
|
9260
|
+
if (!map.current) return;
|
|
9243
9261
|
const allFeatures = [];
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
layer.
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9262
|
+
if (draw.current) {
|
|
9263
|
+
layers.forEach((layer) => {
|
|
9264
|
+
if (layer.visible) {
|
|
9265
|
+
layer.featureIds.forEach((id) => {
|
|
9266
|
+
const f = draw.current.get(id);
|
|
9267
|
+
if (f) allFeatures.push(f);
|
|
9268
|
+
});
|
|
9269
|
+
} else {
|
|
9270
|
+
const hidden = hiddenFeatures.current.get(layer.id) || [];
|
|
9271
|
+
allFeatures.push(...hidden);
|
|
9272
|
+
}
|
|
9273
|
+
});
|
|
9274
|
+
}
|
|
9275
|
+
readOnlyFeatures.current.forEach((features, lid) => {
|
|
9276
|
+
const layer = layersRef.current.find((l) => l.id === lid);
|
|
9277
|
+
if (!layer || layer.visible) allFeatures.push(...features);
|
|
9254
9278
|
});
|
|
9255
9279
|
if (allFeatures.length === 0) {
|
|
9256
9280
|
toast({
|
|
@@ -9266,7 +9290,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
9266
9290
|
const bbox = turf__namespace.bbox(fc);
|
|
9267
9291
|
map.current.fitBounds([[bbox[0], bbox[1]], [bbox[2], bbox[3]]], {
|
|
9268
9292
|
padding: 80,
|
|
9269
|
-
maxZoom: 16
|
|
9293
|
+
maxZoom: 16,
|
|
9294
|
+
duration: 1e3
|
|
9270
9295
|
});
|
|
9271
9296
|
}, [layers, toast]);
|
|
9272
9297
|
const handleFileChange = react.useCallback((e) => {
|
|
@@ -10118,7 +10143,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
10118
10143
|
onGoTo: (coords, zoom) => {
|
|
10119
10144
|
if (map.current) {
|
|
10120
10145
|
const currentZoom = map.current.getZoom();
|
|
10121
|
-
map.current.flyTo({ center: coords, zoom: zoom ?? Math.max(currentZoom,
|
|
10146
|
+
map.current.flyTo({ center: coords, zoom: zoom ?? Math.max(currentZoom, 20), duration: 2e3 });
|
|
10122
10147
|
}
|
|
10123
10148
|
},
|
|
10124
10149
|
showClearFilter,
|
|
@@ -10127,6 +10152,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
10127
10152
|
filterActiveRef.current = active;
|
|
10128
10153
|
},
|
|
10129
10154
|
showGoToButton,
|
|
10155
|
+
onFitToFeatures: handleFitToFeatures,
|
|
10130
10156
|
onDropPoint,
|
|
10131
10157
|
geocodingUrl,
|
|
10132
10158
|
geocoderProvider,
|