terra-draw 0.0.1-alpha.15 → 0.0.1-alpha.16
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/CHANGELOG.md +13 -0
- package/dist/adapters/common/adapter-listener.d.ts +14 -0
- package/dist/adapters/google-maps.adapter.d.ts +5 -13
- package/dist/adapters/leaflet.adapter.d.ts +4 -7
- package/dist/adapters/mapbox-gl.adapter.d.ts +5 -8
- package/dist/adapters/maplibre-gl.adapter.d.ts +20 -0
- package/dist/adapters/openlayers.adapter.d.ts +55 -0
- package/dist/common.d.ts +8 -6
- package/dist/geometry/shape/create-circle.d.ts +1 -0
- package/dist/geometry/shape/great-circle-line.d.ts +12 -0
- package/dist/modes/base.behavior.d.ts +1 -1
- package/dist/modes/base.mode.d.ts +2 -1
- package/dist/modes/circle/circle.mode.d.ts +16 -5
- package/dist/modes/freehand/freehand.mode.d.ts +16 -5
- package/dist/modes/great-circle-snapping.behavior.d.ts +13 -0
- package/dist/modes/greatcircle/great-circle.mode.d.ts +57 -0
- package/dist/modes/linestring/linestring.mode.d.ts +17 -5
- package/dist/modes/point/point.mode.d.ts +13 -1
- package/dist/modes/polygon/polygon.mode.d.ts +17 -5
- package/dist/modes/rectangle/rectangle.mode.d.ts +48 -0
- package/dist/modes/render/render.mode.d.ts +13 -2
- package/dist/modes/select/select.mode.d.ts +19 -8
- package/dist/modes/static/static.mode.d.ts +2 -2
- package/dist/store/spatial-index/quickselect.d.ts +1 -1
- package/dist/store/spatial-index/rbush.d.ts +1 -1
- package/dist/store/store.d.ts +11 -9
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- package/dist/terra-draw.d.ts +88 -7
- 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/scratch/release.sh +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.1-alpha.16](https://github.com/JamesLMilner/terra-draw/compare/v0.0.1-alpha.15...v0.0.1-alpha.16) (2023-02-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add great circle line mode ([72136a0](https://github.com/JamesLMilner/terra-draw/commit/72136a044ed3a7c9192e92fbb383e64243ce8bd6))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Chore
|
|
14
|
+
|
|
15
|
+
* add local scratch folder to allow for experimentation ([828e1dd](https://github.com/JamesLMilner/terra-draw/commit/828e1ddfa575a8a9703c63c3bf8d1f11535e3fef))
|
|
16
|
+
* fix scratch pad folder location for local development ([107db58](https://github.com/JamesLMilner/terra-draw/commit/107db581a94852925f7b647f77b67b67f0a7598d))
|
|
17
|
+
|
|
5
18
|
### [0.0.1-alpha.15](https://github.com/JamesLMilner/terra-draw/compare/v0.0.1-alpha.14...v0.0.1-alpha.15) (2023-02-05)
|
|
6
19
|
|
|
7
20
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class AdapterListener {
|
|
2
|
+
name: string;
|
|
3
|
+
callback: (...args: any[]) => any;
|
|
4
|
+
registered: boolean;
|
|
5
|
+
register: any;
|
|
6
|
+
unregister: any;
|
|
7
|
+
private listeners;
|
|
8
|
+
constructor({ name, callback, unregister, register }: {
|
|
9
|
+
name: string;
|
|
10
|
+
callback: (...args: any[]) => any;
|
|
11
|
+
unregister: (...callbacks: any[]) => void;
|
|
12
|
+
register: (callback: (...args: any[]) => any) => any[];
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -13,24 +13,16 @@ export declare class TerraDrawGoogleMapsAdapter implements TerraDrawAdapter {
|
|
|
13
13
|
private _coordinatePrecision;
|
|
14
14
|
private _lib;
|
|
15
15
|
private _map;
|
|
16
|
-
private _onMouseMoveListener;
|
|
17
|
-
private _onMouseMoveCallback;
|
|
18
|
-
private _onClickListener;
|
|
19
|
-
private _onRightClickListener;
|
|
20
|
-
private _onClickCallback;
|
|
21
|
-
private _onKeyUpListener;
|
|
22
|
-
private _onDragStartListener;
|
|
23
|
-
private _onDragListener;
|
|
24
|
-
private _onDragEndListener;
|
|
25
16
|
private _layers;
|
|
26
17
|
getMapContainer: () => HTMLElement;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
lat: number;
|
|
30
|
-
};
|
|
18
|
+
setDoubleClickToZoom: TerraDrawModeRegisterConfig["setDoubleClickToZoom"];
|
|
19
|
+
unproject: TerraDrawModeRegisterConfig["unproject"];
|
|
31
20
|
project: TerraDrawModeRegisterConfig["project"];
|
|
32
21
|
setCursor: TerraDrawModeRegisterConfig["setCursor"];
|
|
33
22
|
private circlePath;
|
|
23
|
+
private currentModeCallbacks;
|
|
24
|
+
private listeners;
|
|
25
|
+
private dragState;
|
|
34
26
|
register(callbacks: TerraDrawCallbacks): void;
|
|
35
27
|
unregister(): void;
|
|
36
28
|
render(changes: TerraDrawChanges, styling: {
|
|
@@ -7,19 +7,16 @@ export declare class TerraDrawLeafletAdapter implements TerraDrawAdapter {
|
|
|
7
7
|
map: L.Map;
|
|
8
8
|
coordinatePrecision?: number;
|
|
9
9
|
});
|
|
10
|
+
private listeners;
|
|
10
11
|
private _heldKeys;
|
|
11
12
|
private _lib;
|
|
12
13
|
private _coordinatePrecision;
|
|
13
14
|
private _map;
|
|
14
|
-
private _onMouseMoveListener;
|
|
15
|
-
private _onClickListener;
|
|
16
|
-
private _onKeyUpListener;
|
|
17
|
-
private _onKeyDownListener;
|
|
18
|
-
private _onDragStartListener;
|
|
19
|
-
private _onDragListener;
|
|
20
|
-
private _onDragEndListener;
|
|
21
15
|
private _layer;
|
|
22
16
|
private _panes;
|
|
17
|
+
private dragState;
|
|
18
|
+
private currentModeCallbacks;
|
|
19
|
+
setDoubleClickToZoom: TerraDrawModeRegisterConfig["setDoubleClickToZoom"];
|
|
23
20
|
project: TerraDrawModeRegisterConfig["project"];
|
|
24
21
|
unproject: TerraDrawModeRegisterConfig["unproject"];
|
|
25
22
|
setCursor: TerraDrawModeRegisterConfig["setCursor"];
|
|
@@ -4,22 +4,19 @@ import { GeoJSONStoreFeatures } from "../store/store";
|
|
|
4
4
|
export declare class TerraDrawMapboxGLAdapter implements TerraDrawAdapter {
|
|
5
5
|
constructor(config: {
|
|
6
6
|
map: mapboxgl.Map;
|
|
7
|
-
coordinatePrecision
|
|
7
|
+
coordinatePrecision?: number;
|
|
8
8
|
});
|
|
9
|
+
private dragState;
|
|
10
|
+
setDoubleClickToZoom: TerraDrawModeRegisterConfig["setDoubleClickToZoom"];
|
|
9
11
|
unproject: TerraDrawModeRegisterConfig["unproject"];
|
|
10
12
|
project: TerraDrawModeRegisterConfig["project"];
|
|
11
13
|
setCursor: TerraDrawModeRegisterConfig["setCursor"];
|
|
12
14
|
getMapContainer: () => HTMLElement;
|
|
15
|
+
private _listeners;
|
|
16
|
+
private _currentModeCallbacks;
|
|
13
17
|
private _heldKeys;
|
|
14
18
|
private _coordinatePrecision;
|
|
15
19
|
private _map;
|
|
16
|
-
private _onMouseMoveListener;
|
|
17
|
-
private _onClickListener;
|
|
18
|
-
private _onDragStartListener;
|
|
19
|
-
private _onDragListener;
|
|
20
|
-
private _onDragEndListener;
|
|
21
|
-
private _onKeyDownListener;
|
|
22
|
-
private _onKeyUpListener;
|
|
23
20
|
private _rendered;
|
|
24
21
|
private _addGeoJSONSource;
|
|
25
22
|
private _addFillLayer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TerraDrawCallbacks, TerraDrawAdapter, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling, TerraDrawChanges } from "../common";
|
|
2
|
+
import { Map } from "maplibre-gl";
|
|
3
|
+
import { GeoJSONStoreFeatures } from "../store/store";
|
|
4
|
+
export declare class TerraDrawMapLibreGLAdapter implements TerraDrawAdapter {
|
|
5
|
+
private mapboxglAdapter;
|
|
6
|
+
constructor(config: {
|
|
7
|
+
map: Map;
|
|
8
|
+
coordinatePrecision?: number;
|
|
9
|
+
});
|
|
10
|
+
setDoubleClickToZoom: TerraDrawModeRegisterConfig["setDoubleClickToZoom"];
|
|
11
|
+
unproject: TerraDrawModeRegisterConfig["unproject"];
|
|
12
|
+
project: TerraDrawModeRegisterConfig["project"];
|
|
13
|
+
setCursor: TerraDrawModeRegisterConfig["setCursor"];
|
|
14
|
+
getMapContainer: () => HTMLElement;
|
|
15
|
+
register(callbacks: TerraDrawCallbacks): void;
|
|
16
|
+
unregister(): void;
|
|
17
|
+
render(changes: TerraDrawChanges, styling: {
|
|
18
|
+
[mode: string]: (feature: GeoJSONStoreFeatures) => TerraDrawAdapterStyling;
|
|
19
|
+
}): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { TerraDrawCallbacks, TerraDrawAdapter, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling, TerraDrawChanges } from "../common";
|
|
2
|
+
import { GeoJSONStoreFeatures } from "../store/store";
|
|
3
|
+
import CircleGeom from 'ol/geom/Circle';
|
|
4
|
+
import Feature from 'ol/Feature';
|
|
5
|
+
import GeoJSON from 'ol/format/GeoJSON';
|
|
6
|
+
import Map from 'ol/Map';
|
|
7
|
+
import Circle from 'ol/style/Circle';
|
|
8
|
+
import Stroke from 'ol/style/Stroke';
|
|
9
|
+
import Style from 'ol/style/Style';
|
|
10
|
+
import VectorSource from "ol/source/Vector";
|
|
11
|
+
import VectorLayer from "ol/layer/Vector";
|
|
12
|
+
import { toLonLat } from "ol/proj";
|
|
13
|
+
type InjectableOL = {
|
|
14
|
+
Circle: typeof CircleGeom;
|
|
15
|
+
Feature: typeof Feature;
|
|
16
|
+
GeoJSON: typeof GeoJSON;
|
|
17
|
+
Style: typeof Style;
|
|
18
|
+
CircleStyle: typeof Circle;
|
|
19
|
+
VectorLayer: typeof VectorLayer;
|
|
20
|
+
VectorSource: typeof VectorSource;
|
|
21
|
+
Stroke: typeof Stroke;
|
|
22
|
+
toLonLat: typeof toLonLat;
|
|
23
|
+
};
|
|
24
|
+
export declare class TerraDrawOpenLayersAdapter implements TerraDrawAdapter {
|
|
25
|
+
constructor(config: {
|
|
26
|
+
map: Map;
|
|
27
|
+
lib: InjectableOL;
|
|
28
|
+
coordinatePrecision?: number;
|
|
29
|
+
});
|
|
30
|
+
private _dragState;
|
|
31
|
+
private _listeners;
|
|
32
|
+
private _currentModeCallbacks;
|
|
33
|
+
private _lib;
|
|
34
|
+
private _map;
|
|
35
|
+
private _heldKeys;
|
|
36
|
+
private _coordinatePrecision;
|
|
37
|
+
private HexToRGB;
|
|
38
|
+
setDoubleClickToZoom: TerraDrawModeRegisterConfig["setDoubleClickToZoom"];
|
|
39
|
+
unproject: TerraDrawModeRegisterConfig["unproject"];
|
|
40
|
+
project: TerraDrawModeRegisterConfig["project"];
|
|
41
|
+
setCursor: TerraDrawModeRegisterConfig["setCursor"];
|
|
42
|
+
getMapContainer: () => HTMLElement;
|
|
43
|
+
register(callbacks: TerraDrawCallbacks): void;
|
|
44
|
+
unregister(): void;
|
|
45
|
+
private vectorSource;
|
|
46
|
+
private getStyles;
|
|
47
|
+
private geoJSONReader;
|
|
48
|
+
private addFeature;
|
|
49
|
+
private removeFeature;
|
|
50
|
+
private projection;
|
|
51
|
+
render(changes: TerraDrawChanges, styling: {
|
|
52
|
+
[mode: string]: (feature: GeoJSONStoreFeatures) => TerraDrawAdapterStyling;
|
|
53
|
+
}): void;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
package/dist/common.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StoreChangeHandler, GeoJSONStore, GeoJSONStoreFeatures } from "./store/store";
|
|
2
|
-
export
|
|
2
|
+
export type HexColor = `#${string}`;
|
|
3
3
|
export interface TerraDrawAdapterStyling {
|
|
4
4
|
pointColor: HexColor;
|
|
5
5
|
pointWidth: number;
|
|
@@ -24,18 +24,19 @@ export interface TerraDrawMouseEvent {
|
|
|
24
24
|
export interface TerraDrawKeyboardEvent {
|
|
25
25
|
key: string;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
export
|
|
27
|
+
type SetCursor = (cursor: "unset" | "grab" | "grabbing" | "crosshair" | "pointer") => void;
|
|
28
|
+
export type Project = (lng: number, lat: number) => {
|
|
29
29
|
x: number;
|
|
30
30
|
y: number;
|
|
31
31
|
};
|
|
32
|
-
export
|
|
32
|
+
export type Unproject = (x: number, y: number) => {
|
|
33
33
|
lat: number;
|
|
34
34
|
lng: number;
|
|
35
35
|
};
|
|
36
36
|
export interface TerraDrawModeRegisterConfig {
|
|
37
37
|
mode: string;
|
|
38
38
|
store: GeoJSONStore;
|
|
39
|
+
setDoubleClickToZoom: (enabled: boolean) => void;
|
|
39
40
|
setCursor: SetCursor;
|
|
40
41
|
onChange: StoreChangeHandler;
|
|
41
42
|
onSelect: (selectedId: string) => void;
|
|
@@ -43,7 +44,7 @@ export interface TerraDrawModeRegisterConfig {
|
|
|
43
44
|
project: Project;
|
|
44
45
|
unproject: Unproject;
|
|
45
46
|
}
|
|
46
|
-
export
|
|
47
|
+
export type TerraDrawModeState = "unregistered" | "registered" | "started" | "stopped";
|
|
47
48
|
export interface TerraDrawMode {
|
|
48
49
|
mode: string;
|
|
49
50
|
styleFeature: (feature: GeoJSONStoreFeatures) => TerraDrawAdapterStyling;
|
|
@@ -75,13 +76,14 @@ export interface TerraDrawChanges {
|
|
|
75
76
|
unchanged: GeoJSONStoreFeatures[];
|
|
76
77
|
deletedIds: string[];
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
+
type TerraDrawStylingFunction = {
|
|
79
80
|
[mode: string]: (feature: GeoJSONStoreFeatures) => TerraDrawAdapterStyling;
|
|
80
81
|
};
|
|
81
82
|
export interface TerraDrawAdapter {
|
|
82
83
|
project: Project;
|
|
83
84
|
unproject: Unproject;
|
|
84
85
|
setCursor: SetCursor;
|
|
86
|
+
setDoubleClickToZoom: (enabled: boolean) => void;
|
|
85
87
|
getMapContainer: () => HTMLElement;
|
|
86
88
|
register(callbacks: TerraDrawCallbacks): void;
|
|
87
89
|
unregister(): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Feature, LineString, Position } from "geojson";
|
|
2
|
+
import { JSONObject } from "../../store/store";
|
|
3
|
+
export declare function greatCircleLine<Properties extends JSONObject>({ start, end, options }: {
|
|
4
|
+
start: Position;
|
|
5
|
+
end: Position;
|
|
6
|
+
options?: {
|
|
7
|
+
numberOfPoints?: number;
|
|
8
|
+
offset?: number;
|
|
9
|
+
properties?: Properties;
|
|
10
|
+
coordinatePrecision?: number;
|
|
11
|
+
};
|
|
12
|
+
}): Feature<LineString, import("geojson").GeoJsonProperties> | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
2
2
|
import { TerraDrawModeRegisterConfig, TerraDrawModeState } from "../common";
|
|
3
3
|
import { GeoJSONStore, GeoJSONStoreFeatures } from "../store/store";
|
|
4
|
-
|
|
4
|
+
type CustomStyling = Record<string, string | number>;
|
|
5
5
|
export declare abstract class TerraDrawBaseDrawMode<T extends CustomStyling> {
|
|
6
6
|
protected _state: TerraDrawModeState;
|
|
7
7
|
get state(): TerraDrawModeState;
|
|
@@ -14,6 +14,7 @@ export declare abstract class TerraDrawBaseDrawMode<T extends CustomStyling> {
|
|
|
14
14
|
protected coordinatePrecision: number;
|
|
15
15
|
protected onStyleChange: any;
|
|
16
16
|
protected store: GeoJSONStore;
|
|
17
|
+
protected setDoubleClickToZoom: TerraDrawModeRegisterConfig["setDoubleClickToZoom"];
|
|
17
18
|
protected unproject: TerraDrawModeRegisterConfig["unproject"];
|
|
18
19
|
protected project: TerraDrawModeRegisterConfig["project"];
|
|
19
20
|
protected setCursor: TerraDrawModeRegisterConfig["setCursor"];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColor } from "../../common";
|
|
2
2
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
3
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
|
-
|
|
5
|
-
cancel: KeyboardEvent["key"];
|
|
6
|
-
finish: KeyboardEvent["key"];
|
|
4
|
+
type TerraDrawCircleModeKeyEvents = {
|
|
5
|
+
cancel: KeyboardEvent["key"] | null;
|
|
6
|
+
finish: KeyboardEvent["key"] | null;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type FreehandPolygonStyling = {
|
|
9
9
|
fillColor: HexColor;
|
|
10
10
|
outlineColor: HexColor;
|
|
11
11
|
outlineWidth: number;
|
|
@@ -19,19 +19,30 @@ export declare class TerraDrawCircleMode extends TerraDrawBaseDrawMode<FreehandP
|
|
|
19
19
|
private keyEvents;
|
|
20
20
|
constructor(options?: {
|
|
21
21
|
styles?: Partial<FreehandPolygonStyling>;
|
|
22
|
-
keyEvents?: TerraDrawCircleModeKeyEvents;
|
|
22
|
+
keyEvents?: TerraDrawCircleModeKeyEvents | null;
|
|
23
23
|
});
|
|
24
24
|
private close;
|
|
25
|
+
/** @internal */
|
|
25
26
|
start(): void;
|
|
27
|
+
/** @internal */
|
|
26
28
|
stop(): void;
|
|
29
|
+
/** @internal */
|
|
27
30
|
onClick(event: TerraDrawMouseEvent): void;
|
|
31
|
+
/** @internal */
|
|
28
32
|
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
33
|
+
/** @internal */
|
|
29
34
|
onKeyDown(): void;
|
|
35
|
+
/** @internal */
|
|
30
36
|
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
37
|
+
/** @internal */
|
|
31
38
|
onDragStart(): void;
|
|
39
|
+
/** @internal */
|
|
32
40
|
onDrag(): void;
|
|
41
|
+
/** @internal */
|
|
33
42
|
onDragEnd(): void;
|
|
43
|
+
/** @internal */
|
|
34
44
|
cleanUp(): void;
|
|
45
|
+
/** @internal */
|
|
35
46
|
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
36
47
|
}
|
|
37
48
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColor } from "../../common";
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
4
|
-
|
|
5
|
-
cancel: KeyboardEvent["key"];
|
|
6
|
-
finish: KeyboardEvent["key"];
|
|
4
|
+
type TerraDrawFreehandModeKeyEvents = {
|
|
5
|
+
cancel: KeyboardEvent["key"] | null;
|
|
6
|
+
finish: KeyboardEvent["key"] | null;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type FreehandPolygonStyling = {
|
|
9
9
|
fillColor: HexColor;
|
|
10
10
|
outlineColor: HexColor;
|
|
11
11
|
outlineWidth: number;
|
|
@@ -25,19 +25,30 @@ export declare class TerraDrawFreehandMode extends TerraDrawBaseDrawMode<Freehan
|
|
|
25
25
|
constructor(options?: {
|
|
26
26
|
styles?: Partial<FreehandPolygonStyling>;
|
|
27
27
|
minDistance?: number;
|
|
28
|
-
keyEvents?: TerraDrawFreehandModeKeyEvents;
|
|
28
|
+
keyEvents?: TerraDrawFreehandModeKeyEvents | null;
|
|
29
29
|
});
|
|
30
30
|
private close;
|
|
31
|
+
/** @internal */
|
|
31
32
|
start(): void;
|
|
33
|
+
/** @internal */
|
|
32
34
|
stop(): void;
|
|
35
|
+
/** @internal */
|
|
33
36
|
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
37
|
+
/** @internal */
|
|
34
38
|
onClick(event: TerraDrawMouseEvent): void;
|
|
39
|
+
/** @internal */
|
|
35
40
|
onKeyDown(): void;
|
|
41
|
+
/** @internal */
|
|
36
42
|
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
43
|
+
/** @internal */
|
|
37
44
|
onDragStart(): void;
|
|
45
|
+
/** @internal */
|
|
38
46
|
onDrag(): void;
|
|
47
|
+
/** @internal */
|
|
39
48
|
onDragEnd(): void;
|
|
49
|
+
/** @internal */
|
|
40
50
|
cleanUp(): void;
|
|
51
|
+
/** @internal */
|
|
41
52
|
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
42
53
|
}
|
|
43
54
|
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
2
|
+
import { TerraDrawMouseEvent } from "../common";
|
|
3
|
+
import { Position } from "geojson";
|
|
4
|
+
import { ClickBoundingBoxBehavior } from "./click-bounding-box.behavior";
|
|
5
|
+
import { PixelDistanceBehavior } from "./pixel-distance.behavior";
|
|
6
|
+
export declare class GreatCircleSnappingBehavior extends TerraDrawModeBehavior {
|
|
7
|
+
readonly config: BehaviorConfig;
|
|
8
|
+
private readonly pixelDistance;
|
|
9
|
+
private readonly clickBoundingBox;
|
|
10
|
+
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, clickBoundingBox: ClickBoundingBoxBehavior);
|
|
11
|
+
getSnappableCoordinate: (event: TerraDrawMouseEvent, currentFeatureId?: string) => Position | undefined;
|
|
12
|
+
private getSnappableEnds;
|
|
13
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColor } from "../../common";
|
|
2
|
+
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
+
import { BehaviorConfig } from "../base.behavior";
|
|
4
|
+
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
5
|
+
type TerraDrawGreateCircleModeKeyEvents = {
|
|
6
|
+
cancel: KeyboardEvent["key"] | null;
|
|
7
|
+
finish: KeyboardEvent["key"] | null;
|
|
8
|
+
};
|
|
9
|
+
type GreateCircleStyling = {
|
|
10
|
+
lineStringWidth: number;
|
|
11
|
+
lineStringColor: HexColor;
|
|
12
|
+
closingPointColor: HexColor;
|
|
13
|
+
closingPointWidth: number;
|
|
14
|
+
closingPointOutlineColor: HexColor;
|
|
15
|
+
closingPointOutlineWidth: number;
|
|
16
|
+
};
|
|
17
|
+
export declare class TerraDrawGreatCircleMode extends TerraDrawBaseDrawMode<GreateCircleStyling> {
|
|
18
|
+
mode: string;
|
|
19
|
+
private currentCoordinate;
|
|
20
|
+
private currentId;
|
|
21
|
+
private closingPointId;
|
|
22
|
+
private keyEvents;
|
|
23
|
+
private snappingEnabled;
|
|
24
|
+
private snapping;
|
|
25
|
+
constructor(options?: {
|
|
26
|
+
snapping?: boolean;
|
|
27
|
+
pointerDistance?: number;
|
|
28
|
+
styles?: Partial<GreateCircleStyling>;
|
|
29
|
+
keyEvents?: TerraDrawGreateCircleModeKeyEvents | null;
|
|
30
|
+
});
|
|
31
|
+
private close;
|
|
32
|
+
/** @internal */
|
|
33
|
+
registerBehaviors(config: BehaviorConfig): void;
|
|
34
|
+
/** @internal */
|
|
35
|
+
start(): void;
|
|
36
|
+
/** @internal */
|
|
37
|
+
stop(): void;
|
|
38
|
+
/** @internal */
|
|
39
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
40
|
+
/** @internal */
|
|
41
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
42
|
+
/** @internal */
|
|
43
|
+
onKeyDown(): void;
|
|
44
|
+
/** @internal */
|
|
45
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
46
|
+
/** @internal */
|
|
47
|
+
onDragStart(): void;
|
|
48
|
+
/** @internal */
|
|
49
|
+
onDrag(): void;
|
|
50
|
+
/** @internal */
|
|
51
|
+
onDragEnd(): void;
|
|
52
|
+
/** @internal */
|
|
53
|
+
cleanUp(): void;
|
|
54
|
+
/** @internal */
|
|
55
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -2,11 +2,11 @@ import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, H
|
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
5
|
-
|
|
6
|
-
cancel: KeyboardEvent["key"];
|
|
7
|
-
finish: KeyboardEvent["key"];
|
|
5
|
+
type TerraDrawLineStringModeKeyEvents = {
|
|
6
|
+
cancel: KeyboardEvent["key"] | null;
|
|
7
|
+
finish: KeyboardEvent["key"] | null;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type LineStringStyling = {
|
|
10
10
|
lineStringWidth: number;
|
|
11
11
|
lineStringColor: HexColor;
|
|
12
12
|
closingPointColor: HexColor;
|
|
@@ -28,20 +28,32 @@ export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineS
|
|
|
28
28
|
allowSelfIntersections?: boolean;
|
|
29
29
|
pointerDistance?: number;
|
|
30
30
|
styles?: Partial<LineStringStyling>;
|
|
31
|
-
keyEvents?: TerraDrawLineStringModeKeyEvents;
|
|
31
|
+
keyEvents?: TerraDrawLineStringModeKeyEvents | null;
|
|
32
32
|
});
|
|
33
33
|
private close;
|
|
34
|
+
/** @internal */
|
|
34
35
|
registerBehaviors(config: BehaviorConfig): void;
|
|
36
|
+
/** @internal */
|
|
35
37
|
start(): void;
|
|
38
|
+
/** @internal */
|
|
36
39
|
stop(): void;
|
|
40
|
+
/** @internal */
|
|
37
41
|
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
42
|
+
/** @internal */
|
|
38
43
|
onClick(event: TerraDrawMouseEvent): void;
|
|
44
|
+
/** @internal */
|
|
39
45
|
onKeyDown(): void;
|
|
46
|
+
/** @internal */
|
|
40
47
|
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
48
|
+
/** @internal */
|
|
41
49
|
onDragStart(): void;
|
|
50
|
+
/** @internal */
|
|
42
51
|
onDrag(): void;
|
|
52
|
+
/** @internal */
|
|
43
53
|
onDragEnd(): void;
|
|
54
|
+
/** @internal */
|
|
44
55
|
cleanUp(): void;
|
|
56
|
+
/** @internal */
|
|
45
57
|
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
46
58
|
}
|
|
47
59
|
export {};
|
|
@@ -1,26 +1,38 @@
|
|
|
1
1
|
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, HexColor } from "../../common";
|
|
2
2
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
3
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
|
-
|
|
4
|
+
type PointModeStyling = {
|
|
5
5
|
pointWidth: number;
|
|
6
6
|
pointColor: HexColor;
|
|
7
7
|
pointOutlineColor: HexColor;
|
|
8
|
+
pointOutlineWidth: number;
|
|
8
9
|
};
|
|
9
10
|
export declare class TerraDrawPointMode extends TerraDrawBaseDrawMode<PointModeStyling> {
|
|
10
11
|
mode: string;
|
|
11
12
|
constructor(options?: {
|
|
12
13
|
styles?: Partial<PointModeStyling>;
|
|
13
14
|
});
|
|
15
|
+
/** @internal */
|
|
14
16
|
start(): void;
|
|
17
|
+
/** @internal */
|
|
15
18
|
stop(): void;
|
|
19
|
+
/** @internal */
|
|
16
20
|
onClick(event: TerraDrawMouseEvent): void;
|
|
21
|
+
/** @internal */
|
|
17
22
|
onMouseMove(): void;
|
|
23
|
+
/** @internal */
|
|
18
24
|
onKeyDown(): void;
|
|
25
|
+
/** @internal */
|
|
19
26
|
onKeyUp(): void;
|
|
27
|
+
/** @internal */
|
|
20
28
|
cleanUp(): void;
|
|
29
|
+
/** @internal */
|
|
21
30
|
onDragStart(): void;
|
|
31
|
+
/** @internal */
|
|
22
32
|
onDrag(): void;
|
|
33
|
+
/** @internal */
|
|
23
34
|
onDragEnd(): void;
|
|
35
|
+
/** @internal */
|
|
24
36
|
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
25
37
|
}
|
|
26
38
|
export {};
|
|
@@ -2,11 +2,11 @@ import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, H
|
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
5
|
-
|
|
6
|
-
cancel
|
|
7
|
-
finish
|
|
5
|
+
type TerraDrawPolygonModeKeyEvents = {
|
|
6
|
+
cancel?: KeyboardEvent["key"] | null;
|
|
7
|
+
finish?: KeyboardEvent["key"] | null;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type PolygonStyling = {
|
|
10
10
|
fillColor: HexColor;
|
|
11
11
|
outlineColor: HexColor;
|
|
12
12
|
outlineWidth: number;
|
|
@@ -32,20 +32,32 @@ export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonS
|
|
|
32
32
|
snapping?: boolean;
|
|
33
33
|
pointerDistance?: number;
|
|
34
34
|
styles?: Partial<PolygonStyling>;
|
|
35
|
-
keyEvents?: TerraDrawPolygonModeKeyEvents;
|
|
35
|
+
keyEvents?: TerraDrawPolygonModeKeyEvents | null;
|
|
36
36
|
});
|
|
37
37
|
private close;
|
|
38
|
+
/** @internal */
|
|
38
39
|
registerBehaviors(config: BehaviorConfig): void;
|
|
40
|
+
/** @internal */
|
|
39
41
|
start(): void;
|
|
42
|
+
/** @internal */
|
|
40
43
|
stop(): void;
|
|
44
|
+
/** @internal */
|
|
41
45
|
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
46
|
+
/** @internal */
|
|
42
47
|
onClick(event: TerraDrawMouseEvent): void;
|
|
48
|
+
/** @internal */
|
|
43
49
|
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
50
|
+
/** @internal */
|
|
44
51
|
onKeyDown(): void;
|
|
52
|
+
/** @internal */
|
|
45
53
|
onDragStart(): void;
|
|
54
|
+
/** @internal */
|
|
46
55
|
onDrag(): void;
|
|
56
|
+
/** @internal */
|
|
47
57
|
onDragEnd(): void;
|
|
58
|
+
/** @internal */
|
|
48
59
|
cleanUp(): void;
|
|
60
|
+
/** @internal */
|
|
49
61
|
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
50
62
|
}
|
|
51
63
|
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColor } from "../../common";
|
|
2
|
+
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
|
+
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
|
+
type TerraDrawRectangleModeKeyEvents = {
|
|
5
|
+
cancel: KeyboardEvent["key"] | null;
|
|
6
|
+
finish: KeyboardEvent["key"] | null;
|
|
7
|
+
};
|
|
8
|
+
type FreehandPolygonStyling = {
|
|
9
|
+
fillColor: HexColor;
|
|
10
|
+
outlineColor: HexColor;
|
|
11
|
+
outlineWidth: number;
|
|
12
|
+
fillOpacity: number;
|
|
13
|
+
};
|
|
14
|
+
export declare class TerraDrawRectangleMode extends TerraDrawBaseDrawMode<FreehandPolygonStyling> {
|
|
15
|
+
mode: string;
|
|
16
|
+
private center;
|
|
17
|
+
private clickCount;
|
|
18
|
+
private currentRectangleId;
|
|
19
|
+
private keyEvents;
|
|
20
|
+
constructor(options?: {
|
|
21
|
+
styles?: Partial<FreehandPolygonStyling>;
|
|
22
|
+
keyEvents?: TerraDrawRectangleModeKeyEvents | null;
|
|
23
|
+
});
|
|
24
|
+
private close;
|
|
25
|
+
/** @internal */
|
|
26
|
+
start(): void;
|
|
27
|
+
/** @internal */
|
|
28
|
+
stop(): void;
|
|
29
|
+
/** @internal */
|
|
30
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
31
|
+
/** @internal */
|
|
32
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
33
|
+
/** @internal */
|
|
34
|
+
onKeyDown(): void;
|
|
35
|
+
/** @internal */
|
|
36
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
37
|
+
/** @internal */
|
|
38
|
+
onDragStart(): void;
|
|
39
|
+
/** @internal */
|
|
40
|
+
onDrag(): void;
|
|
41
|
+
/** @internal */
|
|
42
|
+
onDragEnd(): void;
|
|
43
|
+
/** @internal */
|
|
44
|
+
cleanUp(): void;
|
|
45
|
+
/** @internal */
|
|
46
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
47
|
+
}
|
|
48
|
+
export {};
|