terra-draw 0.0.1-alpha.43 → 0.0.1-alpha.45

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +2 -1
  3. package/dist/adapters/common/base.adapter.d.ts +2 -0
  4. package/dist/common.d.ts +5 -1
  5. package/dist/modes/circle/circle.mode.d.ts +9 -4
  6. package/dist/modes/freehand/freehand.mode.d.ts +7 -1
  7. package/dist/modes/greatcircle/great-circle.mode.d.ts +7 -1
  8. package/dist/modes/linestring/linestring.mode.d.ts +7 -1
  9. package/dist/modes/point/point.mode.d.ts +6 -1
  10. package/dist/modes/polygon/polygon.mode.d.ts +7 -1
  11. package/dist/modes/rectangle/rectangle.mode.d.ts +6 -1
  12. package/dist/modes/render/render.mode.d.ts +1 -0
  13. package/dist/modes/select/select.mode.d.ts +9 -1
  14. package/dist/terra-draw.cjs +1 -1
  15. package/dist/terra-draw.cjs.map +1 -1
  16. package/dist/terra-draw.d.ts +1 -3
  17. package/dist/terra-draw.modern.js +1 -1
  18. package/dist/terra-draw.modern.js.map +1 -1
  19. package/dist/terra-draw.module.js +1 -1
  20. package/dist/terra-draw.module.js.map +1 -1
  21. package/dist/terra-draw.umd.js +1 -1
  22. package/dist/terra-draw.umd.js.map +1 -1
  23. package/guides/COMMON_PATTERNS.md +157 -0
  24. package/guides/GETTING_STARTED.md +13 -129
  25. package/package.json +2 -1
  26. package/scratch/release.sh +5 -5
  27. package/dist/adapters/common/base-adapter.d.ts +0 -31
  28. package/dist/bundle.js +0 -6
  29. package/dist/bundle.js.LICENSE.txt +0 -4
  30. package/dist/extend-types.d.ts +0 -4
  31. package/dist/geometry/create-circle.d.ts +0 -6
  32. package/dist/geometry/get-pixel-distance-to-line.d.ts +0 -10
  33. package/dist/geometry/get-pixel-distance.d.ts +0 -7
  34. package/dist/geometry/haversine-distance.d.ts +0 -1
  35. package/dist/geometry/point-in-polygon.d.ts +0 -1
  36. package/dist/geometry/self-intersects.d.ts +0 -2
  37. package/dist/modes/circle.mode.d.ts +0 -18
  38. package/dist/modes/freehand.mode.d.ts +0 -20
  39. package/dist/modes/line-string.mode.d.ts +0 -21
  40. package/dist/modes/point.mode.d.ts +0 -14
  41. package/dist/modes/polygon/behaviors/start-end-point.behavior.d.ts +0 -11
  42. package/dist/modes/polygon.mode.d.ts +0 -21
  43. package/dist/modes/select.mode.d.ts +0 -21
  44. package/dist/modes/static.mode.d.ts +0 -10
@@ -0,0 +1,157 @@
1
+ # Common Patterns
2
+
3
+ ### Changing Mode
4
+
5
+ To change mode we need to set the current mode to match the name of the mode we want. You can see the name of the mode in each modes 'mode' property in the modes source file. For convenience here are the built in mode names listed out:
6
+
7
+ * TerraDrawStaticMode - 'static'
8
+ * TerraDrawPolygonMode - 'polygon'
9
+ * TerraDrawPointMode - 'point'
10
+ * TerraDrawCircleMode - 'circle'
11
+ * TerraDrawLineStringMode - 'linestring'
12
+ * TerraDrawSelectMode - 'select'
13
+ * TerraDrawLineStringMode - 'freehand'
14
+ * TerraDraqwGreatCircleMode - 'greatcircle'
15
+
16
+ We can then create these modes and change to them like so:
17
+
18
+ ```typescript
19
+ const draw = new TerraDraw({
20
+ adapter: new TerraDrawLeafletAdapter({
21
+ lib: L,
22
+ map,
23
+ coordinatePrecision: 9,
24
+ }),
25
+ modes: [
26
+ new TerraDrawPolygonMode(), // Polygon mode has a builtin name 'polygon'
27
+ new TerraDrawRenderMode({ modeName: 'arbitary' }) // Render modes are given custom names
28
+ ],
29
+ });
30
+
31
+ draw.start();
32
+
33
+ // Change to our TerraDrawPolygonMode instance
34
+ draw.setMode('polygon')
35
+
36
+ // We can use our custom render mode name to change to it.
37
+ draw.setMode('arbitary')
38
+
39
+ ```
40
+
41
+
42
+ ### Loading in External Data
43
+
44
+ It is common pattern to want to load in data from an external source (GeoJSON file, API call, etc). This can be achieved with the `addFeatures` method on the Terra Draw instance. The method call works out which mode to add the feature based on looking at its `mode` property in the Features `properties` property. All modes have a method called `validateFeature` that ensures that a given feature is valid for the mode. For example if you wanted to add a series of points to the TerraDrawPointMode you could do this by ensuring that the points you feed in have the `mode` property set to `point`.
45
+
46
+ ```javascript
47
+ points.forEach((point) => {
48
+ point.properties.mode = "point";
49
+ });
50
+
51
+ draw.addFeatures(points);
52
+ ```
53
+
54
+ ### Render Contextual Data with TerraDrawRenderMode
55
+
56
+ If you just want to render some data onto the map without needing to add drawing data to it, you can use `TerraDrawRenderMode` in combination with `addFeatures` like so:
57
+
58
+ ```javascript
59
+ const draw = new TerraDraw({
60
+ adapter: new TerraDrawLeafletAdapter({
61
+ lib: L,
62
+ map,
63
+ coordinatePrecision: 9,
64
+ }),
65
+ modes: [new TerraDrawRenderMode({ modeName: 'arbitary' })],
66
+ });
67
+
68
+ draw.start();
69
+
70
+ points.forEach((point) => {
71
+ point.properties.mode = "arbitary";
72
+ });
73
+
74
+ draw.addFeatures(points);
75
+
76
+ // This will add the points to hte TerraDrawRenderMode 'arbitary' rendering them to the screen
77
+ ```
78
+
79
+ ### Styling Selected Data
80
+
81
+ To style selected data you will want to past styles to the select mode you are using (probably TerraDrawSelectMode).
82
+
83
+ ```typescript
84
+ const draw = new TerraDraw({
85
+ adapter: new TerraDrawMapboxGLAdapter({
86
+ map,
87
+ coordinatePrecision: 9,
88
+ }),
89
+ modes: [
90
+ new TerraDrawPolygonMode(),
91
+ new TerraDrawSelectMode({
92
+ flags: {
93
+ polygon: {
94
+ feature: {
95
+ draggable: true,
96
+ coordinates: {
97
+ midpoints: true,
98
+ draggable: true,
99
+ deletable: true,
100
+ },
101
+ },
102
+ },
103
+ },
104
+ styles: {
105
+ selectedPolygonColor: "#222222", // Any hex color you like
106
+ selectedPolygonFillOpacity: 0.7, // 0 - 1
107
+ selectedPolygonOutlineColor: "#333333", // Any hex color you like
108
+ selectedPolygonOutlineWidth: 2, // Integer
109
+ },
110
+ }),
111
+ ]
112
+ });
113
+
114
+ draw.start();
115
+ ```
116
+
117
+ Please note at the moment it is not possible to style against specific modes but only universally against geometry type (Point, LineString, Polygon)
118
+
119
+ ### Styling Specific Features
120
+
121
+ Terra Draw supports styling overrides of individual features if required. This can be achieved by providing a styling function rather than a string or a number to a feature. As an example here we can style each polygon feature as a random color:
122
+
123
+ ```typescript
124
+ // Function to generate a random hex color - can adjust as needed
125
+ function getRandomColor() {
126
+ const letters = "0123456789ABCDEF";
127
+ let color = "#";
128
+ for (let i = 0; i < 6; i++) {
129
+ color += letters[Math.floor(Math.random() * 16)];
130
+ }
131
+ return color;
132
+ }
133
+
134
+ // Cache for each feature id mapped to a hex color string
135
+ const colorCache: Record<string, HexColor> = {};
136
+
137
+ const draw = new TerraDraw({
138
+ adapter: new TerraDrawMapboxGLAdapter({
139
+ map, // Assume this is defined further up
140
+ coordinatePrecision: 9,
141
+ }),
142
+ modes: [
143
+ new TerraDrawPolygonMode({
144
+ styles: {
145
+ fillColor: ({ id }) => {
146
+ // Get the color from the cache or generate a new one
147
+ colorCache[id] = colorCache[id] || getRandomColor();
148
+ return colorCache[id];
149
+ },
150
+ },
151
+ }),
152
+ ]
153
+ });
154
+
155
+ // Ensure the color cache is clead up on deletion of features
156
+ draw.on("delete", (ids) => ids.forEach((id) => delete cache[id]));
157
+ ```
@@ -22,7 +22,11 @@ Once terra-draw is out of alpha this suggestion will be removed as we will aim t
22
22
 
23
23
  You can find the full autogenerated [API docs on the terra draw website](https://terradraw.io/#/api)
24
24
 
25
- ## Using Terra Draw
25
+ ## Common Patterns
26
+
27
+ A selection of common things you may want to do with Terra Draw is available via the [common patterns guide in this folder](./COMMON_PATTERNS.md). If you think something is missing please raise an issue!
28
+
29
+ ## Adapters
26
30
 
27
31
  Terra Draw can be used with a set of different adapters to allow you to use it with your mapping library of choice. Each adapter has slightly different configuration but the API is the same for them all. For a deeper explanation about what adapters are and how to write you own see the [development guide](./DEVELOPMENT.md).
28
32
 
@@ -74,8 +78,8 @@ const draw = new TerraDraw({
74
78
 
75
79
  // Modes is an object containing all the modes we wish to
76
80
  // instantiate Terra Draw with
77
- modes: {
78
- select: new TerraDrawSelectMode({
81
+ modes: [
82
+ new TerraDrawSelectMode({
79
83
  flags: {
80
84
  // Following flags determine what you can do in
81
85
  // select mode for features of a given mode - in this case polygon
@@ -93,11 +97,11 @@ const draw = new TerraDraw({
93
97
  },
94
98
  },
95
99
  }),
96
- polygon: new TerraDrawPolygonMode({
100
+ new TerraDrawPolygonMode({
97
101
  allowSelfIntersections: false,
98
102
  pointerDistance: 30,
99
103
  }),
100
- },
104
+ ]
101
105
  });
102
106
 
103
107
  // Start drawing
@@ -151,8 +155,8 @@ loader.load().then((google) => {
151
155
  map,
152
156
  coordinatePrecision: 9,
153
157
  }),
154
- modes: {
155
- select: new TerraDrawSelectMode({
158
+ modes: [
159
+ new TerraDrawSelectMode({
156
160
  flags: {
157
161
  // Following flags determine what you can do in
158
162
  // select mode for features of a given mode - in this case polygon
@@ -170,11 +174,11 @@ loader.load().then((google) => {
170
174
  },
171
175
  },
172
176
  }),
173
- polygon: new TerraDrawPolygonMode({
177
+ new TerraDrawPolygonMode({
174
178
  allowSelfIntersections: false,
175
179
  pointerDistance: 30,
176
180
  }),
177
- },
181
+ ]
178
182
  });
179
183
 
180
184
  // Start drawing
@@ -210,123 +214,3 @@ The [development folder features an example](https://github.com/JamesLMilner/ter
210
214
 
211
215
  The [Terra Draw official website](https://github.com/JamesLMilner/terra-draw-website) is open source acts as a full working implementation of how to use Terra Draw. In this case it is used with popular framework Preact (has very similar API to React).
212
216
 
213
- ## Common Patterns
214
-
215
- ### Loading in External Data
216
-
217
- It is common pattern to want to load in data from an external source (GeoJSON file, API call, etc). This can be achieved with the `addFeatures` method on the Terra Draw instance. The method call works out which mode to add the feature based on looking at its `mode` property in the Features `properties` property. All modes have a method called `validateFeature` that ensures that a given feature is valid for the mode. For example if you wanted to add a series of points to the TerraDrawPointMode you could do this by ensuring that the points you feed in have the `mode` property set to `point`.
218
-
219
- ```javascript
220
- points.forEach((point) => {
221
- point.properties.mode = "point";
222
- });
223
-
224
- draw.addFeatures(points);
225
- ```
226
-
227
- ### Render Only Modes with TerraDrawRenderMode
228
-
229
- If you just want to render some data onto the map without it being editable, you can use `TerraDrawRenderMode` in combination with `addFeatures` like so:
230
-
231
- ```javascript
232
- const draw = new TerraDraw({
233
- adapter: new TerraDrawLeafletAdapter({
234
- lib: L,
235
- map,
236
- coordinatePrecision: 9,
237
- }),
238
- modes: {
239
- arbitary: new TerraDrawRenderMode(),
240
- },
241
- });
242
-
243
- draw.start();
244
-
245
- points.forEach((point) => {
246
- point.properties.mode = "arbitary";
247
- });
248
-
249
- draw.addFeatures(points);
250
-
251
- // This will add the points to hte TerraDrawRenderMode 'arbitary' rendering them to the screen
252
- ```
253
-
254
- ### Styling Selected Data
255
-
256
- To style selected data you will want to past styles to the select mode you are using (probably TerraDrawSelectMode).
257
-
258
- ```typescript
259
- const draw = new TerraDraw({
260
- adapter: new TerraDrawMapboxGLAdapter({
261
- map,
262
- coordinatePrecision: 9,
263
- }),
264
- modes: {
265
- polygon: new TerraDrawPolygonMode(),
266
- select: new TerraDrawSelectMode({
267
- flags: {
268
- polygon: {
269
- feature: {
270
- draggable: true,
271
- coordinates: {
272
- midpoints: true,
273
- draggable: true,
274
- deletable: true,
275
- },
276
- },
277
- },
278
- },
279
- styles: {
280
- selectedPolygonColor: "#222222", // Any hex color you like
281
- selectedPolygonFillOpacity: 0.7, // 0 - 1
282
- selectedPolygonOutlineColor: "#333333", // Any hex color you like
283
- selectedPolygonOutlineWidth: 2, // Integer
284
- },
285
- }),
286
- },
287
- });
288
-
289
- draw.start();
290
- ```
291
-
292
- Please note at the moment it is not possible to style against specific modes but only universally against geometry type (Point, LineString, Polygon)
293
-
294
- ## Styling Specific Features
295
-
296
- Terra Draw supports styling overrides of individual features if required. This can be achieved by providing a styling function rather than a string or a number to a feature. As an example here we can style each polygon feature as a random color:
297
-
298
- ```typescript
299
- // Function to generate a random hex color - can adjust as needed
300
- function getRandomColor() {
301
- const letters = "0123456789ABCDEF";
302
- let color = "#";
303
- for (let i = 0; i < 6; i++) {
304
- color += letters[Math.floor(Math.random() * 16)];
305
- }
306
- return color;
307
- }
308
-
309
- // Cache for each feature id mapped to a hex color string
310
- const colorCache: Record<string, HexColor> = {};
311
-
312
- const draw = new TerraDraw({
313
- adapter: new TerraDrawMapboxGLAdapter({
314
- map, // Assume this is defined further up
315
- coordinatePrecision: 9,
316
- }),
317
- modes: {
318
- polygon: new TerraDrawPolygonMode({
319
- styles: {
320
- fillColor: ({ id }) => {
321
- // Get the color from the cache or generate a new one
322
- colorCache[id] = colorCache[id] || getRandomColor();
323
- return colorCache[id];
324
- },
325
- },
326
- }),
327
- },
328
- });
329
-
330
- // Ensure the color cache is clead up on deletion of features
331
- draw.on("delete", (ids) => ids.forEach((id) => delete cache[id]));
332
- ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terra-draw",
3
- "version": "0.0.1-alpha.43",
3
+ "version": "0.0.1-alpha.45",
4
4
  "description": "Frictionless map drawing across mapping provider",
5
5
  "scripts": {
6
6
  "docs": "typedoc",
@@ -50,6 +50,7 @@
50
50
  "maplibre"
51
51
  ],
52
52
  "devDependencies": {
53
+ "@arcgis/core": "^4.27.6",
53
54
  "@commitlint/cli": "^17.1.2",
54
55
  "@commitlint/config-conventional": "^17.1.0",
55
56
  "@googlemaps/js-api-loader": "^1.14.3",
@@ -1,5 +1,5 @@
1
- npm run docs
2
- npm run build
3
- npm run release -- --prerelease --release-as 0.0.1-alpha.40
4
- git push origin main --tags
5
- npm publish
1
+
2
+
3
+
4
+ npm run release -- --prerelease --release-as 0.0.1-alpha.45
5
+ git push --follow-tags origin main
@@ -1,31 +0,0 @@
1
- import { Project, Unproject, TerraDrawCallbacks, TerraDrawChanges, TerraDrawMouseEvent, SetCursor, TerraDrawStylingFunction } from "../../common";
2
- import { AdapterListener } from "./adapter-listener";
3
- export declare abstract class TerraDrawAdapterBase {
4
- constructor(config: {
5
- coordinatePrecision?: number;
6
- minPixelDragDistance?: number;
7
- });
8
- protected dragConter: number;
9
- protected _minPixelDragDistance: number;
10
- protected _lastDrawEvent: TerraDrawMouseEvent | undefined;
11
- protected _coordinatePrecision: number;
12
- protected _heldKeys: Set<string>;
13
- protected listeners: AdapterListener[];
14
- protected dragState: "not-dragging" | "pre-dragging" | "dragging";
15
- protected currentModeCallbacks: TerraDrawCallbacks | undefined;
16
- protected getButton(event: PointerEvent): "neither" | "left" | "middle" | "right";
17
- protected getDrawEventFromPointerEvent(event: PointerEvent): TerraDrawMouseEvent;
18
- abstract project(...args: Parameters<Project>): ReturnType<Project>;
19
- abstract unproject(...args: Parameters<Unproject>): ReturnType<Unproject>;
20
- abstract setCursor(...args: Parameters<SetCursor>): ReturnType<SetCursor>;
21
- abstract getLngLatFromPointerEvent(event: PointerEvent): {
22
- lng: number;
23
- lat: number;
24
- };
25
- abstract setDraggability(enabled: boolean): void;
26
- abstract setDoubleClickToZoom(enabled: boolean): void;
27
- abstract getMapContainer(): HTMLElement;
28
- abstract register(callbacks: TerraDrawCallbacks): void;
29
- abstract unregister(): void;
30
- abstract render(changes: TerraDrawChanges, styling: TerraDrawStylingFunction): void;
31
- }
package/dist/bundle.js DELETED
@@ -1,6 +0,0 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/
4
- /******/
5
- /******/ })()
6
- ;
@@ -1,4 +0,0 @@
1
- /* @preserve
2
- * Leaflet 1.8.0, a JS library for interactive maps. https://leafletjs.com
3
- * (c) 2010-2022 Vladimir Agafonkin, (c) 2010-2011 CloudMade
4
- */
@@ -1,4 +0,0 @@
1
- import { GetLngLatFromEvent, Project, SetCursor, TerraDrawChanges, TerraDrawStylingFunction, Unproject } from "./common";
2
- import { BehaviorConfig } from "./modes/base.behavior";
3
- import { GeoJSONStoreFeatures } from "./store/store";
4
- export { BehaviorConfig, GeoJSONStoreFeatures, TerraDrawChanges, TerraDrawStylingFunction, Project, Unproject, SetCursor, GetLngLatFromEvent, };
@@ -1,6 +0,0 @@
1
- import { Feature, Polygon } from "geojson";
2
- export declare function circle(options: {
3
- center: [number, number];
4
- radiusKilometers: number;
5
- steps?: number;
6
- }): Feature<Polygon>;
@@ -1,10 +0,0 @@
1
- export declare const getPixelDistanceToLine: (point: {
2
- x: number;
3
- y: number;
4
- }, linePointOne: {
5
- x: number;
6
- y: number;
7
- }, linePointTwo: {
8
- x: number;
9
- y: number;
10
- }) => number;
@@ -1,7 +0,0 @@
1
- export declare const getPixelDistance: (pointOne: {
2
- x: number;
3
- y: number;
4
- }, pointTwo: {
5
- x: number;
6
- y: number;
7
- }) => number;
@@ -1 +0,0 @@
1
- export declare function haversineDistanceKilometers(pointOne: [lng: number, lat: number], pointTwo: [lng: number, lat: number]): number;
@@ -1 +0,0 @@
1
- export declare function pointInPolygon(point: [number, number], rings: [number, number][][]): boolean;
@@ -1,2 +0,0 @@
1
- import { Feature, LineString, Polygon } from "geojson";
2
- export declare function selfIntersects(feature: Feature<Polygon> | Feature<LineString>): boolean;
@@ -1,18 +0,0 @@
1
- import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../common";
2
- export declare class TerraDrawCircleMode implements TerraDrawMode {
3
- mode: string;
4
- private store;
5
- private project;
6
- private center;
7
- private clickCount;
8
- private currentCircleId;
9
- constructor(options?: {
10
- styling?: Partial<TerraDrawAdapterStyling>;
11
- });
12
- styling: TerraDrawAdapterStyling;
13
- register(config: TerraDrawModeRegisterConfig): void;
14
- onClick(event: TerraDrawMouseEvent): void;
15
- onMouseMove(event: TerraDrawMouseEvent): void;
16
- onKeyPress(event: TerraDrawKeyboardEvent): void;
17
- cleanUp(): void;
18
- }
@@ -1,20 +0,0 @@
1
- import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../common";
2
- export declare class TerraDrawFreehandMode implements TerraDrawMode {
3
- mode: string;
4
- private store;
5
- private project;
6
- private startingClick;
7
- private currentId;
8
- private skip;
9
- private everyNthMouseEvent;
10
- constructor(options?: {
11
- styling?: Partial<TerraDrawAdapterStyling>;
12
- everyNthMouseEvent?: number;
13
- });
14
- styling: TerraDrawAdapterStyling;
15
- register(config: TerraDrawModeRegisterConfig): void;
16
- onMouseMove(event: TerraDrawMouseEvent): void;
17
- onClick(event: TerraDrawMouseEvent): void;
18
- onKeyPress(event: TerraDrawKeyboardEvent): void;
19
- cleanUp(): void;
20
- }
@@ -1,21 +0,0 @@
1
- import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../common";
2
- export declare class TerraDrawLineStringMode implements TerraDrawMode {
3
- mode: string;
4
- private store;
5
- private project;
6
- private pointerDistance;
7
- private currentCoordinate;
8
- private currentId;
9
- private allowSelfIntersections;
10
- constructor(options?: {
11
- allowSelfIntersections?: boolean;
12
- styling?: Partial<TerraDrawAdapterStyling>;
13
- pointerDistance?: number;
14
- });
15
- styling: TerraDrawAdapterStyling;
16
- register(config: TerraDrawModeRegisterConfig): void;
17
- onMouseMove(event: TerraDrawMouseEvent): void;
18
- onClick(event: TerraDrawMouseEvent): void;
19
- onKeyPress(event: TerraDrawKeyboardEvent): void;
20
- cleanUp(): void;
21
- }
@@ -1,14 +0,0 @@
1
- import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling } from "../common";
2
- export declare class TerraDrawPointMode implements TerraDrawMode {
3
- mode: string;
4
- private store;
5
- constructor(options?: {
6
- styling?: Partial<TerraDrawAdapterStyling>;
7
- });
8
- styling: TerraDrawAdapterStyling;
9
- register(config: TerraDrawModeRegisterConfig): void;
10
- onClick(event: TerraDrawMouseEvent): void;
11
- onMouseMove(): void;
12
- onKeyPress(): void;
13
- cleanUp(): void;
14
- }
@@ -1,11 +0,0 @@
1
- import { Position } from "geojson";
2
- import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
3
- export declare class StartEndPointBehavior extends TerraDrawModeBehavior {
4
- constructor(config: BehaviorConfig);
5
- private _startEndPoints;
6
- get ids(): string[];
7
- set ids(_: string[]);
8
- create(selectedCoords: Position[], mode: string): void;
9
- delete(): void;
10
- update(updatedCoordinates: Position[]): void;
11
- }
@@ -1,21 +0,0 @@
1
- import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../common";
2
- export declare class TerraDrawPolygonMode implements TerraDrawMode {
3
- mode: string;
4
- private store;
5
- private project;
6
- private currentCoordinate;
7
- private currentId;
8
- private allowSelfIntersections;
9
- private pointerDistance;
10
- constructor(options?: {
11
- allowSelfIntersections?: boolean;
12
- styling?: Partial<TerraDrawAdapterStyling>;
13
- pointerDistance?: number;
14
- });
15
- styling: TerraDrawAdapterStyling;
16
- register(config: TerraDrawModeRegisterConfig): void;
17
- onMouseMove(event: TerraDrawMouseEvent): void;
18
- onClick(event: TerraDrawMouseEvent): void;
19
- onKeyPress(event: TerraDrawKeyboardEvent): void;
20
- cleanUp(): void;
21
- }
@@ -1,21 +0,0 @@
1
- import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawKeyboardEvent, TerraDrawAdapterStyling } from "../common";
2
- export declare class TerraDrawSelectMode implements TerraDrawMode {
3
- mode: string;
4
- private store;
5
- private project;
6
- private selected;
7
- private pointerDistance;
8
- private selectionPoints;
9
- constructor(options?: {
10
- styling?: Partial<TerraDrawAdapterStyling>;
11
- pointerDistance?: number;
12
- });
13
- styling: TerraDrawAdapterStyling;
14
- onClick(event: TerraDrawMouseEvent): void;
15
- onKeyPress(event: TerraDrawKeyboardEvent): void;
16
- cleanUp(): void;
17
- onMouseMove(): void;
18
- register(config: TerraDrawModeRegisterConfig): void;
19
- onDeselect(deselectedId: string): void;
20
- onSelect(selectedId: string): void;
21
- }
@@ -1,10 +0,0 @@
1
- import { TerraDrawAdapterStyling, TerraDrawMode } from "../common";
2
- export declare class TerraDrawStaticMode implements TerraDrawMode {
3
- mode: string;
4
- styling: TerraDrawAdapterStyling;
5
- register(): void;
6
- onKeyPress(): void;
7
- onClick(): void;
8
- onMouseMove(): void;
9
- cleanUp(): void;
10
- }