terra-draw 0.0.1-alpha.51 → 0.0.1-alpha.54
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/README.md +2 -2
- package/dist/adapters/arcgis-maps-sdk.adapter.d.ts +105 -0
- package/dist/adapters/common/base.adapter.d.ts +13 -6
- package/dist/adapters/google-maps.adapter.d.ts +2 -3
- package/dist/adapters/leaflet.adapter.d.ts +2 -4
- package/dist/adapters/mapbox-gl.adapter.d.ts +2 -3
- package/dist/adapters/maplibre-gl.adapter.d.ts +2 -3
- package/dist/adapters/openlayers.adapter.d.ts +2 -3
- package/dist/common.d.ts +2 -0
- package/dist/modes/base.mode.d.ts +6 -7
- package/dist/modes/circle/circle.mode.d.ts +7 -6
- package/dist/modes/freehand/freehand.mode.d.ts +8 -8
- package/dist/modes/greatcircle/great-circle.mode.d.ts +8 -8
- package/dist/modes/linestring/linestring.mode.d.ts +9 -9
- package/dist/modes/point/point.mode.d.ts +5 -5
- package/dist/modes/polygon/polygon.mode.d.ts +9 -9
- package/dist/modes/rectangle/rectangle.mode.d.ts +6 -6
- package/dist/modes/render/render.mode.d.ts +6 -5
- package/dist/modes/select/select.mode.d.ts +11 -11
- 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.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/e2e/README.md +29 -0
- package/e2e/package-lock.json +3660 -0
- package/e2e/package.json +23 -0
- package/e2e/playwright.config.ts +77 -0
- package/e2e/public/index.html +53 -0
- package/e2e/src/index.ts +151 -0
- package/e2e/tests/leaflet.spec.ts +268 -0
- package/e2e/tests/setup.ts +88 -0
- package/e2e/webpack.config.js +38 -0
- package/jest.nocheck.config.ts +9 -1
- package/package.json +4 -3
- package/tsconfig.json +0 -3
- package/dist/modes/select/behaviors/features-at-mouse-event.behavior.d.ts +0 -15
package/README.md
CHANGED
|
@@ -22,11 +22,11 @@ Terra Draw uses the concept of 'adapters' to allow it to work with a host of dif
|
|
|
22
22
|
|
|
23
23
|
### Getting Started
|
|
24
24
|
|
|
25
|
-
Please see the [the getting started guide](./guides/GETTING_STARTED.md) - this provides a host of information on how to get up and running with Terra Draw.
|
|
25
|
+
Please see the [the getting started guide](./guides/1.GETTING_STARTED.md) - this provides a host of information on how to get up and running with Terra Draw.
|
|
26
26
|
|
|
27
27
|
### Development
|
|
28
28
|
|
|
29
|
-
Please see the [the development documentation](./guides/DEVELOPMENT.md)
|
|
29
|
+
Please see the [the development documentation](./guides/6.DEVELOPMENT.md)
|
|
30
30
|
|
|
31
31
|
### Contributing
|
|
32
32
|
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { SetCursor, TerraDrawCallbacks, TerraDrawChanges, TerraDrawStylingFunction } from "../common";
|
|
2
|
+
import { BaseAdapterConfig, TerraDrawBaseAdapter } from "./common/base.adapter";
|
|
3
|
+
import MapView from "@arcgis/core/views/MapView";
|
|
4
|
+
import Point from "@arcgis/core/geometry/Point";
|
|
5
|
+
import Polyline from "@arcgis/core/geometry/Polyline";
|
|
6
|
+
import Polygon from "@arcgis/core/geometry/Polygon";
|
|
7
|
+
import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer";
|
|
8
|
+
import Graphic from "@arcgis/core/Graphic";
|
|
9
|
+
import SimpleMarkerSymbol from "@arcgis/core/symbols/SimpleMarkerSymbol";
|
|
10
|
+
import SimpleLineSymbol from "@arcgis/core/symbols/SimpleLineSymbol";
|
|
11
|
+
import SimpleFillSymbol from "@arcgis/core/symbols/SimpleFillSymbol";
|
|
12
|
+
import Color from "@arcgis/core/Color";
|
|
13
|
+
type InjectableArcGISMapsSDK = {
|
|
14
|
+
GraphicsLayer: typeof GraphicsLayer;
|
|
15
|
+
Point: typeof Point;
|
|
16
|
+
Polyline: typeof Polyline;
|
|
17
|
+
Polygon: typeof Polygon;
|
|
18
|
+
SimpleLineSymbol: typeof SimpleLineSymbol;
|
|
19
|
+
SimpleMarkerSymbol: typeof SimpleMarkerSymbol;
|
|
20
|
+
SimpleFillSymbol: typeof SimpleFillSymbol;
|
|
21
|
+
Graphic: typeof Graphic;
|
|
22
|
+
Color: typeof Color;
|
|
23
|
+
};
|
|
24
|
+
export declare class TerraDrawArcGISMapsSDKAdapter extends TerraDrawBaseAdapter {
|
|
25
|
+
private readonly _lib;
|
|
26
|
+
private readonly _mapView;
|
|
27
|
+
private readonly _container;
|
|
28
|
+
private readonly _featureIdAttributeName;
|
|
29
|
+
private readonly _featureLayerName;
|
|
30
|
+
private readonly _featureLayer;
|
|
31
|
+
private _dragEnabled;
|
|
32
|
+
private _zoomEnabled;
|
|
33
|
+
private _dragHandler;
|
|
34
|
+
private _doubleClickHandler;
|
|
35
|
+
constructor(config: {
|
|
36
|
+
map: MapView;
|
|
37
|
+
lib: InjectableArcGISMapsSDK;
|
|
38
|
+
} & BaseAdapterConfig);
|
|
39
|
+
register(callbacks: TerraDrawCallbacks): void;
|
|
40
|
+
unregister(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the longitude and latitude coordinates from a given PointerEvent on the map.
|
|
43
|
+
* @param event The PointerEvent or MouseEvent containing the screen coordinates of the pointer.
|
|
44
|
+
* @returns An object with 'lng' and 'lat' properties representing the longitude and latitude, or null if the conversion is not possible.
|
|
45
|
+
*/
|
|
46
|
+
getLngLatFromEvent(event: PointerEvent | MouseEvent): {
|
|
47
|
+
lng: number;
|
|
48
|
+
lat: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Retrieves the HTML element of the ArcGIS element that handles interaction events
|
|
52
|
+
* @returns The HTMLElement representing the map container.
|
|
53
|
+
*/
|
|
54
|
+
getMapEventElement(): HTMLElement;
|
|
55
|
+
/**
|
|
56
|
+
* Enables or disables the draggable functionality of the map.
|
|
57
|
+
* @param enabled Set to true to enable map dragging, or false to disable it.
|
|
58
|
+
*/
|
|
59
|
+
setDraggability(enabled: boolean): void;
|
|
60
|
+
/**
|
|
61
|
+
* Converts longitude and latitude coordinates to pixel coordinates in the map container.
|
|
62
|
+
* @param lng The longitude coordinate to project.
|
|
63
|
+
* @param lat The latitude coordinate to project.
|
|
64
|
+
* @returns An object with 'x' and 'y' properties representing the pixel coordinates within the map container.
|
|
65
|
+
*/
|
|
66
|
+
project(lng: number, lat: number): {
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Converts pixel coordinates in the map container to longitude and latitude coordinates.
|
|
72
|
+
* @param x The x-coordinate in the map container to unproject.
|
|
73
|
+
* @param y The y-coordinate in the map container to unproject.
|
|
74
|
+
* @returns An object with 'lng' and 'lat' properties representing the longitude and latitude coordinates.
|
|
75
|
+
*/
|
|
76
|
+
unproject(x: number, y: number): {
|
|
77
|
+
lng: number;
|
|
78
|
+
lat: number;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Sets the cursor style for the map container.
|
|
82
|
+
* @param cursor The CSS cursor style to apply, or 'unset' to remove any previously applied cursor style.
|
|
83
|
+
*/
|
|
84
|
+
setCursor(cursor: Parameters<SetCursor>[0]): void;
|
|
85
|
+
/**
|
|
86
|
+
* Enables or disables the double-click to zoom functionality on the map.
|
|
87
|
+
* @param enabled Set to true to enable double-click to zoom, or false to disable it.
|
|
88
|
+
*/
|
|
89
|
+
setDoubleClickToZoom(enabled: boolean): void;
|
|
90
|
+
/**
|
|
91
|
+
* Renders GeoJSON features on the map using the provided styling configuration.
|
|
92
|
+
* @param changes An object containing arrays of created, updated, and unchanged features to render.
|
|
93
|
+
* @param styling An object mapping draw modes to feature styling functions
|
|
94
|
+
*/
|
|
95
|
+
render(changes: TerraDrawChanges, styling: TerraDrawStylingFunction): void;
|
|
96
|
+
/**
|
|
97
|
+
* Clears the map and store of all rendered data layers
|
|
98
|
+
* @returns void
|
|
99
|
+
* */
|
|
100
|
+
clear(): void;
|
|
101
|
+
private removeFeatureById;
|
|
102
|
+
private addFeature;
|
|
103
|
+
private getColorFromHex;
|
|
104
|
+
}
|
|
105
|
+
export {};
|
|
@@ -3,13 +3,14 @@ import { AdapterListener } from "./adapter-listener";
|
|
|
3
3
|
type BasePointerListener = (event: PointerEvent) => void;
|
|
4
4
|
type BaseKeyboardListener = (event: KeyboardEvent) => void;
|
|
5
5
|
type BaseMouseListener = (event: MouseEvent) => void;
|
|
6
|
+
export type BaseAdapterConfig = {
|
|
7
|
+
coordinatePrecision?: number;
|
|
8
|
+
minPixelDragDistanceDrawing?: number;
|
|
9
|
+
minPixelDragDistance?: number;
|
|
10
|
+
minPixelDragDistanceSelecting?: number;
|
|
11
|
+
};
|
|
6
12
|
export declare abstract class TerraDrawBaseAdapter {
|
|
7
|
-
constructor(config:
|
|
8
|
-
coordinatePrecision?: number;
|
|
9
|
-
minPixelDragDistanceDrawing?: number;
|
|
10
|
-
minPixelDragDistance?: number;
|
|
11
|
-
minPixelDragDistanceSelecting?: number;
|
|
12
|
-
});
|
|
13
|
+
constructor(config: BaseAdapterConfig);
|
|
13
14
|
protected _minPixelDragDistance: number;
|
|
14
15
|
protected _minPixelDragDistanceDrawing: number;
|
|
15
16
|
protected _minPixelDragDistanceSelecting: number;
|
|
@@ -33,6 +34,12 @@ export declare abstract class TerraDrawBaseAdapter {
|
|
|
33
34
|
* for handling various drawing events in the current mode.
|
|
34
35
|
*/
|
|
35
36
|
register(callbacks: TerraDrawCallbacks): void;
|
|
37
|
+
/**
|
|
38
|
+
* Gets the coordinate precision.
|
|
39
|
+
* @returns {number} The coordinate precision.
|
|
40
|
+
* @description The coordinate precision is the number of decimal places. Note that the precision will be overriden by the precision of the TerraDraw Adapter.
|
|
41
|
+
*/
|
|
42
|
+
getCoordinatePrecision(): number;
|
|
36
43
|
private getAdapterListeners;
|
|
37
44
|
/**
|
|
38
45
|
* Unregisters the event listeners for the current drawing mode.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/// <reference types="google.maps" />
|
|
2
2
|
import { TerraDrawChanges, SetCursor, TerraDrawStylingFunction, TerraDrawCallbacks } from "../common";
|
|
3
|
-
import { TerraDrawBaseAdapter } from "./common/base.adapter";
|
|
3
|
+
import { BaseAdapterConfig, TerraDrawBaseAdapter } from "./common/base.adapter";
|
|
4
4
|
export declare class TerraDrawGoogleMapsAdapter extends TerraDrawBaseAdapter {
|
|
5
5
|
constructor(config: {
|
|
6
6
|
lib: typeof google.maps;
|
|
7
7
|
map: google.maps.Map;
|
|
8
|
-
|
|
9
|
-
});
|
|
8
|
+
} & BaseAdapterConfig);
|
|
10
9
|
private _cursor;
|
|
11
10
|
private _cursorStyleSheet;
|
|
12
11
|
private _lib;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { TerraDrawChanges, SetCursor, TerraDrawStylingFunction } from "../common";
|
|
2
2
|
import L from "leaflet";
|
|
3
|
-
import { TerraDrawBaseAdapter } from "./common/base.adapter";
|
|
3
|
+
import { BaseAdapterConfig, TerraDrawBaseAdapter } from "./common/base.adapter";
|
|
4
4
|
export declare class TerraDrawLeafletAdapter extends TerraDrawBaseAdapter {
|
|
5
5
|
constructor(config: {
|
|
6
6
|
lib: typeof L;
|
|
7
7
|
map: L.Map;
|
|
8
|
-
|
|
9
|
-
minPixelDragDistance?: number;
|
|
10
|
-
});
|
|
8
|
+
} & BaseAdapterConfig);
|
|
11
9
|
private _lib;
|
|
12
10
|
private _map;
|
|
13
11
|
private _panes;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { TerraDrawChanges, SetCursor, TerraDrawStylingFunction } from "../common";
|
|
2
2
|
import mapboxgl from "mapbox-gl";
|
|
3
|
-
import { TerraDrawBaseAdapter } from "./common/base.adapter";
|
|
3
|
+
import { BaseAdapterConfig, TerraDrawBaseAdapter } from "./common/base.adapter";
|
|
4
4
|
export declare class TerraDrawMapboxGLAdapter extends TerraDrawBaseAdapter {
|
|
5
5
|
constructor(config: {
|
|
6
6
|
map: mapboxgl.Map;
|
|
7
|
-
|
|
8
|
-
});
|
|
7
|
+
} & BaseAdapterConfig);
|
|
9
8
|
private _nextRender;
|
|
10
9
|
private _map;
|
|
11
10
|
private _container;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { TerraDrawChanges, SetCursor, TerraDrawStylingFunction, TerraDrawCallbacks } from "../common";
|
|
2
2
|
import { Map } from "maplibre-gl";
|
|
3
|
-
import { TerraDrawBaseAdapter } from "./common/base.adapter";
|
|
3
|
+
import { BaseAdapterConfig, TerraDrawBaseAdapter } from "./common/base.adapter";
|
|
4
4
|
export declare class TerraDrawMapLibreGLAdapter extends TerraDrawBaseAdapter {
|
|
5
5
|
private mapboxglAdapter;
|
|
6
6
|
constructor(config: {
|
|
7
7
|
map: Map;
|
|
8
|
-
|
|
9
|
-
});
|
|
8
|
+
} & BaseAdapterConfig);
|
|
10
9
|
register(callbacks: TerraDrawCallbacks): void;
|
|
11
10
|
unregister(): void;
|
|
12
11
|
/**
|
|
@@ -9,7 +9,7 @@ import Style from "ol/style/Style";
|
|
|
9
9
|
import VectorSource from "ol/source/Vector";
|
|
10
10
|
import VectorLayer from "ol/layer/Vector";
|
|
11
11
|
import { toLonLat } from "ol/proj";
|
|
12
|
-
import { TerraDrawBaseAdapter } from "./common/base.adapter";
|
|
12
|
+
import { BaseAdapterConfig, TerraDrawBaseAdapter } from "./common/base.adapter";
|
|
13
13
|
type InjectableOL = {
|
|
14
14
|
Circle: typeof CircleGeom;
|
|
15
15
|
Feature: typeof Feature;
|
|
@@ -25,8 +25,7 @@ export declare class TerraDrawOpenLayersAdapter extends TerraDrawBaseAdapter {
|
|
|
25
25
|
constructor(config: {
|
|
26
26
|
map: Map;
|
|
27
27
|
lib: InjectableOL;
|
|
28
|
-
|
|
29
|
-
});
|
|
28
|
+
} & BaseAdapterConfig);
|
|
30
29
|
private stylingFunction;
|
|
31
30
|
private _lib;
|
|
32
31
|
private _map;
|
package/dist/common.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export interface TerraDrawModeRegisterConfig {
|
|
|
56
56
|
onFinish: (finishedId: string) => void;
|
|
57
57
|
project: Project;
|
|
58
58
|
unproject: Unproject;
|
|
59
|
+
coordinatePrecision: number;
|
|
59
60
|
}
|
|
60
61
|
export type TerraDrawModeState = "unregistered" | "registered" | "started" | "drawing" | "selecting" | "stopped";
|
|
61
62
|
export interface TerraDrawCallbacks {
|
|
@@ -89,6 +90,7 @@ export interface TerraDrawAdapter {
|
|
|
89
90
|
unregister(): void;
|
|
90
91
|
render(changes: TerraDrawChanges, styling: TerraDrawStylingFunction): void;
|
|
91
92
|
clear(): void;
|
|
93
|
+
getCoordinatePrecision(): number;
|
|
92
94
|
}
|
|
93
95
|
export declare const SELECT_PROPERTIES: {
|
|
94
96
|
readonly SELECTED: "selected";
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
2
2
|
import { HexColor, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, TerraDrawModeRegisterConfig, TerraDrawModeState, TerraDrawMouseEvent } from "../common";
|
|
3
3
|
import { GeoJSONStore, GeoJSONStoreFeatures, StoreChangeHandler } from "../store/store";
|
|
4
|
-
type CustomStyling = Record<string, string | number | ((feature: GeoJSONStoreFeatures) => HexColor) | ((feature: GeoJSONStoreFeatures) => number)>;
|
|
4
|
+
export type CustomStyling = Record<string, string | number | ((feature: GeoJSONStoreFeatures) => HexColor) | ((feature: GeoJSONStoreFeatures) => number)>;
|
|
5
5
|
export declare enum ModeTypes {
|
|
6
6
|
Drawing = "drawing",
|
|
7
7
|
Select = "select",
|
|
8
8
|
Static = "static",
|
|
9
9
|
Render = "render"
|
|
10
10
|
}
|
|
11
|
+
export type BaseModeOptions<T extends CustomStyling> = {
|
|
12
|
+
styles?: Partial<T>;
|
|
13
|
+
pointerDistance?: number;
|
|
14
|
+
};
|
|
11
15
|
export declare abstract class TerraDrawBaseDrawMode<T extends CustomStyling> {
|
|
12
16
|
protected _state: TerraDrawModeState;
|
|
13
17
|
get state(): TerraDrawModeState;
|
|
@@ -25,11 +29,7 @@ export declare abstract class TerraDrawBaseDrawMode<T extends CustomStyling> {
|
|
|
25
29
|
protected project: TerraDrawModeRegisterConfig["project"];
|
|
26
30
|
protected setCursor: TerraDrawModeRegisterConfig["setCursor"];
|
|
27
31
|
protected registerBehaviors(behaviorConfig: BehaviorConfig): void;
|
|
28
|
-
constructor(options?:
|
|
29
|
-
styles?: Partial<T>;
|
|
30
|
-
pointerDistance?: number;
|
|
31
|
-
coordinatePrecision?: number;
|
|
32
|
-
});
|
|
32
|
+
constructor(options?: BaseModeOptions<T>);
|
|
33
33
|
type: ModeTypes;
|
|
34
34
|
mode: string;
|
|
35
35
|
protected setDrawing(): void;
|
|
@@ -55,4 +55,3 @@ export declare abstract class TerraDrawBaseDrawMode<T extends CustomStyling> {
|
|
|
55
55
|
protected getNumericStylingValue(value: number | ((feature: GeoJSONStoreFeatures) => number) | undefined, defaultValue: number, feature: GeoJSONStoreFeatures): number;
|
|
56
56
|
private getStylingValue;
|
|
57
57
|
}
|
|
58
|
-
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
2
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
|
-
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
+
import { BaseModeOptions, CustomStyling, TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
4
|
type TerraDrawCircleModeKeyEvents = {
|
|
5
5
|
cancel: KeyboardEvent["key"] | null;
|
|
6
6
|
finish: KeyboardEvent["key"] | null;
|
|
@@ -14,6 +14,10 @@ type CirclePolygonStyling = {
|
|
|
14
14
|
interface Cursors {
|
|
15
15
|
start?: Cursor;
|
|
16
16
|
}
|
|
17
|
+
interface TerraDrawCircleModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
18
|
+
keyEvents?: TerraDrawCircleModeKeyEvents | null;
|
|
19
|
+
cursors?: Cursors;
|
|
20
|
+
}
|
|
17
21
|
export declare class TerraDrawCircleMode extends TerraDrawBaseDrawMode<CirclePolygonStyling> {
|
|
18
22
|
mode: string;
|
|
19
23
|
private center;
|
|
@@ -21,11 +25,7 @@ export declare class TerraDrawCircleMode extends TerraDrawBaseDrawMode<CirclePol
|
|
|
21
25
|
private currentCircleId;
|
|
22
26
|
private keyEvents;
|
|
23
27
|
private cursors;
|
|
24
|
-
constructor(options?:
|
|
25
|
-
styles?: Partial<CirclePolygonStyling>;
|
|
26
|
-
keyEvents?: TerraDrawCircleModeKeyEvents | null;
|
|
27
|
-
cursors?: Cursors;
|
|
28
|
-
});
|
|
28
|
+
constructor(options?: TerraDrawCircleModeOptions<CirclePolygonStyling>);
|
|
29
29
|
private close;
|
|
30
30
|
/** @internal */
|
|
31
31
|
start(): void;
|
|
@@ -50,5 +50,6 @@ export declare class TerraDrawCircleMode extends TerraDrawBaseDrawMode<CirclePol
|
|
|
50
50
|
/** @internal */
|
|
51
51
|
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
52
52
|
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
53
|
+
private createCircle;
|
|
53
54
|
}
|
|
54
55
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
|
-
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
2
|
+
import { BaseModeOptions, CustomStyling, TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
4
4
|
type TerraDrawFreehandModeKeyEvents = {
|
|
5
5
|
cancel: KeyboardEvent["key"] | null;
|
|
@@ -19,6 +19,12 @@ interface Cursors {
|
|
|
19
19
|
start?: Cursor;
|
|
20
20
|
close?: Cursor;
|
|
21
21
|
}
|
|
22
|
+
interface TerraDrawFreehandModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
23
|
+
minDistance?: number;
|
|
24
|
+
preventPointsNearClose?: boolean;
|
|
25
|
+
keyEvents?: TerraDrawFreehandModeKeyEvents | null;
|
|
26
|
+
cursors?: Cursors;
|
|
27
|
+
}
|
|
22
28
|
export declare class TerraDrawFreehandMode extends TerraDrawBaseDrawMode<FreehandPolygonStyling> {
|
|
23
29
|
mode: string;
|
|
24
30
|
private startingClick;
|
|
@@ -28,13 +34,7 @@ export declare class TerraDrawFreehandMode extends TerraDrawBaseDrawMode<Freehan
|
|
|
28
34
|
private keyEvents;
|
|
29
35
|
private cursors;
|
|
30
36
|
private preventPointsNearClose;
|
|
31
|
-
constructor(options?:
|
|
32
|
-
styles?: Partial<FreehandPolygonStyling>;
|
|
33
|
-
minDistance?: number;
|
|
34
|
-
preventPointsNearClose?: boolean;
|
|
35
|
-
keyEvents?: TerraDrawFreehandModeKeyEvents | null;
|
|
36
|
-
cursors?: Cursors;
|
|
37
|
-
});
|
|
37
|
+
constructor(options?: TerraDrawFreehandModeOptions<FreehandPolygonStyling>);
|
|
38
38
|
private close;
|
|
39
39
|
/** @internal */
|
|
40
40
|
start(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
|
-
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
2
|
+
import { BaseModeOptions, CustomStyling, TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
5
5
|
type TerraDrawGreateCircleModeKeyEvents = {
|
|
@@ -18,6 +18,12 @@ interface Cursors {
|
|
|
18
18
|
start?: Cursor;
|
|
19
19
|
close?: Cursor;
|
|
20
20
|
}
|
|
21
|
+
interface TerraDrawGreatCircleModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
22
|
+
snapping?: boolean;
|
|
23
|
+
pointerDistance?: number;
|
|
24
|
+
keyEvents?: TerraDrawGreateCircleModeKeyEvents | null;
|
|
25
|
+
cursors?: Cursors;
|
|
26
|
+
}
|
|
21
27
|
export declare class TerraDrawGreatCircleMode extends TerraDrawBaseDrawMode<GreateCircleStyling> {
|
|
22
28
|
mode: string;
|
|
23
29
|
private currentCoordinate;
|
|
@@ -27,13 +33,7 @@ export declare class TerraDrawGreatCircleMode extends TerraDrawBaseDrawMode<Grea
|
|
|
27
33
|
private snappingEnabled;
|
|
28
34
|
private cursors;
|
|
29
35
|
private snapping;
|
|
30
|
-
constructor(options?:
|
|
31
|
-
snapping?: boolean;
|
|
32
|
-
pointerDistance?: number;
|
|
33
|
-
styles?: Partial<GreateCircleStyling>;
|
|
34
|
-
keyEvents?: TerraDrawGreateCircleModeKeyEvents | null;
|
|
35
|
-
cursors?: Cursors;
|
|
36
|
-
});
|
|
36
|
+
constructor(options?: TerraDrawGreatCircleModeOptions<GreateCircleStyling>);
|
|
37
37
|
private close;
|
|
38
38
|
/** @internal */
|
|
39
39
|
registerBehaviors(config: BehaviorConfig): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
|
-
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
2
|
+
import { BaseModeOptions, CustomStyling, TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
5
5
|
type TerraDrawLineStringModeKeyEvents = {
|
|
@@ -18,6 +18,13 @@ interface Cursors {
|
|
|
18
18
|
start?: Cursor;
|
|
19
19
|
close?: Cursor;
|
|
20
20
|
}
|
|
21
|
+
interface TerraDrawLineStringModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
22
|
+
snapping?: boolean;
|
|
23
|
+
allowSelfIntersections?: boolean;
|
|
24
|
+
pointerDistance?: number;
|
|
25
|
+
keyEvents?: TerraDrawLineStringModeKeyEvents | null;
|
|
26
|
+
cursors?: Cursors;
|
|
27
|
+
}
|
|
21
28
|
export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineStringStyling> {
|
|
22
29
|
mode: string;
|
|
23
30
|
private currentCoordinate;
|
|
@@ -29,14 +36,7 @@ export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineS
|
|
|
29
36
|
private cursors;
|
|
30
37
|
private mouseMove;
|
|
31
38
|
private snapping;
|
|
32
|
-
constructor(options?:
|
|
33
|
-
snapping?: boolean;
|
|
34
|
-
allowSelfIntersections?: boolean;
|
|
35
|
-
pointerDistance?: number;
|
|
36
|
-
styles?: Partial<LineStringStyling>;
|
|
37
|
-
keyEvents?: TerraDrawLineStringModeKeyEvents | null;
|
|
38
|
-
cursors?: Cursors;
|
|
39
|
-
});
|
|
39
|
+
constructor(options?: TerraDrawLineStringModeOptions<LineStringStyling>);
|
|
40
40
|
private close;
|
|
41
41
|
/** @internal */
|
|
42
42
|
registerBehaviors(config: BehaviorConfig): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, NumericStyling, HexColorStyling, Cursor } from "../../common";
|
|
2
2
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
|
-
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
+
import { BaseModeOptions, CustomStyling, TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
4
|
type PointModeStyling = {
|
|
5
5
|
pointWidth: NumericStyling;
|
|
6
6
|
pointColor: HexColorStyling;
|
|
@@ -10,13 +10,13 @@ type PointModeStyling = {
|
|
|
10
10
|
interface Cursors {
|
|
11
11
|
create?: Cursor;
|
|
12
12
|
}
|
|
13
|
+
interface TerraDrawPointModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
14
|
+
cursors?: Cursors;
|
|
15
|
+
}
|
|
13
16
|
export declare class TerraDrawPointMode extends TerraDrawBaseDrawMode<PointModeStyling> {
|
|
14
17
|
mode: string;
|
|
15
18
|
private cursors;
|
|
16
|
-
constructor(options?:
|
|
17
|
-
styles?: Partial<PointModeStyling>;
|
|
18
|
-
cursors?: Cursors;
|
|
19
|
-
});
|
|
19
|
+
constructor(options?: TerraDrawPointModeOptions<PointModeStyling>);
|
|
20
20
|
/** @internal */
|
|
21
21
|
start(): void;
|
|
22
22
|
/** @internal */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
|
-
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
2
|
+
import { TerraDrawBaseDrawMode, BaseModeOptions, CustomStyling } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
5
5
|
type TerraDrawPolygonModeKeyEvents = {
|
|
@@ -20,6 +20,13 @@ interface Cursors {
|
|
|
20
20
|
start?: Cursor;
|
|
21
21
|
close?: Cursor;
|
|
22
22
|
}
|
|
23
|
+
interface TerraDrawPolygonModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
24
|
+
allowSelfIntersections?: boolean;
|
|
25
|
+
snapping?: boolean;
|
|
26
|
+
pointerDistance?: number;
|
|
27
|
+
keyEvents?: TerraDrawPolygonModeKeyEvents | null;
|
|
28
|
+
cursors?: Cursors;
|
|
29
|
+
}
|
|
23
30
|
export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonStyling> {
|
|
24
31
|
mode: string;
|
|
25
32
|
private currentCoordinate;
|
|
@@ -32,14 +39,7 @@ export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonS
|
|
|
32
39
|
private closingPoints;
|
|
33
40
|
private cursors;
|
|
34
41
|
private mouseMove;
|
|
35
|
-
constructor(options?:
|
|
36
|
-
allowSelfIntersections?: boolean;
|
|
37
|
-
snapping?: boolean;
|
|
38
|
-
pointerDistance?: number;
|
|
39
|
-
styles?: Partial<PolygonStyling>;
|
|
40
|
-
keyEvents?: TerraDrawPolygonModeKeyEvents | null;
|
|
41
|
-
cursors?: Cursors;
|
|
42
|
-
});
|
|
42
|
+
constructor(options?: TerraDrawPolygonModeOptions<PolygonStyling>);
|
|
43
43
|
private close;
|
|
44
44
|
/** @internal */
|
|
45
45
|
registerBehaviors(config: BehaviorConfig): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
2
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
|
-
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
+
import { BaseModeOptions, CustomStyling, TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
4
|
type TerraDrawRectangleModeKeyEvents = {
|
|
5
5
|
cancel: KeyboardEvent["key"] | null;
|
|
6
6
|
finish: KeyboardEvent["key"] | null;
|
|
@@ -14,6 +14,10 @@ type RectanglePolygonStyling = {
|
|
|
14
14
|
interface Cursors {
|
|
15
15
|
start?: Cursor;
|
|
16
16
|
}
|
|
17
|
+
interface TerraDrawRectangleModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
18
|
+
keyEvents?: TerraDrawRectangleModeKeyEvents | null;
|
|
19
|
+
cursors?: Cursors;
|
|
20
|
+
}
|
|
17
21
|
export declare class TerraDrawRectangleMode extends TerraDrawBaseDrawMode<RectanglePolygonStyling> {
|
|
18
22
|
mode: string;
|
|
19
23
|
private center;
|
|
@@ -21,11 +25,7 @@ export declare class TerraDrawRectangleMode extends TerraDrawBaseDrawMode<Rectan
|
|
|
21
25
|
private currentRectangleId;
|
|
22
26
|
private keyEvents;
|
|
23
27
|
private cursors;
|
|
24
|
-
constructor(options?:
|
|
25
|
-
styles?: Partial<RectanglePolygonStyling>;
|
|
26
|
-
keyEvents?: TerraDrawRectangleModeKeyEvents | null;
|
|
27
|
-
cursors?: Cursors;
|
|
28
|
-
});
|
|
28
|
+
constructor(options?: TerraDrawRectangleModeOptions<RectanglePolygonStyling>);
|
|
29
29
|
private updateRectangle;
|
|
30
30
|
private close;
|
|
31
31
|
/** @internal */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HexColorStyling, NumericStyling, TerraDrawAdapterStyling } from "../../common";
|
|
2
|
-
import { ModeTypes, TerraDrawBaseDrawMode } from "../base.mode";
|
|
2
|
+
import { BaseModeOptions, CustomStyling, ModeTypes, TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../terra-draw";
|
|
5
5
|
type RenderModeStyling = {
|
|
@@ -15,13 +15,14 @@ type RenderModeStyling = {
|
|
|
15
15
|
lineStringColor: HexColorStyling;
|
|
16
16
|
zIndex: NumericStyling;
|
|
17
17
|
};
|
|
18
|
+
interface TerraDrawRenderModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
19
|
+
modeName: string;
|
|
20
|
+
styles: Partial<T>;
|
|
21
|
+
}
|
|
18
22
|
export declare class TerraDrawRenderMode extends TerraDrawBaseDrawMode<RenderModeStyling> {
|
|
19
23
|
type: ModeTypes;
|
|
20
24
|
mode: string;
|
|
21
|
-
constructor(options:
|
|
22
|
-
modeName: string;
|
|
23
|
-
styles: Partial<RenderModeStyling>;
|
|
24
|
-
});
|
|
25
|
+
constructor(options: TerraDrawRenderModeOptions<RenderModeStyling>);
|
|
25
26
|
/** @internal */
|
|
26
27
|
registerBehaviors(behaviorConfig: BehaviorConfig): void;
|
|
27
28
|
/** @internal */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TerraDrawMouseEvent, TerraDrawKeyboardEvent, TerraDrawAdapterStyling, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
|
-
import { ModeTypes, TerraDrawBaseDrawMode } from "../base.mode";
|
|
2
|
+
import { BaseModeOptions, CustomStyling, ModeTypes, TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
5
5
|
type TerraDrawSelectModeKeyEvents = {
|
|
@@ -47,6 +47,15 @@ interface Cursors {
|
|
|
47
47
|
dragEnd?: Cursor;
|
|
48
48
|
insertMidpoint?: Cursor;
|
|
49
49
|
}
|
|
50
|
+
interface TerraDrawSelectModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
51
|
+
pointerDistance?: number;
|
|
52
|
+
flags?: {
|
|
53
|
+
[mode: string]: ModeFlags;
|
|
54
|
+
};
|
|
55
|
+
keyEvents?: TerraDrawSelectModeKeyEvents | null;
|
|
56
|
+
dragEventThrottle?: number;
|
|
57
|
+
cursors?: Cursors;
|
|
58
|
+
}
|
|
50
59
|
export declare class TerraDrawSelectMode extends TerraDrawBaseDrawMode<SelectionStyling> {
|
|
51
60
|
type: ModeTypes;
|
|
52
61
|
mode: string;
|
|
@@ -65,16 +74,7 @@ export declare class TerraDrawSelectMode extends TerraDrawBaseDrawMode<Selection
|
|
|
65
74
|
private rotateFeature;
|
|
66
75
|
private scaleFeature;
|
|
67
76
|
private cursors;
|
|
68
|
-
constructor(options?:
|
|
69
|
-
styles?: Partial<SelectionStyling>;
|
|
70
|
-
pointerDistance?: number;
|
|
71
|
-
flags?: {
|
|
72
|
-
[mode: string]: ModeFlags;
|
|
73
|
-
};
|
|
74
|
-
keyEvents?: TerraDrawSelectModeKeyEvents | null;
|
|
75
|
-
dragEventThrottle?: number;
|
|
76
|
-
cursors?: Cursors;
|
|
77
|
-
});
|
|
77
|
+
constructor(options?: TerraDrawSelectModeOptions<SelectionStyling>);
|
|
78
78
|
setSelecting(): void;
|
|
79
79
|
registerBehaviors(config: BehaviorConfig): void;
|
|
80
80
|
private deselect;
|