terra-draw 1.25.1 → 1.26.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/common.d.ts +1 -0
- package/dist/modes/base.behavior.d.ts +3 -1
- package/dist/modes/base.mode.d.ts +5 -0
- package/dist/modes/linestring/linestring.mode.d.ts +8 -0
- package/dist/modes/mutate-feature.behavior.d.ts +0 -1
- package/dist/modes/polygon/polygon.mode.d.ts +8 -0
- package/dist/modes/undo-redo.behavior.d.ts +33 -0
- package/dist/modes/undo-redo.behavior.spec.d.ts +1 -0
- package/dist/store/store.d.ts +1 -1
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- package/dist/terra-draw.d.ts +26 -1
- package/dist/terra-draw.modern.js +1 -1
- package/dist/terra-draw.modern.js.map +1 -1
- package/dist/terra-draw.module.js +1 -1
- package/dist/terra-draw.module.js.map +1 -1
- package/dist/terra-draw.umd.js +1 -1
- package/dist/terra-draw.umd.js.map +1 -1
- package/dist/undo-redo/keyboard-shortcuts.d.ts +21 -0
- package/dist/undo-redo/keyboard-shortcuts.spec.d.ts +1 -0
- package/dist/undo-redo/mode-undo-redo.d.ts +65 -0
- package/dist/undo-redo/mode-undo-redo.spec.d.ts +1 -0
- package/dist/undo-redo/normalise-stack-size.d.ts +1 -0
- package/dist/undo-redo/normalise-stack-size.spec.d.ts +1 -0
- package/dist/undo-redo/session-undo-redo.d.ts +35 -0
- package/dist/undo-redo/session-undo-redo.spec.d.ts +1 -0
- package/dist/undo-redo/undo-redo-coordinator.d.ts +29 -0
- package/dist/undo-redo/undo-redo-coordinator.spec.d.ts +1 -0
- package/dist/undo-redo/undo-redo-types.d.ts +34 -0
- package/package.json +1 -1
package/dist/common.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type BehaviorConfig = {
|
|
|
7
7
|
pointerDistance: number;
|
|
8
8
|
coordinatePrecision: number;
|
|
9
9
|
projection: Projection;
|
|
10
|
+
undoRedoMaxStackSize?: number;
|
|
10
11
|
};
|
|
11
12
|
export declare class TerraDrawModeBehavior {
|
|
12
13
|
protected store: TerraDrawGeoJSONStore;
|
|
@@ -16,5 +17,6 @@ export declare class TerraDrawModeBehavior {
|
|
|
16
17
|
protected pointerDistance: number;
|
|
17
18
|
protected coordinatePrecision: number;
|
|
18
19
|
protected projection: Projection;
|
|
19
|
-
|
|
20
|
+
protected undoRedoMaxStackSize?: number;
|
|
21
|
+
constructor({ store, mode, project, unproject, pointerDistance, coordinatePrecision, projection, undoRedoMaxStackSize, }: BehaviorConfig);
|
|
20
22
|
}
|
|
@@ -46,6 +46,7 @@ export declare abstract class TerraDrawBaseDrawMode<Styling extends CustomStylin
|
|
|
46
46
|
protected validate: Validation | undefined;
|
|
47
47
|
protected pointerDistance: number;
|
|
48
48
|
protected coordinatePrecision: number;
|
|
49
|
+
protected undoRedoMaxStackSize?: number;
|
|
49
50
|
protected onStyleChange: StoreChangeHandler<TerraDrawOnChangeContext | undefined>;
|
|
50
51
|
protected store: TerraDrawGeoJSONStore;
|
|
51
52
|
protected projection: Projection;
|
|
@@ -78,6 +79,10 @@ export declare abstract class TerraDrawBaseDrawMode<Styling extends CustomStylin
|
|
|
78
79
|
onSelect(selectedId: FeatureId): void;
|
|
79
80
|
onKeyDown(event: TerraDrawKeyboardEvent): void;
|
|
80
81
|
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
82
|
+
undo(): void;
|
|
83
|
+
undoSize(): number;
|
|
84
|
+
redoSize(): number;
|
|
85
|
+
redo(): void;
|
|
81
86
|
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
82
87
|
onClick(event: TerraDrawMouseEvent): void;
|
|
83
88
|
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
@@ -78,6 +78,7 @@ export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineS
|
|
|
78
78
|
private readFeature;
|
|
79
79
|
private closingPoints;
|
|
80
80
|
private coordinatePoints;
|
|
81
|
+
private undoRedo;
|
|
81
82
|
constructor(options?: TerraDrawLineStringModeOptions<LineStringStyling>);
|
|
82
83
|
updateOptions(options?: ModeUpdateOptions<TerraDrawLineStringModeOptions<LineStringStyling>>): void;
|
|
83
84
|
private shouldFinishOnCommit;
|
|
@@ -87,6 +88,13 @@ export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineS
|
|
|
87
88
|
private createLine;
|
|
88
89
|
private firstUpdateToLine;
|
|
89
90
|
private updateToLine;
|
|
91
|
+
undoSize(): number;
|
|
92
|
+
private pushHistorySnapshot;
|
|
93
|
+
private updateSnappedGuidancePointFromLastMouseMove;
|
|
94
|
+
private syncClosingPoints;
|
|
95
|
+
undo(): void;
|
|
96
|
+
redoSize(): number;
|
|
97
|
+
redo(): void;
|
|
90
98
|
/** @internal */
|
|
91
99
|
registerBehaviors(config: BehaviorConfig): void;
|
|
92
100
|
/** @internal */
|
|
@@ -104,7 +104,6 @@ export declare class MutateFeatureBehavior extends TerraDrawModeBehavior {
|
|
|
104
104
|
}[]): void;
|
|
105
105
|
private handleCreateFeature;
|
|
106
106
|
private handleMutateFeature;
|
|
107
|
-
epsilonOffset(): number;
|
|
108
107
|
private mutateFeature;
|
|
109
108
|
private applyCoordinateMutations;
|
|
110
109
|
private isReplaceMutation;
|
|
@@ -77,6 +77,7 @@ export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonS
|
|
|
77
77
|
private clickBoundingBox;
|
|
78
78
|
private mutateFeature;
|
|
79
79
|
private readFeature;
|
|
80
|
+
private undoRedo;
|
|
80
81
|
constructor(options?: TerraDrawPolygonModeOptions<PolygonStyling>);
|
|
81
82
|
updateOptions(options?: ModeUpdateOptions<TerraDrawPolygonModeOptions<PolygonStyling>>): void;
|
|
82
83
|
private close;
|
|
@@ -87,6 +88,13 @@ export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonS
|
|
|
87
88
|
/** @internal */
|
|
88
89
|
stop(): void;
|
|
89
90
|
private updateSnappedCoordinate;
|
|
91
|
+
undoSize(): number;
|
|
92
|
+
private pushHistorySnapshot;
|
|
93
|
+
private updateSnappedGuidancePointFromLastMouseMove;
|
|
94
|
+
private syncClosingPoints;
|
|
95
|
+
undo(): void;
|
|
96
|
+
redoSize(): number;
|
|
97
|
+
redo(): void;
|
|
90
98
|
/** @internal */
|
|
91
99
|
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
92
100
|
private snapCoordinate;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
type UndoRedoHistoryEntry<Coordinates> = {
|
|
2
|
+
featureCoordinates: Coordinates;
|
|
3
|
+
currentCoordinate: number;
|
|
4
|
+
};
|
|
5
|
+
type UndoStepResult<Coordinates> = {
|
|
6
|
+
undoneEntry: UndoRedoHistoryEntry<Coordinates>;
|
|
7
|
+
previousEntry: UndoRedoHistoryEntry<Coordinates> | undefined;
|
|
8
|
+
};
|
|
9
|
+
type UndoRedoBehaviorOptions = {
|
|
10
|
+
maxStackSize?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare class UndoRedoBehavior<Coordinates> {
|
|
13
|
+
private undoHistory;
|
|
14
|
+
private redoHistory;
|
|
15
|
+
private cloneCoordinatesFunction;
|
|
16
|
+
private maxStackSize;
|
|
17
|
+
constructor(options?: UndoRedoBehaviorOptions);
|
|
18
|
+
setMaxStackSize(maxStackSize: number): void;
|
|
19
|
+
private trimHistoryToMax;
|
|
20
|
+
private pushUndoEntry;
|
|
21
|
+
private pushRedoEntry;
|
|
22
|
+
private cloneRecursively;
|
|
23
|
+
cloneCoordinates(coordinates: Coordinates): Coordinates;
|
|
24
|
+
private cloneEntry;
|
|
25
|
+
clear(): void;
|
|
26
|
+
undoSize(): number;
|
|
27
|
+
redoSize(): number;
|
|
28
|
+
recordSnapshot(entry: UndoRedoHistoryEntry<Coordinates>): void;
|
|
29
|
+
beginUndo(): UndoStepResult<Coordinates> | undefined;
|
|
30
|
+
takeRedo(): UndoRedoHistoryEntry<Coordinates> | undefined;
|
|
31
|
+
commitRedo(entry: UndoRedoHistoryEntry<Coordinates>): void;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/store/store.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export declare class GeoJSONStore<OnChangeContext extends JSONObject | undefined
|
|
|
59
59
|
copy(id: FeatureId): GeoJSONStoreFeatures;
|
|
60
60
|
copyAll(): GeoJSONStoreFeatures[];
|
|
61
61
|
copyAllWhere(equals: (properties: JSONObject) => boolean): GeoJSONStoreFeatures[];
|
|
62
|
-
clear(): void;
|
|
62
|
+
clear(context: OnChangeContext): void;
|
|
63
63
|
size(): number;
|
|
64
64
|
}
|
|
65
65
|
export {};
|