@octostar/map-component 0.2.3 → 0.2.5
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 +223 -152
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +223 -152
- package/dist/index.mjs.map +1 -1
- package/dist/types/components/layers-panel.d.ts +7 -1
- package/dist/types/components/layers-panel.d.ts.map +1 -1
- package/dist/types/components/map-editor-canvas.d.ts.map +1 -1
- package/dist/types/components/properties-panel.d.ts.map +1 -1
- package/dist/types/lib/history-diff.d.ts +52 -0
- package/dist/types/lib/history-diff.d.ts.map +1 -0
- package/dist/types/lib/map-editor-api.d.ts +7 -0
- package/dist/types/lib/map-editor-api.d.ts.map +1 -1
- package/dist/types/lib/read-only-feature-index.d.ts +26 -0
- package/dist/types/lib/read-only-feature-index.d.ts.map +1 -0
- package/dist/types/lib/visible-feature-count.d.ts +34 -0
- package/dist/types/lib/visible-feature-count.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1766,6 +1766,7 @@ function LayersPanel({
|
|
|
1766
1766
|
externalPersistence = false,
|
|
1767
1767
|
customGlobalMenuItems,
|
|
1768
1768
|
extraLayerToolbarButtons,
|
|
1769
|
+
extraNewLayerButtons,
|
|
1769
1770
|
layerBadgeProvider,
|
|
1770
1771
|
featureCountProvider
|
|
1771
1772
|
}) {
|
|
@@ -2711,7 +2712,8 @@ function LayersPanel({
|
|
|
2711
2712
|
className: "!w-7 !h-7 !min-w-0 !p-0 shrink-0",
|
|
2712
2713
|
"data-testid": "button-search-new-layer"
|
|
2713
2714
|
}
|
|
2714
|
-
) })
|
|
2715
|
+
) }),
|
|
2716
|
+
extraNewLayerButtons
|
|
2715
2717
|
] })
|
|
2716
2718
|
] }),
|
|
2717
2719
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-1.5 space-y-0.5 pr-2", children: [
|
|
@@ -2803,6 +2805,32 @@ function formatDateForState(value) {
|
|
|
2803
2805
|
}
|
|
2804
2806
|
return "";
|
|
2805
2807
|
}
|
|
2808
|
+
const ENTITY_CARDS_RENDER_CAP = 50;
|
|
2809
|
+
function EntityCardsList({
|
|
2810
|
+
selectedFeatures,
|
|
2811
|
+
entityCardProvider
|
|
2812
|
+
}) {
|
|
2813
|
+
const shown = selectedFeatures.slice(0, ENTITY_CARDS_RENDER_CAP);
|
|
2814
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-2 space-y-2", children: [
|
|
2815
|
+
shown.map((f) => {
|
|
2816
|
+
const geoFeature = {
|
|
2817
|
+
type: "Feature",
|
|
2818
|
+
id: f.id,
|
|
2819
|
+
geometry: f.geometry,
|
|
2820
|
+
properties: f.properties
|
|
2821
|
+
};
|
|
2822
|
+
const card = entityCardProvider(geoFeature);
|
|
2823
|
+
return card ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border border-border rounded-md p-2 bg-card", children: card }, f.id) : null;
|
|
2824
|
+
}),
|
|
2825
|
+
selectedFeatures.length > shown.length && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center py-2 text-muted-foreground text-sm", "data-testid": "entity-cards-cap-note", children: [
|
|
2826
|
+
"Showing the first ",
|
|
2827
|
+
shown.length,
|
|
2828
|
+
" of ",
|
|
2829
|
+
selectedFeatures.length.toLocaleString(),
|
|
2830
|
+
" selected features"
|
|
2831
|
+
] })
|
|
2832
|
+
] });
|
|
2833
|
+
}
|
|
2806
2834
|
function getFeatureTypeIcon(geometryType, kind, size = "sm") {
|
|
2807
2835
|
const cls = size === "lg" ? "w-5 h-5" : "w-4 h-4";
|
|
2808
2836
|
if (kind === "text") {
|
|
@@ -3404,16 +3432,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3404
3432
|
const recordProperties = feature ? Object.entries(feature.properties).filter(
|
|
3405
3433
|
([key, value]) => !isExcludedRecordKey(key) && value !== void 0 && value !== null && !key.startsWith("_") && !key.startsWith("os_") && !key.startsWith("isHidden")
|
|
3406
3434
|
).map(([key, value]) => ({ key, value: formatFieldValue(String(value)) })) : [];
|
|
3407
|
-
const entityCardsContent = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 space-y-2", children:
|
|
3408
|
-
const geoFeature = {
|
|
3409
|
-
type: "Feature",
|
|
3410
|
-
id: f.id,
|
|
3411
|
-
geometry: f.geometry,
|
|
3412
|
-
properties: f.properties
|
|
3413
|
-
};
|
|
3414
|
-
const card = entityCardProvider(geoFeature);
|
|
3415
|
-
return card ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border border-border rounded-md p-2 bg-card", children: card }, f.id) : null;
|
|
3416
|
-
}) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center py-4 text-muted-foreground text-sm", children: "No entity card provider registered" }) });
|
|
3435
|
+
const entityCardsContent = entityCardProvider ? /* @__PURE__ */ jsxRuntime.jsx(EntityCardsList, { selectedFeatures, entityCardProvider }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 space-y-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center py-4 text-muted-foreground text-sm", children: "No entity card provider registered" }) });
|
|
3417
3436
|
const propertiesDisabledOverlay = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-background/80 flex items-center justify-center z-10 rounded-md", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground text-center px-4", children: "Select a single feature to see/set properties" }) });
|
|
3418
3437
|
if (hasMultipleSelection && !entityCardProvider) {
|
|
3419
3438
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -3476,7 +3495,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3476
3495
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-1.5" }),
|
|
3477
3496
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-0.5", children: [
|
|
3478
3497
|
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "feature-name", className: "text-xs text-muted-foreground", children: feature.properties.kind === "text" ? "Label" : "Name" }),
|
|
3479
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3498
|
+
isEditMode ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3480
3499
|
antd.Input,
|
|
3481
3500
|
{
|
|
3482
3501
|
ref: nameInputRef,
|
|
@@ -3489,11 +3508,14 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3489
3508
|
}
|
|
3490
3509
|
},
|
|
3491
3510
|
onBlur: () => handleSave(),
|
|
3492
|
-
placeholder:
|
|
3493
|
-
readOnly: !isEditMode,
|
|
3511
|
+
placeholder: feature.properties.kind === "text" ? "Enter label..." : "Feature name",
|
|
3494
3512
|
className: "!h-6 text-[13px]",
|
|
3495
3513
|
"data-testid": "input-feature-name"
|
|
3496
3514
|
}
|
|
3515
|
+
) : (
|
|
3516
|
+
// Static in view mode — a readOnly Input keeps the editable look
|
|
3517
|
+
// but swallows every keystroke (see LatLngFields).
|
|
3518
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[13px] px-1 py-0.5 break-words", "data-testid": "text-feature-name", children: name || /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "No name" }) })
|
|
3497
3519
|
)
|
|
3498
3520
|
] }),
|
|
3499
3521
|
(typePickerProvider || feature.geometry.type === "Point" && feature.properties.kind !== "text" && pointIcon) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -3964,7 +3986,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3964
3986
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
3965
3987
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-1", children: [
|
|
3966
3988
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[13px] font-mono text-muted-foreground shrink-0 w-24 px-1 leading-6 select-none", children: "description" }),
|
|
3967
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3989
|
+
isEditMode ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3968
3990
|
TextArea,
|
|
3969
3991
|
{
|
|
3970
3992
|
id: "feature-description",
|
|
@@ -3972,14 +3994,13 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3972
3994
|
onChange: (e) => setDescription(e.target.value),
|
|
3973
3995
|
onBlur: () => handleSave(),
|
|
3974
3996
|
autoSize: { minRows: 1, maxRows: 5 },
|
|
3975
|
-
placeholder:
|
|
3976
|
-
readOnly: !isEditMode,
|
|
3997
|
+
placeholder: "—",
|
|
3977
3998
|
className: "flex-1 !text-[13px] !px-1.5 !py-0.5 resize-none",
|
|
3978
3999
|
"data-testid": "input-feature-description"
|
|
3979
4000
|
}
|
|
3980
|
-
)
|
|
4001
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 text-[13px] px-1.5 leading-6 break-words", "data-testid": "text-feature-description", children: description || /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "—" }) })
|
|
3981
4002
|
] }),
|
|
3982
|
-
customProperties.map((prop, index) => /* @__PURE__ */ jsxRuntime.
|
|
4003
|
+
customProperties.map((prop, index) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: isEditMode ? "flex items-center gap-1" : "flex items-start gap-1", children: isEditMode ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3983
4004
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3984
4005
|
antd.Input,
|
|
3985
4006
|
{
|
|
@@ -3987,8 +4008,8 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3987
4008
|
onChange: (e) => handlePropertyKeyChange(index, e.target.value),
|
|
3988
4009
|
onBlur: () => handleSave(),
|
|
3989
4010
|
placeholder: "Key",
|
|
4011
|
+
style: { width: "6rem", flex: "0 0 6rem" },
|
|
3990
4012
|
className: "shrink-0 w-24 text-[13px] font-mono !h-6 !px-1",
|
|
3991
|
-
readOnly: !isEditMode,
|
|
3992
4013
|
"data-testid": `input-property-key-${index}`
|
|
3993
4014
|
}
|
|
3994
4015
|
),
|
|
@@ -4000,11 +4021,10 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
4000
4021
|
onBlur: () => handleSave(),
|
|
4001
4022
|
placeholder: "Value",
|
|
4002
4023
|
className: "flex-1 text-[13px] !h-6 !px-1.5",
|
|
4003
|
-
readOnly: !isEditMode,
|
|
4004
4024
|
"data-testid": `input-property-value-${index}`
|
|
4005
4025
|
}
|
|
4006
4026
|
),
|
|
4007
|
-
|
|
4027
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4008
4028
|
"button",
|
|
4009
4029
|
{
|
|
4010
4030
|
type: "button",
|
|
@@ -4017,7 +4037,10 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
4017
4037
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "w-3 h-3" })
|
|
4018
4038
|
}
|
|
4019
4039
|
)
|
|
4020
|
-
] },
|
|
4040
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4041
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[13px] font-mono text-muted-foreground shrink-0 w-24 px-1 leading-6 select-none break-all", children: prop.key }),
|
|
4042
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 text-[13px] px-1.5 leading-6 break-words", "data-testid": `text-property-value-${index}`, children: prop.value || /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "—" }) })
|
|
4043
|
+
] }) }, index))
|
|
4021
4044
|
] }),
|
|
4022
4045
|
isEditMode && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 pt-0.5", children: [
|
|
4023
4046
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5291,6 +5314,86 @@ function useMapHistory(options) {
|
|
|
5291
5314
|
}, [history, rerender]);
|
|
5292
5315
|
return { push, undo, redo, clear, canUndo: history.canUndo, canRedo: history.canRedo };
|
|
5293
5316
|
}
|
|
5317
|
+
function historyLayersEqual(a, b) {
|
|
5318
|
+
if (a.featureIds.length !== b.featureIds.length) return false;
|
|
5319
|
+
for (let i = 0; i < a.featureIds.length; i += 1) {
|
|
5320
|
+
if (a.featureIds[i] !== b.featureIds[i]) return false;
|
|
5321
|
+
}
|
|
5322
|
+
const { featureIds: _aIds, ...aRest } = a;
|
|
5323
|
+
const { featureIds: _bIds, ...bRest } = b;
|
|
5324
|
+
return JSON.stringify(aRest) === JSON.stringify(bRest);
|
|
5325
|
+
}
|
|
5326
|
+
function diffHistorySnapshots(before, after, beforeLayers, afterLayers) {
|
|
5327
|
+
const allFeatureIds = /* @__PURE__ */ new Set();
|
|
5328
|
+
before.forEach((_v, k) => allFeatureIds.add(k));
|
|
5329
|
+
after.forEach((_v, k) => allFeatureIds.add(k));
|
|
5330
|
+
const featureIds = /* @__PURE__ */ new Set();
|
|
5331
|
+
allFeatureIds.forEach((id) => {
|
|
5332
|
+
const b = before.get(id);
|
|
5333
|
+
const a = after.get(id);
|
|
5334
|
+
if (!b || !a || b.layerId !== a.layerId || b.store !== a.store) {
|
|
5335
|
+
featureIds.add(id);
|
|
5336
|
+
return;
|
|
5337
|
+
}
|
|
5338
|
+
if (b.feature === a.feature) return;
|
|
5339
|
+
if (JSON.stringify(b.feature.geometry) !== JSON.stringify(a.feature.geometry) || JSON.stringify(b.feature.properties ?? {}) !== JSON.stringify(a.feature.properties ?? {})) {
|
|
5340
|
+
featureIds.add(id);
|
|
5341
|
+
}
|
|
5342
|
+
});
|
|
5343
|
+
const allLayerIds = /* @__PURE__ */ new Set();
|
|
5344
|
+
beforeLayers.forEach((_v, k) => allLayerIds.add(k));
|
|
5345
|
+
afterLayers.forEach((_v, k) => allLayerIds.add(k));
|
|
5346
|
+
const layerIds = /* @__PURE__ */ new Set();
|
|
5347
|
+
allLayerIds.forEach((id) => {
|
|
5348
|
+
const b = beforeLayers.get(id);
|
|
5349
|
+
const a = afterLayers.get(id);
|
|
5350
|
+
if (!b || !a || !historyLayersEqual(b, a)) layerIds.add(id);
|
|
5351
|
+
});
|
|
5352
|
+
return { featureIds, layerIds };
|
|
5353
|
+
}
|
|
5354
|
+
function isReadOnlyIndexCurrent(cached, store) {
|
|
5355
|
+
if (!cached || cached.sources.size !== store.size) return false;
|
|
5356
|
+
let stale = false;
|
|
5357
|
+
store.forEach((features, layerId) => {
|
|
5358
|
+
if (!stale && cached.sources.get(layerId) !== features) stale = true;
|
|
5359
|
+
});
|
|
5360
|
+
return !stale;
|
|
5361
|
+
}
|
|
5362
|
+
function buildReadOnlyFeatureIndex(store) {
|
|
5363
|
+
const byId = /* @__PURE__ */ new Map();
|
|
5364
|
+
store.forEach((features) => {
|
|
5365
|
+
for (const f of features) {
|
|
5366
|
+
if (f.id == null) continue;
|
|
5367
|
+
const fid = String(f.id);
|
|
5368
|
+
if (!byId.has(fid)) byId.set(fid, f);
|
|
5369
|
+
}
|
|
5370
|
+
});
|
|
5371
|
+
return { sources: new Map(store), byId };
|
|
5372
|
+
}
|
|
5373
|
+
function countFeaturesInBounds(featureGroups, bounds, options) {
|
|
5374
|
+
var _a;
|
|
5375
|
+
const { west, east, south, north } = bounds;
|
|
5376
|
+
const { threshold, visibleSet } = options;
|
|
5377
|
+
const fullWidth = east - west >= 360;
|
|
5378
|
+
const inView = (lng, lat) => {
|
|
5379
|
+
if (lat < south || lat > north) return false;
|
|
5380
|
+
if (fullWidth) return true;
|
|
5381
|
+
return lng >= west && lng <= east || lng + 360 >= west && lng + 360 <= east || lng - 360 >= west && lng - 360 <= east;
|
|
5382
|
+
};
|
|
5383
|
+
let count = 0;
|
|
5384
|
+
for (const features of featureGroups) {
|
|
5385
|
+
for (const f of features) {
|
|
5386
|
+
if (visibleSet && f.id != null && !visibleSet.has(String(f.id))) continue;
|
|
5387
|
+
if (((_a = f.geometry) == null ? void 0 : _a.type) === "Point") {
|
|
5388
|
+
const [lng, lat] = f.geometry.coordinates;
|
|
5389
|
+
if (!inView(lng, lat)) continue;
|
|
5390
|
+
}
|
|
5391
|
+
count += 1;
|
|
5392
|
+
if (count > threshold) return count;
|
|
5393
|
+
}
|
|
5394
|
+
}
|
|
5395
|
+
return count;
|
|
5396
|
+
}
|
|
5294
5397
|
const OTHER_BUCKET_KEY = "__other__";
|
|
5295
5398
|
const OTHER_BUCKET_LABEL = "Other";
|
|
5296
5399
|
const OTHER_BUCKET_COLOR = "#9ca3af";
|
|
@@ -6008,6 +6111,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6008
6111
|
toastProvider,
|
|
6009
6112
|
customGlobalMenuItems,
|
|
6010
6113
|
extraLayerToolbarButtons,
|
|
6114
|
+
extraNewLayerButtons,
|
|
6011
6115
|
layerBadgeProvider,
|
|
6012
6116
|
featureCountProvider,
|
|
6013
6117
|
fitBoundsProvider,
|
|
@@ -6079,6 +6183,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6079
6183
|
const filterPolygonRef = react.useRef(null);
|
|
6080
6184
|
const pendingFeatureKindRef = react.useRef(null);
|
|
6081
6185
|
const arrowFeatureIdsRef = react.useRef(/* @__PURE__ */ new Set());
|
|
6186
|
+
const hasArrowFeaturesRef = react.useRef(false);
|
|
6082
6187
|
const [circleDrawCenter, setCircleDrawCenter] = react.useState(null);
|
|
6083
6188
|
const [circleDrawPreview, setCircleDrawPreview] = react.useState(null);
|
|
6084
6189
|
const isDrawingCircle = react.useRef(false);
|
|
@@ -6196,19 +6301,28 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6196
6301
|
return true;
|
|
6197
6302
|
});
|
|
6198
6303
|
}, [selectedFeatureIds]);
|
|
6199
|
-
const selectedFeatures =
|
|
6304
|
+
const selectedFeatures = react.useMemo(
|
|
6305
|
+
() => getSelectedFeatures(),
|
|
6306
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- featureUpdateCounter invalidates stale clones
|
|
6307
|
+
[getSelectedFeatures, featureUpdateCounter]
|
|
6308
|
+
);
|
|
6309
|
+
const readOnlyFeatureIndexRef = react.useRef(null);
|
|
6310
|
+
const getReadOnlyFeatureById = react.useCallback((id) => {
|
|
6311
|
+
const store = readOnlyFeatures.current;
|
|
6312
|
+
let cached = readOnlyFeatureIndexRef.current;
|
|
6313
|
+
if (!isReadOnlyIndexCurrent(cached, store)) {
|
|
6314
|
+
cached = buildReadOnlyFeatureIndex(store);
|
|
6315
|
+
readOnlyFeatureIndexRef.current = cached;
|
|
6316
|
+
}
|
|
6317
|
+
return cached.byId.get(id) ?? null;
|
|
6318
|
+
}, []);
|
|
6200
6319
|
const getFeatureById = react.useCallback((id) => {
|
|
6201
6320
|
if (draw.current) {
|
|
6202
6321
|
const feature = draw.current.get(id);
|
|
6203
6322
|
if (feature) return feature;
|
|
6204
6323
|
}
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
const found = features.find((f) => String(f.id) === id);
|
|
6208
|
-
if (found) return found;
|
|
6209
|
-
}
|
|
6210
|
-
return null;
|
|
6211
|
-
}, []);
|
|
6324
|
+
return getReadOnlyFeatureById(id);
|
|
6325
|
+
}, [getReadOnlyFeatureById]);
|
|
6212
6326
|
const canDeleteSelected = react.useMemo(() => {
|
|
6213
6327
|
if (selectedFeatureIds.length === 0) return false;
|
|
6214
6328
|
return selectedFeatureIds.some((id) => {
|
|
@@ -6234,7 +6348,9 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6234
6348
|
if (!isMapLoaded || !draw.current) {
|
|
6235
6349
|
setSelectedFeatureIds(nextIds);
|
|
6236
6350
|
if (options == null ? void 0 : options.focusProperties) setShowProperties(nextIds.length > 0);
|
|
6237
|
-
|
|
6351
|
+
if (onFeatureSelect) {
|
|
6352
|
+
onFeatureSelect(nextIds.length > 0 ? nextIds.map((id) => getFeatureById(id)).filter(Boolean) : []);
|
|
6353
|
+
}
|
|
6238
6354
|
return;
|
|
6239
6355
|
}
|
|
6240
6356
|
const editableIdSet = /* @__PURE__ */ new Set();
|
|
@@ -6261,8 +6377,9 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6261
6377
|
setSelectedFeatureIds(nextIds);
|
|
6262
6378
|
selectedFeatureIdsRef.current = nextIds;
|
|
6263
6379
|
if (options == null ? void 0 : options.focusProperties) setShowProperties(nextIds.length > 0);
|
|
6264
|
-
|
|
6265
|
-
|
|
6380
|
+
if (onFeatureSelect) {
|
|
6381
|
+
onFeatureSelect(nextIds.map((id) => getFeatureById(id)).filter(Boolean));
|
|
6382
|
+
}
|
|
6266
6383
|
syncRef.current();
|
|
6267
6384
|
if (readOnlyIds.length > 0) {
|
|
6268
6385
|
queueMicrotask(() => {
|
|
@@ -6286,6 +6403,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6286
6403
|
setFeatureCount(drawFeatureCount + hiddenCount + readOnlyCount);
|
|
6287
6404
|
}, []);
|
|
6288
6405
|
const timelineVisibleIdsRef = react.useRef(null);
|
|
6406
|
+
const timelineSyncRafRef = react.useRef(null);
|
|
6289
6407
|
const syncRef = react.useRef(() => {
|
|
6290
6408
|
});
|
|
6291
6409
|
const hashStringToColor$1 = react.useCallback((str) => hashStringToColor(str), []);
|
|
@@ -6356,6 +6474,22 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6356
6474
|
});
|
|
6357
6475
|
return colorMap;
|
|
6358
6476
|
}, [selectedFeatureIds, layers, getAllFeatures, hashStringToColor$1]);
|
|
6477
|
+
const countVisibleFeatures = react.useCallback((threshold) => {
|
|
6478
|
+
const m = map.current;
|
|
6479
|
+
if (!m) return 0;
|
|
6480
|
+
const bounds = m.getBounds();
|
|
6481
|
+
const groups = [];
|
|
6482
|
+
if (draw.current) groups.push(draw.current.getAll().features);
|
|
6483
|
+
readOnlyFeatures.current.forEach((features, layerId) => {
|
|
6484
|
+
const layer = layersRef.current.find((l) => l.id === layerId);
|
|
6485
|
+
if (layer == null ? void 0 : layer.visible) groups.push(features);
|
|
6486
|
+
});
|
|
6487
|
+
return countFeaturesInBounds(
|
|
6488
|
+
groups,
|
|
6489
|
+
{ west: bounds.getWest(), east: bounds.getEast(), south: bounds.getSouth(), north: bounds.getNorth() },
|
|
6490
|
+
{ threshold, visibleSet: timelineVisibleIdsRef.current }
|
|
6491
|
+
);
|
|
6492
|
+
}, []);
|
|
6359
6493
|
const isSyncingRef = react.useRef(false);
|
|
6360
6494
|
const syncFeaturesToCustomLayers = react.useCallback(() => {
|
|
6361
6495
|
if (!map.current) return;
|
|
@@ -6708,11 +6842,13 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6708
6842
|
if (arrowHeadSource && map.current) {
|
|
6709
6843
|
const arrowHeadTriangles = [];
|
|
6710
6844
|
const mapInstance = map.current;
|
|
6845
|
+
let sawArrowFeature = false;
|
|
6711
6846
|
const headLength = 16;
|
|
6712
6847
|
const headWidth = 10;
|
|
6713
6848
|
sourceData.features.forEach((f) => {
|
|
6714
6849
|
var _a;
|
|
6715
6850
|
const isArrow = ((_a = f.properties) == null ? void 0 : _a.kind) === "arrow" || arrowFeatureIdsRef.current.has(String(f.id));
|
|
6851
|
+
if (isArrow) sawArrowFeature = true;
|
|
6716
6852
|
if (f.geometry.type !== "LineString" || !isArrow) return;
|
|
6717
6853
|
const coords = f.geometry.coordinates;
|
|
6718
6854
|
if (coords.length < 2) return;
|
|
@@ -6758,6 +6894,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6758
6894
|
});
|
|
6759
6895
|
});
|
|
6760
6896
|
arrowHeadSource.setData({ type: "FeatureCollection", features: arrowHeadTriangles });
|
|
6897
|
+
hasArrowFeaturesRef.current = sawArrowFeature;
|
|
6761
6898
|
}
|
|
6762
6899
|
const arrowLabelSource = map.current.getSource("arrow-labels");
|
|
6763
6900
|
if (arrowLabelSource) {
|
|
@@ -6803,37 +6940,15 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6803
6940
|
if (update3DFlightPathsRef == null ? void 0 : update3DFlightPathsRef.current) {
|
|
6804
6941
|
update3DFlightPathsRef.current();
|
|
6805
6942
|
}
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
const countLayers = ["custom-point", "custom-line", "custom-polygon-fill"];
|
|
6811
|
-
const existing = countLayers.filter((id) => m.getLayer(id));
|
|
6812
|
-
if (existing.length === 0) {
|
|
6813
|
-
setVisibleFeatureCount(0);
|
|
6814
|
-
setLabelsSuppressed(false);
|
|
6815
|
-
return;
|
|
6816
|
-
}
|
|
6817
|
-
const threshold = autoLabelConfig.enabled ? autoLabelConfig.threshold : 220;
|
|
6818
|
-
const rendered = m.queryRenderedFeatures(void 0, { layers: existing });
|
|
6819
|
-
const uniqueIds = /* @__PURE__ */ new Set();
|
|
6820
|
-
let count = 0;
|
|
6821
|
-
for (const f of rendered) {
|
|
6822
|
-
const fid = ((_a = f.properties) == null ? void 0 : _a.id) || f.id;
|
|
6823
|
-
if (fid && !uniqueIds.has(String(fid))) {
|
|
6824
|
-
uniqueIds.add(String(fid));
|
|
6825
|
-
count++;
|
|
6826
|
-
if (count > threshold) break;
|
|
6827
|
-
}
|
|
6828
|
-
}
|
|
6829
|
-
setVisibleFeatureCount(count);
|
|
6830
|
-
setLabelsSuppressed(false);
|
|
6831
|
-
});
|
|
6943
|
+
{
|
|
6944
|
+
const threshold = autoLabelConfig.enabled ? autoLabelConfig.threshold : 220;
|
|
6945
|
+
setVisibleFeatureCount(countVisibleFeatures(threshold));
|
|
6946
|
+
setLabelsSuppressed(false);
|
|
6832
6947
|
}
|
|
6833
6948
|
} finally {
|
|
6834
6949
|
isSyncingRef.current = false;
|
|
6835
6950
|
}
|
|
6836
|
-
}, [layers, hashStringToColor$1, autoLabelConfig]);
|
|
6951
|
+
}, [layers, hashStringToColor$1, autoLabelConfig, countVisibleFeatures]);
|
|
6837
6952
|
const update3DFlightPaths = react.useCallback(() => {
|
|
6838
6953
|
if (!map.current || !is3DTerrainEnabled) {
|
|
6839
6954
|
if (map.current && flightPath3DLayerId.current) {
|
|
@@ -7154,6 +7269,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
7154
7269
|
updateFeatureCount();
|
|
7155
7270
|
scheduleTimelineUpdate();
|
|
7156
7271
|
syncFeaturesToCustomLayers();
|
|
7272
|
+
setFeatureUpdateCounter((c) => c + 1);
|
|
7157
7273
|
queueMicrotask(() => {
|
|
7158
7274
|
isSelectingReadOnlyRef.current = false;
|
|
7159
7275
|
});
|
|
@@ -7162,25 +7278,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
7162
7278
|
);
|
|
7163
7279
|
const buildDiffCommand = react.useCallback(
|
|
7164
7280
|
(label, coalesceKey, before, after, beforeLayers, afterLayers, beforeSelectedIds, afterSelectedIds) => {
|
|
7165
|
-
const featureIds =
|
|
7166
|
-
|
|
7167
|
-
after.forEach((_v, k) => featureIds.add(k));
|
|
7168
|
-
const layerIds = /* @__PURE__ */ new Set();
|
|
7169
|
-
beforeLayers.forEach((_v, k) => layerIds.add(k));
|
|
7170
|
-
afterLayers.forEach((_v, k) => layerIds.add(k));
|
|
7171
|
-
const featuresChanged = Array.from(featureIds).some((id) => {
|
|
7172
|
-
const b = before.get(id);
|
|
7173
|
-
const a = after.get(id);
|
|
7174
|
-
if (!b || !a || b.layerId !== a.layerId) return true;
|
|
7175
|
-
if (JSON.stringify(b.feature.geometry) !== JSON.stringify(a.feature.geometry)) return true;
|
|
7176
|
-
return JSON.stringify(b.feature.properties ?? {}) !== JSON.stringify(a.feature.properties ?? {});
|
|
7177
|
-
});
|
|
7178
|
-
const layersChanged = featuresChanged || Array.from(layerIds).some((id) => {
|
|
7179
|
-
const b = beforeLayers.get(id);
|
|
7180
|
-
const a = afterLayers.get(id);
|
|
7181
|
-
return !b || !a || JSON.stringify(b) !== JSON.stringify(a);
|
|
7182
|
-
});
|
|
7183
|
-
if (!featuresChanged && !layersChanged) return null;
|
|
7281
|
+
const { featureIds, layerIds } = diffHistorySnapshots(before, after, beforeLayers, afterLayers);
|
|
7282
|
+
if (featureIds.size === 0 && layerIds.size === 0) return null;
|
|
7184
7283
|
const pick = (src, keys) => {
|
|
7185
7284
|
const out = /* @__PURE__ */ new Map();
|
|
7186
7285
|
keys.forEach((k) => {
|
|
@@ -8372,12 +8471,14 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
8372
8471
|
justCreatedRectangleRef.current = false;
|
|
8373
8472
|
return;
|
|
8374
8473
|
}
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
originalGeometriesRef.current.
|
|
8379
|
-
|
|
8380
|
-
|
|
8474
|
+
if (isEditModeRef.current) {
|
|
8475
|
+
e.features.forEach((feature) => {
|
|
8476
|
+
const fid = feature.id;
|
|
8477
|
+
if (!originalGeometriesRef.current.has(fid)) {
|
|
8478
|
+
originalGeometriesRef.current.set(fid, JSON.parse(JSON.stringify(feature.geometry)));
|
|
8479
|
+
}
|
|
8480
|
+
});
|
|
8481
|
+
}
|
|
8381
8482
|
const currentIds = new Set(ids);
|
|
8382
8483
|
originalGeometriesRef.current.forEach((_, key) => {
|
|
8383
8484
|
if (!currentIds.has(key)) {
|
|
@@ -9417,19 +9518,18 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
9417
9518
|
const handleDeleteSelected = react.useCallback(() => {
|
|
9418
9519
|
if (selectedFeatureIds.length === 0) return;
|
|
9419
9520
|
const idSet = new Set(selectedFeatureIds);
|
|
9521
|
+
const readOnlyIdSet = /* @__PURE__ */ new Set();
|
|
9522
|
+
for (const layer of layersRef.current) {
|
|
9523
|
+
if (!layer.readOnly) continue;
|
|
9524
|
+
for (const fid of layer.featureIds) readOnlyIdSet.add(fid);
|
|
9525
|
+
}
|
|
9420
9526
|
const editableIds = [];
|
|
9421
9527
|
const readOnlyIds = [];
|
|
9422
|
-
const currentLayers = layersRef.current;
|
|
9423
9528
|
for (const id of selectedFeatureIds) {
|
|
9424
|
-
|
|
9425
|
-
if (layer == null ? void 0 : layer.readOnly) {
|
|
9426
|
-
readOnlyIds.push(id);
|
|
9427
|
-
} else {
|
|
9428
|
-
editableIds.push(id);
|
|
9429
|
-
}
|
|
9529
|
+
(readOnlyIdSet.has(id) ? readOnlyIds : editableIds).push(id);
|
|
9430
9530
|
}
|
|
9531
|
+
saveStateForUndo("delete features");
|
|
9431
9532
|
if (editableIds.length > 0 && draw.current) {
|
|
9432
|
-
saveStateForUndo();
|
|
9433
9533
|
editableIds.forEach((id) => {
|
|
9434
9534
|
arrowFeatureIdsRef.current.delete(id);
|
|
9435
9535
|
try {
|
|
@@ -9764,7 +9864,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
9764
9864
|
const handleUpdateProperties = react.useCallback((featureId, properties, options) => {
|
|
9765
9865
|
var _a, _b, _c;
|
|
9766
9866
|
if (!map.current) return;
|
|
9767
|
-
saveStateForUndo();
|
|
9867
|
+
if (!(options == null ? void 0 : options.fromRefresh)) saveStateForUndo();
|
|
9768
9868
|
const { startDate, endDate } = normalizeTemporalProperties(properties);
|
|
9769
9869
|
const normalizedProperties = {
|
|
9770
9870
|
...properties,
|
|
@@ -9791,12 +9891,13 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
9791
9891
|
}
|
|
9792
9892
|
syncFeaturesToCustomLayers();
|
|
9793
9893
|
scheduleTimelineUpdate();
|
|
9894
|
+
setFeatureUpdateCounter((c) => c + 1);
|
|
9794
9895
|
const updated = draw.current.get(featureId);
|
|
9795
9896
|
if (updated) onFeatureUpdate == null ? void 0 : onFeatureUpdate(updated);
|
|
9796
9897
|
} else {
|
|
9797
9898
|
let updatedFeature;
|
|
9798
9899
|
readOnlyFeatures.current.forEach((features, layerId) => {
|
|
9799
|
-
var _a2
|
|
9900
|
+
var _a2;
|
|
9800
9901
|
const idx = features.findIndex((f) => String(f.id) === featureId);
|
|
9801
9902
|
if (idx !== -1) {
|
|
9802
9903
|
const f = features[idx];
|
|
@@ -9807,20 +9908,25 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
9807
9908
|
if (JSON.stringify(oldVal) !== JSON.stringify(value)) hasRealChange = true;
|
|
9808
9909
|
});
|
|
9809
9910
|
const currentUnsaved = (_a2 = f.properties) == null ? void 0 : _a2._unsaved;
|
|
9810
|
-
|
|
9911
|
+
const nextProperties = { ...f.properties, ...normalizedProperties };
|
|
9811
9912
|
if (!externalPersistence && hasRealChange && currentUnsaved !== false && !(options == null ? void 0 : options.fromRefresh)) {
|
|
9812
|
-
|
|
9913
|
+
nextProperties._unsaved = true;
|
|
9813
9914
|
}
|
|
9814
|
-
if (properties.kind === "text" ||
|
|
9815
|
-
delete
|
|
9915
|
+
if (properties.kind === "text" || nextProperties.kind === "text") {
|
|
9916
|
+
delete nextProperties.text;
|
|
9816
9917
|
}
|
|
9918
|
+
const replacement = { ...f, properties: nextProperties };
|
|
9919
|
+
const nextFeatures = features.slice();
|
|
9920
|
+
nextFeatures[idx] = replacement;
|
|
9921
|
+
readOnlyFeatures.current.set(layerId, nextFeatures);
|
|
9817
9922
|
layerTemporalCacheRef.current.delete(layerId);
|
|
9818
|
-
updatedFeature =
|
|
9923
|
+
updatedFeature = replacement;
|
|
9819
9924
|
}
|
|
9820
9925
|
});
|
|
9821
9926
|
if (updatedFeature) {
|
|
9822
9927
|
syncFeaturesToCustomLayers();
|
|
9823
9928
|
scheduleTimelineUpdate();
|
|
9929
|
+
setFeatureUpdateCounter((c) => c + 1);
|
|
9824
9930
|
onFeatureUpdate == null ? void 0 : onFeatureUpdate(updatedFeature);
|
|
9825
9931
|
}
|
|
9826
9932
|
}
|
|
@@ -9847,6 +9953,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
9847
9953
|
}
|
|
9848
9954
|
draw.current.changeMode("simple_select", { featureIds: [featureId] });
|
|
9849
9955
|
syncFeaturesToCustomLayers();
|
|
9956
|
+
setFeatureUpdateCounter((c) => c + 1);
|
|
9850
9957
|
const updated = draw.current.get(featureId);
|
|
9851
9958
|
if (updated) {
|
|
9852
9959
|
onFeatureUpdate == null ? void 0 : onFeatureUpdate(updated);
|
|
@@ -10014,16 +10121,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
10014
10121
|
}, [saveStateForUndo]);
|
|
10015
10122
|
const findFeatureById = react.useCallback((id) => {
|
|
10016
10123
|
var _a;
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
readOnlyFeatures.current.forEach((features) => {
|
|
10020
|
-
if (!feature) {
|
|
10021
|
-
const found = features.find((f) => String(f.id) === id);
|
|
10022
|
-
if (found) feature = found;
|
|
10023
|
-
}
|
|
10024
|
-
});
|
|
10025
|
-
return feature;
|
|
10026
|
-
}, []);
|
|
10124
|
+
return ((_a = draw.current) == null ? void 0 : _a.get(id)) ?? getReadOnlyFeatureById(id) ?? void 0;
|
|
10125
|
+
}, [getReadOnlyFeatureById]);
|
|
10027
10126
|
const handleMoveFeaturesToLayer = react.useCallback((featureIds, targetLayerId) => {
|
|
10028
10127
|
if (!draw.current) return;
|
|
10029
10128
|
saveStateForUndo();
|
|
@@ -10383,22 +10482,10 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
10383
10482
|
setAutoLabelConfig(config);
|
|
10384
10483
|
}, []);
|
|
10385
10484
|
const countVisibleFeaturesInViewport = react.useCallback(() => {
|
|
10386
|
-
var _a;
|
|
10387
10485
|
if (!map.current || !isMapLoaded) return;
|
|
10388
|
-
const
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
setVisibleFeatureCount(0);
|
|
10392
|
-
return;
|
|
10393
|
-
}
|
|
10394
|
-
const rendered = map.current.queryRenderedFeatures(void 0, { layers: existingLayers });
|
|
10395
|
-
const uniqueIds = /* @__PURE__ */ new Set();
|
|
10396
|
-
for (const f of rendered) {
|
|
10397
|
-
const fid = ((_a = f.properties) == null ? void 0 : _a.id) || f.id;
|
|
10398
|
-
if (fid) uniqueIds.add(String(fid));
|
|
10399
|
-
}
|
|
10400
|
-
setVisibleFeatureCount(uniqueIds.size);
|
|
10401
|
-
}, [isMapLoaded]);
|
|
10486
|
+
const threshold = autoLabelConfig.enabled ? autoLabelConfig.threshold : 220;
|
|
10487
|
+
setVisibleFeatureCount(countVisibleFeatures(threshold));
|
|
10488
|
+
}, [isMapLoaded, countVisibleFeatures, autoLabelConfig.enabled, autoLabelConfig.threshold]);
|
|
10402
10489
|
react.useEffect(() => {
|
|
10403
10490
|
if (!map.current || !isMapLoaded) return;
|
|
10404
10491
|
const mapInstance = map.current;
|
|
@@ -10428,6 +10515,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
10428
10515
|
if (!map.current || !isMapLoaded) return;
|
|
10429
10516
|
const mapInstance = map.current;
|
|
10430
10517
|
const handleMove = () => {
|
|
10518
|
+
if (!hasArrowFeaturesRef.current) return;
|
|
10431
10519
|
if (syncRef.current) {
|
|
10432
10520
|
syncRef.current();
|
|
10433
10521
|
}
|
|
@@ -10484,31 +10572,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
10484
10572
|
let lastCenter = mapInstance.getCenter();
|
|
10485
10573
|
let lastZoom = mapInstance.getZoom();
|
|
10486
10574
|
const updateViewportCount = () => {
|
|
10487
|
-
var _a;
|
|
10488
|
-
const layers2 = ["custom-point", "custom-line", "custom-polygon-fill"];
|
|
10489
|
-
const existing = layers2.filter((id) => mapInstance.getLayer(id));
|
|
10490
|
-
if (existing.length === 0) {
|
|
10491
|
-
setVisibleFeatureCount(0);
|
|
10492
|
-
setLabelsSuppressed(false);
|
|
10493
|
-
return;
|
|
10494
|
-
}
|
|
10495
10575
|
const threshold = autoLabelConfig.enabled ? autoLabelConfig.threshold : 220;
|
|
10496
|
-
|
|
10497
|
-
const uniqueIds = /* @__PURE__ */ new Set();
|
|
10498
|
-
let count = 0;
|
|
10499
|
-
for (const f of rendered) {
|
|
10500
|
-
const fid = ((_a = f.properties) == null ? void 0 : _a.id) || f.id;
|
|
10501
|
-
if (fid && !uniqueIds.has(String(fid))) {
|
|
10502
|
-
uniqueIds.add(String(fid));
|
|
10503
|
-
count++;
|
|
10504
|
-
if (count > threshold) {
|
|
10505
|
-
setVisibleFeatureCount(count);
|
|
10506
|
-
setLabelsSuppressed(false);
|
|
10507
|
-
return;
|
|
10508
|
-
}
|
|
10509
|
-
}
|
|
10510
|
-
}
|
|
10511
|
-
setVisibleFeatureCount(count);
|
|
10576
|
+
setVisibleFeatureCount(countVisibleFeatures(threshold));
|
|
10512
10577
|
setLabelsSuppressed(false);
|
|
10513
10578
|
};
|
|
10514
10579
|
const onMapMovement = () => {
|
|
@@ -10534,7 +10599,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
10534
10599
|
} catch {
|
|
10535
10600
|
}
|
|
10536
10601
|
};
|
|
10537
|
-
}, [isMapLoaded, autoLabelConfig.threshold, autoLabelConfig.enabled]);
|
|
10602
|
+
}, [isMapLoaded, autoLabelConfig.threshold, autoLabelConfig.enabled, countVisibleFeatures]);
|
|
10538
10603
|
const DEFAULT_LABEL_THRESHOLD = 220;
|
|
10539
10604
|
react.useEffect(() => {
|
|
10540
10605
|
if (!map.current || !isMapLoaded) return;
|
|
@@ -12239,7 +12304,12 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
12239
12304
|
const handleTimelineFilterChange = react.useCallback((visibleIds, hiddenIds, untimedIds) => {
|
|
12240
12305
|
if (!draw.current || !map.current) return;
|
|
12241
12306
|
timelineVisibleIdsRef.current = /* @__PURE__ */ new Set([...visibleIds, ...untimedIds]);
|
|
12242
|
-
|
|
12307
|
+
if (timelineSyncRafRef.current == null) {
|
|
12308
|
+
timelineSyncRafRef.current = requestAnimationFrame(() => {
|
|
12309
|
+
timelineSyncRafRef.current = null;
|
|
12310
|
+
syncFeaturesToCustomLayers();
|
|
12311
|
+
});
|
|
12312
|
+
}
|
|
12243
12313
|
}, [syncFeaturesToCustomLayers]);
|
|
12244
12314
|
const prevTimelineEnabledRef = react.useRef(timelineStore.isEnabled);
|
|
12245
12315
|
react.useEffect(() => {
|
|
@@ -13011,6 +13081,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
13011
13081
|
externalPersistence,
|
|
13012
13082
|
customGlobalMenuItems,
|
|
13013
13083
|
extraLayerToolbarButtons,
|
|
13084
|
+
extraNewLayerButtons,
|
|
13014
13085
|
layerBadgeProvider,
|
|
13015
13086
|
featureCountProvider
|
|
13016
13087
|
}
|