terra-draw 1.30.1 → 1.31.1
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 -1
- package/dist/modes/base.mode.spec.d.ts +1 -0
- package/dist/modes/mutate-feature.behavior.d.ts +8 -4
- package/dist/modes/polyline/polyline.mode.d.ts +92 -0
- package/dist/modes/polyline/polyline.mode.spec.d.ts +1 -0
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- package/dist/terra-draw.d.ts +2 -1
- package/dist/terra-draw.extensions.spec.d.ts +1 -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/package.json +1 -1
package/dist/common.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export interface TerraDrawKeyboardEvent {
|
|
|
45
45
|
preventDefault: () => void;
|
|
46
46
|
}
|
|
47
47
|
export type Cursor = Parameters<SetCursor>[0];
|
|
48
|
-
export type SetCursor = (cursor: "
|
|
48
|
+
export type SetCursor = (cursor: "alias" | "all-scroll" | "auto" | "cell" | "col-resize" | "context-menu" | "copy" | "crosshair" | "default" | "e-resize" | "ew-resize" | "grab" | "grabbing" | "help" | "move" | "n-resize" | "ne-resize" | "nesw-resize" | "no-drop" | "none" | "not-allowed" | "ns-resize" | "nw-resize" | "nwse-resize" | "pointer" | "progress" | "row-resize" | "s-resize" | "se-resize" | "sw-resize" | "text" | "unset" | "vertical-text" | "w-resize" | "wait" | "zoom-in" | "zoom-out") => void;
|
|
49
49
|
export type Project = (lng: number, lat: number) => CartesianPoint;
|
|
50
50
|
export type Unproject = (x: number, y: number) => {
|
|
51
51
|
lat: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -76,12 +76,16 @@ export declare class MutateFeatureBehavior extends TerraDrawModeBehavior {
|
|
|
76
76
|
createPolygon({ coordinates, properties, }: {
|
|
77
77
|
coordinates: Polygon["coordinates"][0];
|
|
78
78
|
properties: JSONObject;
|
|
79
|
-
}): GeoJSONStoreFeatures<{
|
|
80
|
-
type: "Polygon";
|
|
81
|
-
coordinates: Position[][];
|
|
82
|
-
}> & {
|
|
79
|
+
}): GeoJSONStoreFeatures<Polygon> & {
|
|
83
80
|
id: FeatureId;
|
|
84
81
|
};
|
|
82
|
+
createPolygon({ coordinates, properties, context, }: {
|
|
83
|
+
coordinates: Polygon["coordinates"][0];
|
|
84
|
+
properties: JSONObject;
|
|
85
|
+
context: FinishContext;
|
|
86
|
+
}): (GeoJSONStoreFeatures<Polygon> & {
|
|
87
|
+
id: FeatureId;
|
|
88
|
+
}) | undefined;
|
|
85
89
|
createGuidancePoint({ coordinate, type, }: {
|
|
86
90
|
coordinate: Position;
|
|
87
91
|
type: GuidancePointProperties;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { TerraDrawAdapterStyling, TerraDrawKeyboardEvent, TerraDrawMouseEvent, HexColorStyling, NumericStyling, Cursor, Snapping } from "../../common";
|
|
2
|
+
import { BaseModeOptions, CustomStyling, ModeUpdateOptions, TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
+
import { BehaviorConfig } from "../base.behavior";
|
|
4
|
+
import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
|
|
5
|
+
type TerraDrawPolyLineModeKeyEvents = {
|
|
6
|
+
cancel: KeyboardEvent["key"] | null;
|
|
7
|
+
finish: KeyboardEvent["key"] | null;
|
|
8
|
+
};
|
|
9
|
+
type PolyLineStyling = {
|
|
10
|
+
lineStringWidth: NumericStyling;
|
|
11
|
+
lineStringColor: HexColorStyling;
|
|
12
|
+
lineStringOpacity: NumericStyling;
|
|
13
|
+
polygonFillColor: HexColorStyling;
|
|
14
|
+
polygonFillOpacity: NumericStyling;
|
|
15
|
+
polygonOutlineColor: HexColorStyling;
|
|
16
|
+
polygonOutlineWidth: NumericStyling;
|
|
17
|
+
polygonOutlineOpacity: NumericStyling;
|
|
18
|
+
closingPointColor: HexColorStyling;
|
|
19
|
+
closingPointWidth: NumericStyling;
|
|
20
|
+
closingPointOpacity: NumericStyling;
|
|
21
|
+
closingPointOutlineColor: HexColorStyling;
|
|
22
|
+
closingPointOutlineWidth: NumericStyling;
|
|
23
|
+
closingPointOutlineOpacity: NumericStyling;
|
|
24
|
+
snappingPointColor: HexColorStyling;
|
|
25
|
+
snappingPointWidth: NumericStyling;
|
|
26
|
+
snappingPointOpacity: NumericStyling;
|
|
27
|
+
snappingPointOutlineColor: HexColorStyling;
|
|
28
|
+
snappingPointOutlineWidth: NumericStyling;
|
|
29
|
+
snappingPointOutlineOpacity: NumericStyling;
|
|
30
|
+
};
|
|
31
|
+
interface Cursors {
|
|
32
|
+
start?: Cursor;
|
|
33
|
+
close?: Cursor;
|
|
34
|
+
}
|
|
35
|
+
interface TerraDrawPolyLineModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
36
|
+
snapping?: Snapping;
|
|
37
|
+
keyEvents?: TerraDrawPolyLineModeKeyEvents | null;
|
|
38
|
+
cursors?: Cursors;
|
|
39
|
+
}
|
|
40
|
+
export declare class TerraDrawPolyLineMode extends TerraDrawBaseDrawMode<PolyLineStyling> {
|
|
41
|
+
mode: string;
|
|
42
|
+
private currentCoordinate;
|
|
43
|
+
private currentId;
|
|
44
|
+
private keyEvents;
|
|
45
|
+
private cursors;
|
|
46
|
+
private mouseMove;
|
|
47
|
+
private snapping;
|
|
48
|
+
private snappedPointId;
|
|
49
|
+
private mutateFeature;
|
|
50
|
+
private readFeature;
|
|
51
|
+
private pixelDistance;
|
|
52
|
+
private closingPoints;
|
|
53
|
+
private clickBoundingBox;
|
|
54
|
+
private lineSnapping;
|
|
55
|
+
private coordinateSnapping;
|
|
56
|
+
constructor(options?: TerraDrawPolyLineModeOptions<PolyLineStyling>);
|
|
57
|
+
updateOptions(options?: ModeUpdateOptions<TerraDrawPolyLineModeOptions<PolyLineStyling>>): void;
|
|
58
|
+
/** @internal */
|
|
59
|
+
registerBehaviors(config: BehaviorConfig): void;
|
|
60
|
+
/** @internal */
|
|
61
|
+
start(): void;
|
|
62
|
+
/** @internal */
|
|
63
|
+
stop(): void;
|
|
64
|
+
private finishLine;
|
|
65
|
+
private toPolygonLikeCoordinates;
|
|
66
|
+
private closeAsPolygon;
|
|
67
|
+
/** @internal */
|
|
68
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
69
|
+
private onLeftClick;
|
|
70
|
+
/** @internal */
|
|
71
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
72
|
+
/** @internal */
|
|
73
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
74
|
+
/** @internal */
|
|
75
|
+
onKeyDown(): void;
|
|
76
|
+
/** @internal */
|
|
77
|
+
onDragStart(): void;
|
|
78
|
+
/** @internal */
|
|
79
|
+
onDrag(): void;
|
|
80
|
+
/** @internal */
|
|
81
|
+
onDragEnd(): void;
|
|
82
|
+
/** @internal */
|
|
83
|
+
cleanUp(): void;
|
|
84
|
+
private updateSnappedCoordinate;
|
|
85
|
+
private snapCoordinate;
|
|
86
|
+
/** @internal */
|
|
87
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
88
|
+
afterFeatureAdded(_feature: GeoJSONStoreFeatures): void;
|
|
89
|
+
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
|
90
|
+
validateFeature(feature: unknown): StoreValidation;
|
|
91
|
+
}
|
|
92
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|