json import export project | UI cleaner | binding geometry to each other
This commit is contained in:
@@ -4,6 +4,9 @@ import type {
|
||||
Geometry,
|
||||
GeometryChange,
|
||||
} from "@/uhm/types/geo";
|
||||
import type { EntitySnapshot } from "@/uhm/types/entities";
|
||||
import type { WikiSnapshot } from "@/uhm/types/wiki";
|
||||
import type { EntityWikiLinkSnapshot } from "@/uhm/types/sections";
|
||||
|
||||
export type Change = GeometryChange;
|
||||
|
||||
@@ -11,5 +14,8 @@ export type UndoAction =
|
||||
| { type: "update"; id: FeatureProperties["id"]; prevGeometry: Geometry }
|
||||
| { type: "properties"; id: FeatureProperties["id"]; prevProperties: FeatureProperties }
|
||||
| { type: "delete"; feature: Feature }
|
||||
| { type: "create"; id: FeatureProperties["id"] };
|
||||
|
||||
| { type: "create"; id: FeatureProperties["id"] }
|
||||
// Snapshot-scoped undo (affects commit snapshot but not GeoJSON draft directly)
|
||||
| { type: "snapshot_entities"; label: string; prev: EntitySnapshot[] }
|
||||
| { type: "snapshot_wikis"; label: string; prev: WikiSnapshot[] }
|
||||
| { type: "snapshot_entity_wiki"; label: string; prev: EntityWikiLinkSnapshot[] };
|
||||
|
||||
@@ -75,6 +75,18 @@ function isSameUndo(a: UndoAction | undefined, b: UndoAction) {
|
||||
JSON.stringify(a.prevProperties) === JSON.stringify(next.prevProperties)
|
||||
);
|
||||
}
|
||||
case "snapshot_entities": {
|
||||
const next = b as Extract<UndoAction, { type: "snapshot_entities" }>;
|
||||
return a.label === next.label && JSON.stringify(a.prev) === JSON.stringify(next.prev);
|
||||
}
|
||||
case "snapshot_wikis": {
|
||||
const next = b as Extract<UndoAction, { type: "snapshot_wikis" }>;
|
||||
return a.label === next.label && JSON.stringify(a.prev) === JSON.stringify(next.prev);
|
||||
}
|
||||
case "snapshot_entity_wiki": {
|
||||
const next = b as Extract<UndoAction, { type: "snapshot_entity_wiki" }>;
|
||||
return a.label === next.label && JSON.stringify(a.prev) === JSON.stringify(next.prev);
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user