@octostar/map-component 0.1.39 → 0.2.0
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 +417 -112
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +417 -112
- package/dist/index.mjs.map +1 -1
- package/dist/types/components/map-editor-canvas.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/map-editor-api.d.ts +44 -17
- package/dist/types/lib/map-editor-api.d.ts.map +1 -1
- package/dist/types/lib/map-history.d.ts +68 -0
- package/dist/types/lib/map-history.d.ts.map +1 -0
- package/package.json +7 -1
package/dist/index.mjs
CHANGED
|
@@ -5168,6 +5168,90 @@ function MapDropZone({ onDrop, children }) {
|
|
|
5168
5168
|
}
|
|
5169
5169
|
);
|
|
5170
5170
|
}
|
|
5171
|
+
const DEFAULT_LIMIT = 50;
|
|
5172
|
+
const DEFAULT_COALESCE_MS = 600;
|
|
5173
|
+
class CommandHistory {
|
|
5174
|
+
constructor(limit = DEFAULT_LIMIT, coalesceMs = DEFAULT_COALESCE_MS, now = Date.now) {
|
|
5175
|
+
this.limit = limit;
|
|
5176
|
+
this.coalesceMs = coalesceMs;
|
|
5177
|
+
this.now = now;
|
|
5178
|
+
this.undoStack = [];
|
|
5179
|
+
this.redoStack = [];
|
|
5180
|
+
this.lastPush = null;
|
|
5181
|
+
}
|
|
5182
|
+
get canUndo() {
|
|
5183
|
+
return this.undoStack.length > 0;
|
|
5184
|
+
}
|
|
5185
|
+
get canRedo() {
|
|
5186
|
+
return this.redoStack.length > 0;
|
|
5187
|
+
}
|
|
5188
|
+
/** Push a new command. Clears the redo stack (a new action forks history). */
|
|
5189
|
+
push(command) {
|
|
5190
|
+
const at = this.now();
|
|
5191
|
+
const key = command.coalesceKey;
|
|
5192
|
+
const top = this.undoStack[this.undoStack.length - 1];
|
|
5193
|
+
if (key && top && this.lastPush && this.lastPush.key === key && at - this.lastPush.at < this.coalesceMs) {
|
|
5194
|
+
top.redo = command.redo;
|
|
5195
|
+
this.lastPush = { key, at };
|
|
5196
|
+
this.redoStack = [];
|
|
5197
|
+
return;
|
|
5198
|
+
}
|
|
5199
|
+
this.undoStack.push(command);
|
|
5200
|
+
if (this.undoStack.length > this.limit) this.undoStack.shift();
|
|
5201
|
+
this.redoStack = [];
|
|
5202
|
+
this.lastPush = key ? { key, at } : null;
|
|
5203
|
+
}
|
|
5204
|
+
/** Reverse the most recent command. Returns false if nothing to undo. */
|
|
5205
|
+
undo() {
|
|
5206
|
+
const command = this.undoStack.pop();
|
|
5207
|
+
if (!command) return false;
|
|
5208
|
+
this.lastPush = null;
|
|
5209
|
+
command.undo();
|
|
5210
|
+
this.redoStack.push(command);
|
|
5211
|
+
return true;
|
|
5212
|
+
}
|
|
5213
|
+
/** Re-apply the most recently undone command. Returns false if none. */
|
|
5214
|
+
redo() {
|
|
5215
|
+
const command = this.redoStack.pop();
|
|
5216
|
+
if (!command) return false;
|
|
5217
|
+
this.lastPush = null;
|
|
5218
|
+
command.redo();
|
|
5219
|
+
this.undoStack.push(command);
|
|
5220
|
+
return true;
|
|
5221
|
+
}
|
|
5222
|
+
clear() {
|
|
5223
|
+
this.undoStack = [];
|
|
5224
|
+
this.redoStack = [];
|
|
5225
|
+
this.lastPush = null;
|
|
5226
|
+
}
|
|
5227
|
+
}
|
|
5228
|
+
function useMapHistory(options) {
|
|
5229
|
+
const historyRef = useRef(null);
|
|
5230
|
+
if (historyRef.current === null) {
|
|
5231
|
+
historyRef.current = new CommandHistory(options == null ? void 0 : options.limit, options == null ? void 0 : options.coalesceMs);
|
|
5232
|
+
}
|
|
5233
|
+
const history = historyRef.current;
|
|
5234
|
+
const [, setTick] = useState(0);
|
|
5235
|
+
const rerender = useCallback(() => setTick((t) => t + 1), []);
|
|
5236
|
+
const push = useCallback(
|
|
5237
|
+
(command) => {
|
|
5238
|
+
history.push(command);
|
|
5239
|
+
rerender();
|
|
5240
|
+
},
|
|
5241
|
+
[history, rerender]
|
|
5242
|
+
);
|
|
5243
|
+
const undo = useCallback(() => {
|
|
5244
|
+
if (history.undo()) rerender();
|
|
5245
|
+
}, [history, rerender]);
|
|
5246
|
+
const redo = useCallback(() => {
|
|
5247
|
+
if (history.redo()) rerender();
|
|
5248
|
+
}, [history, rerender]);
|
|
5249
|
+
const clear = useCallback(() => {
|
|
5250
|
+
history.clear();
|
|
5251
|
+
rerender();
|
|
5252
|
+
}, [history, rerender]);
|
|
5253
|
+
return { push, undo, redo, clear, canUndo: history.canUndo, canRedo: history.canRedo };
|
|
5254
|
+
}
|
|
5171
5255
|
const OTHER_BUCKET_KEY = "__other__";
|
|
5172
5256
|
const OTHER_BUCKET_LABEL = "Other";
|
|
5173
5257
|
const OTHER_BUCKET_COLOR = "#9ca3af";
|
|
@@ -5818,19 +5902,6 @@ const EXTERNAL_STYLE_URLS = {
|
|
|
5818
5902
|
streets: "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json",
|
|
5819
5903
|
dark: "https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"
|
|
5820
5904
|
};
|
|
5821
|
-
function computeUndoRedoEvent(fromState, toState) {
|
|
5822
|
-
const fromIds = new Set(fromState.features.map((f) => f.id));
|
|
5823
|
-
const toIds = new Set(toState.features.map((f) => f.id));
|
|
5824
|
-
const restoredFeatures = toState.features.filter((f) => !fromIds.has(f.id)).map((f) => {
|
|
5825
|
-
var _a;
|
|
5826
|
-
return {
|
|
5827
|
-
feature: f,
|
|
5828
|
-
layerId: ((_a = toState.layers.find((l) => l.featureIds.includes(f.id))) == null ? void 0 : _a.id) ?? null
|
|
5829
|
-
};
|
|
5830
|
-
});
|
|
5831
|
-
const removedFeatureIds = fromState.features.filter((f) => !toIds.has(f.id)).map((f) => f.id);
|
|
5832
|
-
return { restoredFeatures, removedFeatureIds };
|
|
5833
|
-
}
|
|
5834
5905
|
const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
5835
5906
|
className,
|
|
5836
5907
|
enableDrawing = true,
|
|
@@ -5858,8 +5929,6 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
5858
5929
|
onFeatureCreate,
|
|
5859
5930
|
onFeatureUpdate,
|
|
5860
5931
|
onFeatureDelete,
|
|
5861
|
-
onUndo,
|
|
5862
|
-
onRedo,
|
|
5863
5932
|
onLayerChange,
|
|
5864
5933
|
onActiveEditingLayerChange,
|
|
5865
5934
|
onTimelineChange,
|
|
@@ -5950,8 +6019,9 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
5950
6019
|
{ id: "default", name: "Default Layer", visible: true, featureIds: [] }
|
|
5951
6020
|
]);
|
|
5952
6021
|
const [activeEditingLayerId, setActiveEditingLayerId] = useState("default");
|
|
5953
|
-
const
|
|
5954
|
-
const
|
|
6022
|
+
const history = useMapHistory();
|
|
6023
|
+
const pendingCaptureRef = useRef(null);
|
|
6024
|
+
const preDragRef = useRef(null);
|
|
5955
6025
|
const [isEditMode, setIsEditMode] = useState(false);
|
|
5956
6026
|
const [currentMapStyle, setCurrentMapStyle] = useState(baseMapStyle);
|
|
5957
6027
|
const [measureMode, setMeasureMode] = useState("none");
|
|
@@ -6161,16 +6231,6 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
6161
6231
|
});
|
|
6162
6232
|
}
|
|
6163
6233
|
}, [isMapLoaded, getFeatureById, onFeatureSelect]);
|
|
6164
|
-
const saveStateForUndo = useCallback(() => {
|
|
6165
|
-
if (!draw.current) return;
|
|
6166
|
-
const currentState = {
|
|
6167
|
-
features: draw.current.getAll().features,
|
|
6168
|
-
layers: JSON.parse(JSON.stringify(layersRef.current)),
|
|
6169
|
-
selectedIds: [...selectedFeatureIds]
|
|
6170
|
-
};
|
|
6171
|
-
setUndoStack((prev) => [...prev.slice(-49), currentState]);
|
|
6172
|
-
setRedoStack([]);
|
|
6173
|
-
}, [selectedFeatureIds]);
|
|
6174
6234
|
const updateFeatureCount = useCallback(() => {
|
|
6175
6235
|
const drawFeatureCount = draw.current ? draw.current.getAll().features.length : 0;
|
|
6176
6236
|
let hiddenCount = 0;
|
|
@@ -6878,6 +6938,287 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
6878
6938
|
updateTimelineStore();
|
|
6879
6939
|
}, 300);
|
|
6880
6940
|
}, [updateTimelineStore]);
|
|
6941
|
+
const collectHistoryFeatures = useCallback(
|
|
6942
|
+
(overrides) => {
|
|
6943
|
+
var _a;
|
|
6944
|
+
const featureToLayer = /* @__PURE__ */ new Map();
|
|
6945
|
+
for (const l of layersRef.current) {
|
|
6946
|
+
if (((_a = l.metadata) == null ? void 0 : _a.dataViewing) === true) continue;
|
|
6947
|
+
for (const fid of l.featureIds) featureToLayer.set(fid, l.id);
|
|
6948
|
+
}
|
|
6949
|
+
const result = /* @__PURE__ */ new Map();
|
|
6950
|
+
if (draw.current) {
|
|
6951
|
+
for (const f of draw.current.getAll().features) {
|
|
6952
|
+
if (f.id == null) continue;
|
|
6953
|
+
const id = String(f.id);
|
|
6954
|
+
result.set(id, {
|
|
6955
|
+
feature: f,
|
|
6956
|
+
layerId: featureToLayer.get(id) ?? activeEditingLayerIdRef.current,
|
|
6957
|
+
store: "draw"
|
|
6958
|
+
});
|
|
6959
|
+
}
|
|
6960
|
+
}
|
|
6961
|
+
readOnlyFeatures.current.forEach((features, layerId) => {
|
|
6962
|
+
var _a2;
|
|
6963
|
+
const layer = layersRef.current.find((l) => l.id === layerId);
|
|
6964
|
+
if (((_a2 = layer == null ? void 0 : layer.metadata) == null ? void 0 : _a2.dataViewing) === true) return;
|
|
6965
|
+
for (const f of features) {
|
|
6966
|
+
if (f.id == null) continue;
|
|
6967
|
+
result.set(String(f.id), { feature: f, layerId, store: "readOnly" });
|
|
6968
|
+
}
|
|
6969
|
+
});
|
|
6970
|
+
hiddenFeatures.current.forEach((features, layerId) => {
|
|
6971
|
+
for (const f of features) {
|
|
6972
|
+
if (f.id == null) continue;
|
|
6973
|
+
result.set(String(f.id), { feature: f, layerId, store: "hidden" });
|
|
6974
|
+
}
|
|
6975
|
+
});
|
|
6976
|
+
if (overrides == null ? void 0 : overrides.excludeDrawIds) {
|
|
6977
|
+
overrides.excludeDrawIds.forEach((id) => result.delete(id));
|
|
6978
|
+
}
|
|
6979
|
+
if (overrides == null ? void 0 : overrides.addDrawFeatures) {
|
|
6980
|
+
for (const f of overrides.addDrawFeatures) {
|
|
6981
|
+
if (f.id == null) continue;
|
|
6982
|
+
const id = String(f.id);
|
|
6983
|
+
const layerId = featureToLayer.get(id) ?? activeEditingLayerIdRef.current;
|
|
6984
|
+
const layer = layersRef.current.find((l) => l.id === layerId);
|
|
6985
|
+
result.set(id, { feature: f, layerId, store: (layer == null ? void 0 : layer.readOnly) ? "readOnly" : "draw" });
|
|
6986
|
+
}
|
|
6987
|
+
}
|
|
6988
|
+
return result;
|
|
6989
|
+
},
|
|
6990
|
+
[]
|
|
6991
|
+
);
|
|
6992
|
+
const collectHistoryLayers = useCallback(() => {
|
|
6993
|
+
var _a;
|
|
6994
|
+
const result = /* @__PURE__ */ new Map();
|
|
6995
|
+
for (const l of layersRef.current) {
|
|
6996
|
+
if (((_a = l.metadata) == null ? void 0 : _a.dataViewing) === true) continue;
|
|
6997
|
+
result.set(l.id, { ...l, featureIds: [...l.featureIds] });
|
|
6998
|
+
}
|
|
6999
|
+
return result;
|
|
7000
|
+
}, []);
|
|
7001
|
+
const cleanupOrphanLayerSources = useCallback((liveLayerIds) => {
|
|
7002
|
+
clusterPieManagers.current.forEach((mgr, layerId) => {
|
|
7003
|
+
if (!liveLayerIds.has(layerId)) {
|
|
7004
|
+
try {
|
|
7005
|
+
mgr.destroy();
|
|
7006
|
+
} catch {
|
|
7007
|
+
}
|
|
7008
|
+
clusterPieManagers.current.delete(layerId);
|
|
7009
|
+
}
|
|
7010
|
+
});
|
|
7011
|
+
const m = map.current;
|
|
7012
|
+
if (!m) return;
|
|
7013
|
+
let style;
|
|
7014
|
+
try {
|
|
7015
|
+
style = m.getStyle();
|
|
7016
|
+
} catch {
|
|
7017
|
+
return;
|
|
7018
|
+
}
|
|
7019
|
+
const layerPrefixes = ["heatmap-layer-", "cluster-count-", "clusters-", "unclustered-point-"];
|
|
7020
|
+
const sourcePrefixes = ["heatmap-source-", "cluster-source-"];
|
|
7021
|
+
((style == null ? void 0 : style.layers) ?? []).forEach((sl) => {
|
|
7022
|
+
const prefix = layerPrefixes.find((p) => sl.id.startsWith(p));
|
|
7023
|
+
if (!prefix) return;
|
|
7024
|
+
const id = sl.id.slice(prefix.length);
|
|
7025
|
+
if (!liveLayerIds.has(id) && m.getLayer(sl.id)) {
|
|
7026
|
+
try {
|
|
7027
|
+
m.removeLayer(sl.id);
|
|
7028
|
+
} catch {
|
|
7029
|
+
}
|
|
7030
|
+
}
|
|
7031
|
+
});
|
|
7032
|
+
Object.keys((style == null ? void 0 : style.sources) ?? {}).forEach((sid) => {
|
|
7033
|
+
const prefix = sourcePrefixes.find((p) => sid.startsWith(p));
|
|
7034
|
+
if (!prefix) return;
|
|
7035
|
+
const id = sid.slice(prefix.length);
|
|
7036
|
+
if (!liveLayerIds.has(id) && m.getSource(sid)) {
|
|
7037
|
+
try {
|
|
7038
|
+
m.removeSource(sid);
|
|
7039
|
+
} catch {
|
|
7040
|
+
}
|
|
7041
|
+
}
|
|
7042
|
+
});
|
|
7043
|
+
}, []);
|
|
7044
|
+
useEffect(() => {
|
|
7045
|
+
if (!isMapLoaded) return;
|
|
7046
|
+
cleanupOrphanLayerSources(new Set(layers.map((l) => l.id)));
|
|
7047
|
+
}, [layers, isMapLoaded, cleanupOrphanLayerSources]);
|
|
7048
|
+
const applyHistoryState = useCallback(
|
|
7049
|
+
(featureIds, layerIds, targetFeatures, targetLayers) => {
|
|
7050
|
+
isApiAddingRef.current = true;
|
|
7051
|
+
isSelectingReadOnlyRef.current = true;
|
|
7052
|
+
try {
|
|
7053
|
+
featureIds.forEach((id) => {
|
|
7054
|
+
var _a;
|
|
7055
|
+
try {
|
|
7056
|
+
(_a = draw.current) == null ? void 0 : _a.delete(id);
|
|
7057
|
+
} catch {
|
|
7058
|
+
}
|
|
7059
|
+
});
|
|
7060
|
+
readOnlyFeatures.current.forEach((features, layerId) => {
|
|
7061
|
+
const filtered = features.filter((f) => !featureIds.has(String(f.id)));
|
|
7062
|
+
if (filtered.length !== features.length) readOnlyFeatures.current.set(layerId, filtered);
|
|
7063
|
+
});
|
|
7064
|
+
hiddenFeatures.current.forEach((features, layerId) => {
|
|
7065
|
+
const filtered = features.filter((f) => !featureIds.has(String(f.id)));
|
|
7066
|
+
if (filtered.length !== features.length) hiddenFeatures.current.set(layerId, filtered);
|
|
7067
|
+
});
|
|
7068
|
+
const readOnlyAdds = /* @__PURE__ */ new Map();
|
|
7069
|
+
const hiddenAdds = /* @__PURE__ */ new Map();
|
|
7070
|
+
featureIds.forEach((id) => {
|
|
7071
|
+
var _a;
|
|
7072
|
+
const entry = targetFeatures.get(id);
|
|
7073
|
+
if (!entry) return;
|
|
7074
|
+
if (entry.store === "draw") {
|
|
7075
|
+
try {
|
|
7076
|
+
(_a = draw.current) == null ? void 0 : _a.add(entry.feature);
|
|
7077
|
+
} catch {
|
|
7078
|
+
}
|
|
7079
|
+
} else if (entry.store === "readOnly") {
|
|
7080
|
+
const list = readOnlyAdds.get(entry.layerId) ?? [];
|
|
7081
|
+
list.push(entry.feature);
|
|
7082
|
+
readOnlyAdds.set(entry.layerId, list);
|
|
7083
|
+
} else {
|
|
7084
|
+
const list = hiddenAdds.get(entry.layerId) ?? [];
|
|
7085
|
+
list.push(entry.feature);
|
|
7086
|
+
hiddenAdds.set(entry.layerId, list);
|
|
7087
|
+
}
|
|
7088
|
+
});
|
|
7089
|
+
readOnlyAdds.forEach((features, layerId) => {
|
|
7090
|
+
readOnlyFeatures.current.set(layerId, [...readOnlyFeatures.current.get(layerId) ?? [], ...features]);
|
|
7091
|
+
});
|
|
7092
|
+
hiddenAdds.forEach((features, layerId) => {
|
|
7093
|
+
hiddenFeatures.current.set(layerId, [...hiddenFeatures.current.get(layerId) ?? [], ...features]);
|
|
7094
|
+
});
|
|
7095
|
+
const next = layersRef.current.slice();
|
|
7096
|
+
layerIds.forEach((id) => {
|
|
7097
|
+
const target = targetLayers.get(id);
|
|
7098
|
+
const idx = next.findIndex((l) => l.id === id);
|
|
7099
|
+
if (target && idx === -1) next.push(target);
|
|
7100
|
+
else if (target && idx !== -1) next[idx] = target;
|
|
7101
|
+
else if (!target && idx !== -1) {
|
|
7102
|
+
next.splice(idx, 1);
|
|
7103
|
+
readOnlyFeatures.current.delete(id);
|
|
7104
|
+
hiddenFeatures.current.delete(id);
|
|
7105
|
+
layerTemporalCacheRef.current.delete(id);
|
|
7106
|
+
}
|
|
7107
|
+
});
|
|
7108
|
+
layersRef.current = next;
|
|
7109
|
+
setLayers(next);
|
|
7110
|
+
} finally {
|
|
7111
|
+
isApiAddingRef.current = false;
|
|
7112
|
+
}
|
|
7113
|
+
cleanupOrphanLayerSources(new Set(layersRef.current.map((l) => l.id)));
|
|
7114
|
+
layerTemporalCacheRef.current.clear();
|
|
7115
|
+
updateFeatureCount();
|
|
7116
|
+
scheduleTimelineUpdate();
|
|
7117
|
+
syncFeaturesToCustomLayers();
|
|
7118
|
+
queueMicrotask(() => {
|
|
7119
|
+
isSelectingReadOnlyRef.current = false;
|
|
7120
|
+
});
|
|
7121
|
+
},
|
|
7122
|
+
[cleanupOrphanLayerSources, updateFeatureCount, scheduleTimelineUpdate, syncFeaturesToCustomLayers]
|
|
7123
|
+
);
|
|
7124
|
+
const buildDiffCommand = useCallback(
|
|
7125
|
+
(label, coalesceKey, before, after, beforeLayers, afterLayers, beforeSelectedIds, afterSelectedIds) => {
|
|
7126
|
+
const featureIds = /* @__PURE__ */ new Set();
|
|
7127
|
+
before.forEach((_v, k) => featureIds.add(k));
|
|
7128
|
+
after.forEach((_v, k) => featureIds.add(k));
|
|
7129
|
+
const layerIds = /* @__PURE__ */ new Set();
|
|
7130
|
+
beforeLayers.forEach((_v, k) => layerIds.add(k));
|
|
7131
|
+
afterLayers.forEach((_v, k) => layerIds.add(k));
|
|
7132
|
+
const featuresChanged = Array.from(featureIds).some((id) => {
|
|
7133
|
+
const b = before.get(id);
|
|
7134
|
+
const a = after.get(id);
|
|
7135
|
+
if (!b || !a || b.layerId !== a.layerId) return true;
|
|
7136
|
+
if (JSON.stringify(b.feature.geometry) !== JSON.stringify(a.feature.geometry)) return true;
|
|
7137
|
+
return JSON.stringify(b.feature.properties ?? {}) !== JSON.stringify(a.feature.properties ?? {});
|
|
7138
|
+
});
|
|
7139
|
+
const layersChanged = featuresChanged || Array.from(layerIds).some((id) => {
|
|
7140
|
+
const b = beforeLayers.get(id);
|
|
7141
|
+
const a = afterLayers.get(id);
|
|
7142
|
+
return !b || !a || JSON.stringify(b) !== JSON.stringify(a);
|
|
7143
|
+
});
|
|
7144
|
+
if (!featuresChanged && !layersChanged) return null;
|
|
7145
|
+
const pick = (src, keys) => {
|
|
7146
|
+
const out = /* @__PURE__ */ new Map();
|
|
7147
|
+
keys.forEach((k) => {
|
|
7148
|
+
const v = src.get(k);
|
|
7149
|
+
if (v !== void 0) out.set(k, v);
|
|
7150
|
+
});
|
|
7151
|
+
return out;
|
|
7152
|
+
};
|
|
7153
|
+
const beforeF = pick(before, featureIds);
|
|
7154
|
+
const afterF = pick(after, featureIds);
|
|
7155
|
+
const beforeL = pick(beforeLayers, layerIds);
|
|
7156
|
+
const afterL = pick(afterLayers, layerIds);
|
|
7157
|
+
return {
|
|
7158
|
+
label,
|
|
7159
|
+
coalesceKey,
|
|
7160
|
+
undo: () => {
|
|
7161
|
+
applyHistoryState(featureIds, layerIds, beforeF, beforeL);
|
|
7162
|
+
applySelectionState(beforeSelectedIds, { focusProperties: false });
|
|
7163
|
+
},
|
|
7164
|
+
redo: () => {
|
|
7165
|
+
applyHistoryState(featureIds, layerIds, afterF, afterL);
|
|
7166
|
+
applySelectionState(afterSelectedIds, { focusProperties: false });
|
|
7167
|
+
}
|
|
7168
|
+
};
|
|
7169
|
+
},
|
|
7170
|
+
[applyHistoryState, applySelectionState]
|
|
7171
|
+
);
|
|
7172
|
+
const finalizeCapture = useCallback(() => {
|
|
7173
|
+
const pending = pendingCaptureRef.current;
|
|
7174
|
+
pendingCaptureRef.current = null;
|
|
7175
|
+
if (!pending) return;
|
|
7176
|
+
const after = collectHistoryFeatures();
|
|
7177
|
+
const afterLayers = collectHistoryLayers();
|
|
7178
|
+
const command = buildDiffCommand(
|
|
7179
|
+
pending.label,
|
|
7180
|
+
pending.coalesceKey,
|
|
7181
|
+
pending.before,
|
|
7182
|
+
after,
|
|
7183
|
+
pending.beforeLayers,
|
|
7184
|
+
afterLayers,
|
|
7185
|
+
pending.beforeSelectedIds,
|
|
7186
|
+
[...selectedFeatureIdsRef.current]
|
|
7187
|
+
);
|
|
7188
|
+
if (command) {
|
|
7189
|
+
history.push(command);
|
|
7190
|
+
}
|
|
7191
|
+
}, [collectHistoryFeatures, collectHistoryLayers, buildDiffCommand, history]);
|
|
7192
|
+
const saveStateForUndo = useCallback(
|
|
7193
|
+
(label = "edit", options) => {
|
|
7194
|
+
if (isApiAddingRef.current) return;
|
|
7195
|
+
if (pendingCaptureRef.current) return;
|
|
7196
|
+
pendingCaptureRef.current = {
|
|
7197
|
+
label,
|
|
7198
|
+
coalesceKey: options == null ? void 0 : options.coalesceKey,
|
|
7199
|
+
before: collectHistoryFeatures({
|
|
7200
|
+
excludeDrawIds: options == null ? void 0 : options.excludeDrawIds,
|
|
7201
|
+
addDrawFeatures: options == null ? void 0 : options.addDrawFeatures
|
|
7202
|
+
}),
|
|
7203
|
+
beforeLayers: collectHistoryLayers(),
|
|
7204
|
+
beforeSelectedIds: [...selectedFeatureIdsRef.current]
|
|
7205
|
+
};
|
|
7206
|
+
requestAnimationFrame(finalizeCapture);
|
|
7207
|
+
},
|
|
7208
|
+
[collectHistoryFeatures, collectHistoryLayers, finalizeCapture]
|
|
7209
|
+
);
|
|
7210
|
+
const recordMoveFromPreDrag = useCallback(() => {
|
|
7211
|
+
const pre = preDragRef.current;
|
|
7212
|
+
preDragRef.current = null;
|
|
7213
|
+
if (!pre || isApiAddingRef.current || pendingCaptureRef.current) return;
|
|
7214
|
+
pendingCaptureRef.current = {
|
|
7215
|
+
label: "move feature",
|
|
7216
|
+
before: pre.features,
|
|
7217
|
+
beforeLayers: pre.layers,
|
|
7218
|
+
beforeSelectedIds: pre.selectedIds
|
|
7219
|
+
};
|
|
7220
|
+
requestAnimationFrame(finalizeCapture);
|
|
7221
|
+
}, [finalizeCapture]);
|
|
6881
7222
|
useEffect(() => {
|
|
6882
7223
|
if (!mapContainer.current || map.current) return;
|
|
6883
7224
|
try {
|
|
@@ -7806,6 +8147,15 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
7806
8147
|
}
|
|
7807
8148
|
});
|
|
7808
8149
|
const processedFeatureIds = /* @__PURE__ */ new Set();
|
|
8150
|
+
mapInstance.on("mousedown", () => {
|
|
8151
|
+
if (draw.current && draw.current.getSelectedIds().length > 0) {
|
|
8152
|
+
preDragRef.current = {
|
|
8153
|
+
features: collectHistoryFeatures(),
|
|
8154
|
+
layers: collectHistoryLayers(),
|
|
8155
|
+
selectedIds: [...selectedFeatureIdsRef.current]
|
|
8156
|
+
};
|
|
8157
|
+
}
|
|
8158
|
+
});
|
|
7809
8159
|
mapInstance.on("draw.create", (e) => {
|
|
7810
8160
|
justCreatedFeatureRef.current = true;
|
|
7811
8161
|
setTimeout(() => {
|
|
@@ -7895,7 +8245,9 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
7895
8245
|
}
|
|
7896
8246
|
updateFeatureCount();
|
|
7897
8247
|
scheduleTimelineUpdate();
|
|
7898
|
-
saveStateForUndo(
|
|
8248
|
+
saveStateForUndo("draw feature", {
|
|
8249
|
+
excludeDrawIds: new Set(newFeatures.map((f) => String(f.id)))
|
|
8250
|
+
});
|
|
7899
8251
|
syncRef.current();
|
|
7900
8252
|
setTimeout(() => {
|
|
7901
8253
|
setActiveMode("simple_select");
|
|
@@ -7952,7 +8304,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
7952
8304
|
syncRef.current();
|
|
7953
8305
|
if (e.action === "change_coordinates" && !hasRevertedFeatures) {
|
|
7954
8306
|
scheduleTimelineUpdate();
|
|
7955
|
-
|
|
8307
|
+
recordMoveFromPreDrag();
|
|
7956
8308
|
}
|
|
7957
8309
|
});
|
|
7958
8310
|
mapInstance.on("draw.delete", (e) => {
|
|
@@ -7968,7 +8320,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
7968
8320
|
});
|
|
7969
8321
|
updateFeatureCount();
|
|
7970
8322
|
scheduleTimelineUpdate();
|
|
7971
|
-
saveStateForUndo();
|
|
8323
|
+
saveStateForUndo("delete feature", { addDrawFeatures: e.features });
|
|
7972
8324
|
syncRef.current();
|
|
7973
8325
|
onFeatureDelete == null ? void 0 : onFeatureDelete(deletedIds);
|
|
7974
8326
|
});
|
|
@@ -8285,6 +8637,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
8285
8637
|
listLayers: () => [...layersRef.current],
|
|
8286
8638
|
addLayer: (name, geojson, options) => {
|
|
8287
8639
|
if (!isMapLoadedRef.current) return "";
|
|
8640
|
+
if (options == null ? void 0 : options.recordHistory) saveStateForUndo(`add layer "${name}"`);
|
|
8288
8641
|
const layerId = `layer-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
8289
8642
|
const newLayer = {
|
|
8290
8643
|
id: layerId,
|
|
@@ -8377,9 +8730,10 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
8377
8730
|
}
|
|
8378
8731
|
return newLayer.id;
|
|
8379
8732
|
},
|
|
8380
|
-
removeLayer: (layerId) => {
|
|
8733
|
+
removeLayer: (layerId, options) => {
|
|
8381
8734
|
const layer = layersRef.current.find((l) => l.id === layerId);
|
|
8382
8735
|
if (!layer || !isMapLoadedRef.current) return false;
|
|
8736
|
+
if (options == null ? void 0 : options.recordHistory) saveStateForUndo(`remove layer "${layer.name}"`);
|
|
8383
8737
|
if (draw.current && !layer.readOnly) {
|
|
8384
8738
|
layer.featureIds.forEach((id) => {
|
|
8385
8739
|
try {
|
|
@@ -8456,10 +8810,11 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
8456
8810
|
syncRef.current();
|
|
8457
8811
|
});
|
|
8458
8812
|
},
|
|
8459
|
-
addFeatures: (layerId, features) => {
|
|
8813
|
+
addFeatures: (layerId, features, options) => {
|
|
8460
8814
|
var _a;
|
|
8461
8815
|
const layer = layersRef.current.find((l) => l.id === layerId);
|
|
8462
8816
|
if (!layer || !isMapLoadedRef.current) return [];
|
|
8817
|
+
if (options == null ? void 0 : options.recordHistory) saveStateForUndo("add features");
|
|
8463
8818
|
if (layer.readOnly) {
|
|
8464
8819
|
const existing = readOnlyFeatures.current.get(layerId) || [];
|
|
8465
8820
|
let layerHasTemporal = ((_a = layerTemporalCacheRef.current.get(layerId)) == null ? void 0 : _a.hasTemporal) ?? false;
|
|
@@ -8529,8 +8884,9 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
8529
8884
|
syncFeaturesToCustomLayers();
|
|
8530
8885
|
return addedIds;
|
|
8531
8886
|
},
|
|
8532
|
-
removeFeatures: (featureIds) => {
|
|
8887
|
+
removeFeatures: (featureIds, options) => {
|
|
8533
8888
|
if (!isMapLoaded) return;
|
|
8889
|
+
if (options == null ? void 0 : options.recordHistory) saveStateForUndo("remove features");
|
|
8534
8890
|
const idSet = new Set(featureIds);
|
|
8535
8891
|
if (draw.current) {
|
|
8536
8892
|
featureIds.forEach((id) => {
|
|
@@ -8906,6 +9262,13 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
8906
9262
|
end: ts.rangeEnd
|
|
8907
9263
|
};
|
|
8908
9264
|
},
|
|
9265
|
+
// --- Undo / redo (also driven by the toolbar buttons + Ctrl/Cmd+Z) ---
|
|
9266
|
+
undo: () => history.undo(),
|
|
9267
|
+
redo: () => history.redo(),
|
|
9268
|
+
canUndo: () => history.canUndo,
|
|
9269
|
+
canRedo: () => history.canRedo,
|
|
9270
|
+
clearHistory: () => history.clear(),
|
|
9271
|
+
pushHistory: (command) => history.push(command),
|
|
8909
9272
|
getMapUnsavedCount: () => {
|
|
8910
9273
|
if (!draw.current) return 0;
|
|
8911
9274
|
const allFeatures = draw.current.getAll().features;
|
|
@@ -8929,7 +9292,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
8929
9292
|
var _a;
|
|
8930
9293
|
(_a = restoreEnrichedGeoJSONRef.current) == null ? void 0 : _a.call(restoreEnrichedGeoJSONRef, enriched);
|
|
8931
9294
|
}
|
|
8932
|
-
}), [layers, isEditMode, isMapLoaded, getSelectedFeatures, updateFeatureCount, scheduleTimelineUpdate, syncFeaturesToCustomLayers, onFeatureDelete, onTimelineChange, activeEditingLayerId, currentMapStyle, activeMode]);
|
|
9295
|
+
}), [layers, isEditMode, isMapLoaded, getSelectedFeatures, updateFeatureCount, scheduleTimelineUpdate, syncFeaturesToCustomLayers, onFeatureDelete, onTimelineChange, activeEditingLayerId, currentMapStyle, activeMode, saveStateForUndo, history]);
|
|
8933
9296
|
const handleModeChange = useCallback((mode) => {
|
|
8934
9297
|
if (!draw.current || !isMapLoaded) return;
|
|
8935
9298
|
if (!hasVisibleLayers && mode !== "simple_select" && mode !== "view_select") {
|
|
@@ -8965,60 +9328,6 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
8965
9328
|
setActiveMode(mode);
|
|
8966
9329
|
draw.current.changeMode(mode);
|
|
8967
9330
|
}, [isMapLoaded, hasVisibleLayers, toast]);
|
|
8968
|
-
const handleUndo = useCallback(() => {
|
|
8969
|
-
if (undoStack.length === 0 || !draw.current) return;
|
|
8970
|
-
const currentState = {
|
|
8971
|
-
features: draw.current.getAll().features,
|
|
8972
|
-
layers: JSON.parse(JSON.stringify(layers)),
|
|
8973
|
-
selectedIds: [...selectedFeatureIds]
|
|
8974
|
-
};
|
|
8975
|
-
const prevState = undoStack[undoStack.length - 1];
|
|
8976
|
-
isSelectingReadOnlyRef.current = true;
|
|
8977
|
-
draw.current.deleteAll();
|
|
8978
|
-
isApiAddingRef.current = true;
|
|
8979
|
-
try {
|
|
8980
|
-
prevState.features.forEach((f) => draw.current.add(f));
|
|
8981
|
-
} finally {
|
|
8982
|
-
isApiAddingRef.current = false;
|
|
8983
|
-
}
|
|
8984
|
-
setLayers(prevState.layers);
|
|
8985
|
-
applySelectionState(prevState.selectedIds, { focusProperties: false });
|
|
8986
|
-
setUndoStack((prev) => prev.slice(0, -1));
|
|
8987
|
-
setRedoStack((prev) => [...prev, currentState]);
|
|
8988
|
-
updateFeatureCount();
|
|
8989
|
-
layerTemporalCacheRef.current.clear();
|
|
8990
|
-
scheduleTimelineUpdate();
|
|
8991
|
-
syncFeaturesToCustomLayers();
|
|
8992
|
-
layersRef.current = prevState.layers;
|
|
8993
|
-
onUndo == null ? void 0 : onUndo(computeUndoRedoEvent(currentState, prevState));
|
|
8994
|
-
}, [undoStack, layers, selectedFeatureIds, updateFeatureCount, scheduleTimelineUpdate, syncFeaturesToCustomLayers, applySelectionState, onUndo]);
|
|
8995
|
-
const handleRedo = useCallback(() => {
|
|
8996
|
-
if (redoStack.length === 0 || !draw.current) return;
|
|
8997
|
-
const currentState = {
|
|
8998
|
-
features: draw.current.getAll().features,
|
|
8999
|
-
layers: JSON.parse(JSON.stringify(layers)),
|
|
9000
|
-
selectedIds: [...selectedFeatureIds]
|
|
9001
|
-
};
|
|
9002
|
-
const nextState = redoStack[redoStack.length - 1];
|
|
9003
|
-
isSelectingReadOnlyRef.current = true;
|
|
9004
|
-
draw.current.deleteAll();
|
|
9005
|
-
isApiAddingRef.current = true;
|
|
9006
|
-
try {
|
|
9007
|
-
nextState.features.forEach((f) => draw.current.add(f));
|
|
9008
|
-
} finally {
|
|
9009
|
-
isApiAddingRef.current = false;
|
|
9010
|
-
}
|
|
9011
|
-
setLayers(nextState.layers);
|
|
9012
|
-
applySelectionState(nextState.selectedIds, { focusProperties: false });
|
|
9013
|
-
setRedoStack((prev) => prev.slice(0, -1));
|
|
9014
|
-
setUndoStack((prev) => [...prev, currentState]);
|
|
9015
|
-
updateFeatureCount();
|
|
9016
|
-
layerTemporalCacheRef.current.clear();
|
|
9017
|
-
scheduleTimelineUpdate();
|
|
9018
|
-
syncFeaturesToCustomLayers();
|
|
9019
|
-
layersRef.current = nextState.layers;
|
|
9020
|
-
onRedo == null ? void 0 : onRedo(computeUndoRedoEvent(currentState, nextState));
|
|
9021
|
-
}, [redoStack, layers, selectedFeatureIds, updateFeatureCount, scheduleTimelineUpdate, syncFeaturesToCustomLayers, applySelectionState, onRedo]);
|
|
9022
9331
|
const handleClear = useCallback(() => {
|
|
9023
9332
|
if (!draw.current) return;
|
|
9024
9333
|
const activeLayer = layersRef.current.find((l) => l.id === activeEditingLayerId);
|
|
@@ -9161,12 +9470,12 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
9161
9470
|
const isCtrlOrCmd = e.ctrlKey || e.metaKey;
|
|
9162
9471
|
if (isCtrlOrCmd && key === "z" && !e.shiftKey) {
|
|
9163
9472
|
e.preventDefault();
|
|
9164
|
-
|
|
9473
|
+
history.undo();
|
|
9165
9474
|
return;
|
|
9166
9475
|
}
|
|
9167
9476
|
if (isCtrlOrCmd && (key === "y" || key === "z" && e.shiftKey)) {
|
|
9168
9477
|
e.preventDefault();
|
|
9169
|
-
|
|
9478
|
+
history.redo();
|
|
9170
9479
|
return;
|
|
9171
9480
|
}
|
|
9172
9481
|
if (key === "e" && !isCtrlOrCmd && !e.altKey) {
|
|
@@ -9218,7 +9527,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
9218
9527
|
};
|
|
9219
9528
|
container.addEventListener("keydown", handleKeyDown);
|
|
9220
9529
|
return () => container.removeEventListener("keydown", handleKeyDown);
|
|
9221
|
-
}, [isMapLoaded, enableKeyboardShortcuts, isEditMode, activeMode, handleToggleEditMode,
|
|
9530
|
+
}, [isMapLoaded, enableKeyboardShortcuts, isEditMode, activeMode, handleToggleEditMode, history, handleModeChange, selectedFeatureIds, handleDeleteSelected, canDeleteSelected, hiddenDrawingTools]);
|
|
9222
9531
|
const createPointAtCoords = useCallback((lng, lat) => {
|
|
9223
9532
|
if (!draw.current || !isMapLoaded) return;
|
|
9224
9533
|
if (!isEditModeRef.current) {
|
|
@@ -10002,30 +10311,35 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
10002
10311
|
}, [loadBasemapStyle, setBasemapVisibility, moveLabelsBeforeBasemapSymbols]);
|
|
10003
10312
|
handleMapStyleChangeRef.current = handleMapStyleChange;
|
|
10004
10313
|
const handleUpdateTraceConfig = useCallback((layerId, config) => {
|
|
10314
|
+
saveStateForUndo("trace config", { coalesceKey: `traceConfig:${layerId}` });
|
|
10005
10315
|
setLayers((prev) => prev.map(
|
|
10006
10316
|
(l) => l.id === layerId ? { ...l, traceConfig: config } : l
|
|
10007
10317
|
));
|
|
10008
|
-
}, []);
|
|
10318
|
+
}, [saveStateForUndo]);
|
|
10009
10319
|
const handleUpdateHeatmapConfig = useCallback((layerId, config) => {
|
|
10320
|
+
saveStateForUndo("heatmap config", { coalesceKey: `heatmapConfig:${layerId}` });
|
|
10010
10321
|
setLayers((prev) => prev.map(
|
|
10011
10322
|
(l) => l.id === layerId ? { ...l, heatmapConfig: config } : l
|
|
10012
10323
|
));
|
|
10013
|
-
}, []);
|
|
10324
|
+
}, [saveStateForUndo]);
|
|
10014
10325
|
const handleUpdateClusterConfig = useCallback((layerId, config) => {
|
|
10326
|
+
saveStateForUndo("cluster config", { coalesceKey: `clusterConfig:${layerId}` });
|
|
10015
10327
|
setLayers((prev) => prev.map(
|
|
10016
10328
|
(l) => l.id === layerId ? { ...l, clusterConfig: config } : l
|
|
10017
10329
|
));
|
|
10018
|
-
}, []);
|
|
10330
|
+
}, [saveStateForUndo]);
|
|
10019
10331
|
const handleUpdateVisualConfig = useCallback((layerId, config) => {
|
|
10332
|
+
saveStateForUndo("style config", { coalesceKey: `visualConfig:${layerId}` });
|
|
10020
10333
|
setLayers((prev) => prev.map(
|
|
10021
10334
|
(l) => l.id === layerId ? { ...l, visualConfig: config } : l
|
|
10022
10335
|
));
|
|
10023
|
-
}, []);
|
|
10336
|
+
}, [saveStateForUndo]);
|
|
10024
10337
|
const handleUpdateAltitudeDisplayMode = useCallback((layerId, mode) => {
|
|
10338
|
+
saveStateForUndo("altitude mode", { coalesceKey: `altitude:${layerId}` });
|
|
10025
10339
|
setLayers((prev) => prev.map(
|
|
10026
10340
|
(l) => l.id === layerId ? { ...l, altitudeDisplayMode: mode } : l
|
|
10027
10341
|
));
|
|
10028
|
-
}, []);
|
|
10342
|
+
}, [saveStateForUndo]);
|
|
10029
10343
|
const handleUpdateAutoLabelConfig = useCallback((config) => {
|
|
10030
10344
|
setAutoLabelConfig(config);
|
|
10031
10345
|
}, []);
|
|
@@ -10916,6 +11230,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
10916
11230
|
},
|
|
10917
11231
|
geometry: circle.geometry
|
|
10918
11232
|
};
|
|
11233
|
+
saveStateForUndo("draw circle");
|
|
10919
11234
|
drawInstance.add(circleFeature);
|
|
10920
11235
|
const currentActiveEditingLayerId = activeEditingLayerIdRef.current;
|
|
10921
11236
|
setLayers((prev) => {
|
|
@@ -10931,12 +11246,6 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
10931
11246
|
syncFeaturesToCustomLayers();
|
|
10932
11247
|
const newCount = drawInstance.getAll().features.length;
|
|
10933
11248
|
setFeatureCount(newCount);
|
|
10934
|
-
setUndoStack((prev) => [...prev, {
|
|
10935
|
-
features: drawInstance.getAll().features,
|
|
10936
|
-
selectedIds: [featureId],
|
|
10937
|
-
layers: layersRef.current
|
|
10938
|
-
}]);
|
|
10939
|
-
setRedoStack([]);
|
|
10940
11249
|
drawInstance.changeMode("simple_select", { featureIds: [featureId] });
|
|
10941
11250
|
setActiveMode("simple_select");
|
|
10942
11251
|
setSelectedFeatureIds([featureId]);
|
|
@@ -11043,6 +11352,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
11043
11352
|
coordinates: [rectCoords]
|
|
11044
11353
|
}
|
|
11045
11354
|
};
|
|
11355
|
+
saveStateForUndo("draw rectangle");
|
|
11046
11356
|
drawInstance.add(rectFeature);
|
|
11047
11357
|
const currentActiveEditingLayerId = activeEditingLayerIdRef.current;
|
|
11048
11358
|
setLayers((prev) => {
|
|
@@ -11058,12 +11368,6 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
11058
11368
|
syncFeaturesToCustomLayers();
|
|
11059
11369
|
const newCount = drawInstance.getAll().features.length;
|
|
11060
11370
|
setFeatureCount(newCount);
|
|
11061
|
-
setUndoStack((prev) => [...prev, {
|
|
11062
|
-
features: drawInstance.getAll().features,
|
|
11063
|
-
selectedIds: [featureId],
|
|
11064
|
-
layers: layersRef.current
|
|
11065
|
-
}]);
|
|
11066
|
-
setRedoStack([]);
|
|
11067
11371
|
justCreatedRectangleRef.current = true;
|
|
11068
11372
|
drawInstance.changeMode("simple_select", { featureIds: [featureId] });
|
|
11069
11373
|
setActiveMode("simple_select");
|
|
@@ -12500,13 +12804,14 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
12500
12804
|
onModeChange: handleModeChange,
|
|
12501
12805
|
onClear: handleClear,
|
|
12502
12806
|
onDeleteSelected: handleDeleteSelected,
|
|
12503
|
-
onUndo:
|
|
12504
|
-
onRedo:
|
|
12807
|
+
onUndo: history.undo,
|
|
12808
|
+
onRedo: history.redo,
|
|
12505
12809
|
featureCount,
|
|
12506
12810
|
selectedCount: selectedFeatureIds.length,
|
|
12507
12811
|
canDeleteSelected,
|
|
12508
|
-
canUndo:
|
|
12509
|
-
canRedo:
|
|
12812
|
+
canUndo: history.canUndo,
|
|
12813
|
+
canRedo: history.canRedo,
|
|
12814
|
+
showUndoRedo: true,
|
|
12510
12815
|
disabled: !isMapLoaded,
|
|
12511
12816
|
isEditMode,
|
|
12512
12817
|
onToggleEditMode: handleToggleEditMode,
|