terra-draw 0.0.1-alpha.44 → 0.0.1-alpha.47
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 -1
- package/dist/adapters/common/base.adapter.d.ts +4 -0
- package/dist/common.d.ts +7 -2
- package/dist/geometry/shape/create-bbox.d.ts +10 -0
- package/dist/modes/circle/circle.mode.d.ts +9 -4
- package/dist/modes/click-bounding-box.behavior.d.ts +1 -2
- package/dist/modes/freehand/freehand.mode.d.ts +7 -1
- package/dist/modes/greatcircle/great-circle.mode.d.ts +7 -1
- package/dist/modes/linestring/linestring.mode.d.ts +7 -1
- package/dist/modes/point/point.mode.d.ts +6 -1
- package/dist/modes/polygon/polygon.mode.d.ts +7 -1
- package/dist/modes/rectangle/rectangle.mode.d.ts +6 -1
- package/dist/modes/render/render.mode.d.ts +1 -0
- package/dist/modes/select/behaviors/drag-coordinate.behavior.d.ts +1 -1
- package/dist/modes/select/behaviors/drag-feature.behavior.d.ts +2 -2
- package/dist/modes/select/behaviors/feature-at-pointer-event.behavior.d.ts +15 -0
- package/dist/modes/select/select.mode.d.ts +11 -1
- package/dist/modes/snapping.behavior.d.ts +2 -0
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- package/dist/terra-draw.d.ts +27 -3
- 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 +2 -1
- package/CHANGELOG.md +0 -409
- package/dist/adapters/common/base-adapter.d.ts +0 -31
- package/dist/bundle.js +0 -6
- package/dist/bundle.js.LICENSE.txt +0 -4
- package/dist/extend-types.d.ts +0 -4
- package/dist/geometry/create-circle.d.ts +0 -6
- package/dist/geometry/get-pixel-distance-to-line.d.ts +0 -10
- package/dist/geometry/get-pixel-distance.d.ts +0 -7
- package/dist/geometry/haversine-distance.d.ts +0 -1
- package/dist/geometry/point-in-polygon.d.ts +0 -1
- package/dist/geometry/self-intersects.d.ts +0 -2
- package/dist/modes/circle.mode.d.ts +0 -18
- package/dist/modes/freehand.mode.d.ts +0 -20
- package/dist/modes/line-string.mode.d.ts +0 -21
- package/dist/modes/point.mode.d.ts +0 -14
- package/dist/modes/polygon/behaviors/start-end-point.behavior.d.ts +0 -11
- package/dist/modes/polygon.mode.d.ts +0 -21
- package/dist/modes/select.mode.d.ts +0 -21
- package/dist/modes/static.mode.d.ts +0 -10
- package/guides/CODE_OF_CONDUCT.md +0 -36
- package/guides/CONTRIBUTING.md +0 -17
- package/guides/DEVELOPMENT.md +0 -156
- package/guides/GETTING_STARTED.md +0 -332
- package/jest.config.ts +0 -27
- package/logo.png +0 -0
- package/scratch/release.sh +0 -5
- package/scripts/next-alpha-version.ts +0 -21
package/README.md
CHANGED
|
@@ -18,10 +18,11 @@ Terra Draw uses the concept of 'adapters' to allow it to work with a host of dif
|
|
|
18
18
|
- [Mapbox GL JS](https://www.mapbox.com/mapbox-gljs) v2
|
|
19
19
|
- [MapLibre](https://maplibre.org/projects/maplibre-gl-js/) v2/v3
|
|
20
20
|
- [Google Maps JS API](https://developers.google.com/maps/documentation/javascript/overview) v3
|
|
21
|
+
- [ArcGIS JavaScript SDK](https://developers.arcgis.com/javascript/latest/) v4 (MapView)
|
|
21
22
|
|
|
22
23
|
### Getting Started
|
|
23
24
|
|
|
24
|
-
Please see the [the getting started guide](./guides/GETTING_STARTED.md)
|
|
25
|
+
Please see the [the getting started guide](./guides/GETTING_STARTED.md) - this provides a host of information on how get up and running with Terra Draw. You may also find some useful pointers for things you may be finding yourself wanting to do in the [common patterns guide](./guides/COMMON_PATTERNS.md).
|
|
25
26
|
|
|
26
27
|
### Development
|
|
27
28
|
|
|
@@ -6,9 +6,13 @@ type BaseMouseListener = (event: MouseEvent) => void;
|
|
|
6
6
|
export declare abstract class TerraDrawBaseAdapter {
|
|
7
7
|
constructor(config: {
|
|
8
8
|
coordinatePrecision?: number;
|
|
9
|
+
minPixelDragDistanceDrawing?: number;
|
|
9
10
|
minPixelDragDistance?: number;
|
|
11
|
+
minPixelDragDistanceSelecting?: number;
|
|
10
12
|
});
|
|
11
13
|
protected _minPixelDragDistance: number;
|
|
14
|
+
protected _minPixelDragDistanceDrawing: number;
|
|
15
|
+
protected _minPixelDragDistanceSelecting: number;
|
|
12
16
|
protected _lastDrawEvent: TerraDrawMouseEvent | undefined;
|
|
13
17
|
protected _coordinatePrecision: number;
|
|
14
18
|
protected _heldKeys: Set<string>;
|
package/dist/common.d.ts
CHANGED
|
@@ -28,7 +28,11 @@ export interface TerraDrawKeyboardEvent {
|
|
|
28
28
|
heldKeys: string[];
|
|
29
29
|
preventDefault: () => void;
|
|
30
30
|
}
|
|
31
|
-
export type
|
|
31
|
+
export type Required<T> = {
|
|
32
|
+
[P in keyof T]-?: T[P];
|
|
33
|
+
};
|
|
34
|
+
export type Cursor = Parameters<SetCursor>[0];
|
|
35
|
+
export type SetCursor = (cursor: "unset" | "grab" | "grabbing" | "crosshair" | "pointer" | "wait" | "move") => void;
|
|
32
36
|
export type Project = (lng: number, lat: number) => {
|
|
33
37
|
x: number;
|
|
34
38
|
y: number;
|
|
@@ -53,7 +57,7 @@ export interface TerraDrawModeRegisterConfig {
|
|
|
53
57
|
project: Project;
|
|
54
58
|
unproject: Unproject;
|
|
55
59
|
}
|
|
56
|
-
export type TerraDrawModeState = "unregistered" | "registered" | "started" | "drawing" | "
|
|
60
|
+
export type TerraDrawModeState = "unregistered" | "registered" | "started" | "drawing" | "selecting" | "stopped";
|
|
57
61
|
export interface TerraDrawCallbacks {
|
|
58
62
|
getState: () => TerraDrawModeState;
|
|
59
63
|
onKeyUp: (event: TerraDrawKeyboardEvent) => void;
|
|
@@ -78,6 +82,7 @@ export interface TerraDrawAdapter {
|
|
|
78
82
|
project: Project;
|
|
79
83
|
unproject: Unproject;
|
|
80
84
|
setCursor: SetCursor;
|
|
85
|
+
getLngLatFromEvent: GetLngLatFromEvent;
|
|
81
86
|
setDoubleClickToZoom: (enabled: boolean) => void;
|
|
82
87
|
getMapContainer: () => HTMLElement;
|
|
83
88
|
register(callbacks: TerraDrawCallbacks): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Feature, Polygon } from "geojson";
|
|
2
|
+
import { Unproject } from "../../common";
|
|
3
|
+
export declare function createBBoxFromPoint({ unproject, point, pointerDistance, }: {
|
|
4
|
+
point: {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
};
|
|
8
|
+
unproject: Unproject;
|
|
9
|
+
pointerDistance: number;
|
|
10
|
+
}): Feature<Polygon, import("geojson").GeoJsonProperties>;
|
|
@@ -1,25 +1,30 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
2
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
3
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
4
|
type TerraDrawCircleModeKeyEvents = {
|
|
5
5
|
cancel: KeyboardEvent["key"] | null;
|
|
6
6
|
finish: KeyboardEvent["key"] | null;
|
|
7
7
|
};
|
|
8
|
-
type
|
|
8
|
+
type CirclePolygonStyling = {
|
|
9
9
|
fillColor: HexColorStyling;
|
|
10
10
|
outlineColor: HexColorStyling;
|
|
11
11
|
outlineWidth: NumericStyling;
|
|
12
12
|
fillOpacity: NumericStyling;
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
interface Cursors {
|
|
15
|
+
start?: Cursor;
|
|
16
|
+
}
|
|
17
|
+
export declare class TerraDrawCircleMode extends TerraDrawBaseDrawMode<CirclePolygonStyling> {
|
|
15
18
|
mode: string;
|
|
16
19
|
private center;
|
|
17
20
|
private clickCount;
|
|
18
21
|
private currentCircleId;
|
|
19
22
|
private keyEvents;
|
|
23
|
+
private cursors;
|
|
20
24
|
constructor(options?: {
|
|
21
|
-
styles?: Partial<
|
|
25
|
+
styles?: Partial<CirclePolygonStyling>;
|
|
22
26
|
keyEvents?: TerraDrawCircleModeKeyEvents | null;
|
|
27
|
+
cursors?: Cursors;
|
|
23
28
|
});
|
|
24
29
|
private close;
|
|
25
30
|
/** @internal */
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Feature, Polygon } from "geojson";
|
|
2
1
|
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
3
2
|
import { TerraDrawMouseEvent } from "../common";
|
|
4
3
|
export declare class ClickBoundingBoxBehavior extends TerraDrawModeBehavior {
|
|
5
4
|
constructor(config: BehaviorConfig);
|
|
6
|
-
create(event: TerraDrawMouseEvent): Feature<Polygon, import("geojson").GeoJsonProperties>;
|
|
5
|
+
create(event: TerraDrawMouseEvent): import("geojson").Feature<import("geojson").Polygon, import("geojson").GeoJsonProperties>;
|
|
7
6
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
4
4
|
type TerraDrawFreehandModeKeyEvents = {
|
|
@@ -15,6 +15,10 @@ type FreehandPolygonStyling = {
|
|
|
15
15
|
closingPointOutlineColor: HexColorStyling;
|
|
16
16
|
closingPointOutlineWidth: NumericStyling;
|
|
17
17
|
};
|
|
18
|
+
interface Cursors {
|
|
19
|
+
start?: Cursor;
|
|
20
|
+
close?: Cursor;
|
|
21
|
+
}
|
|
18
22
|
export declare class TerraDrawFreehandMode extends TerraDrawBaseDrawMode<FreehandPolygonStyling> {
|
|
19
23
|
mode: string;
|
|
20
24
|
private startingClick;
|
|
@@ -22,10 +26,12 @@ export declare class TerraDrawFreehandMode extends TerraDrawBaseDrawMode<Freehan
|
|
|
22
26
|
private closingPointId;
|
|
23
27
|
private minDistance;
|
|
24
28
|
private keyEvents;
|
|
29
|
+
private cursors;
|
|
25
30
|
constructor(options?: {
|
|
26
31
|
styles?: Partial<FreehandPolygonStyling>;
|
|
27
32
|
minDistance?: number;
|
|
28
33
|
keyEvents?: TerraDrawFreehandModeKeyEvents | null;
|
|
34
|
+
cursors?: Cursors;
|
|
29
35
|
});
|
|
30
36
|
private close;
|
|
31
37
|
/** @internal */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
@@ -14,6 +14,10 @@ type GreateCircleStyling = {
|
|
|
14
14
|
closingPointOutlineColor: HexColorStyling;
|
|
15
15
|
closingPointOutlineWidth: NumericStyling;
|
|
16
16
|
};
|
|
17
|
+
interface Cursors {
|
|
18
|
+
start?: Cursor;
|
|
19
|
+
close?: Cursor;
|
|
20
|
+
}
|
|
17
21
|
export declare class TerraDrawGreatCircleMode extends TerraDrawBaseDrawMode<GreateCircleStyling> {
|
|
18
22
|
mode: string;
|
|
19
23
|
private currentCoordinate;
|
|
@@ -21,12 +25,14 @@ export declare class TerraDrawGreatCircleMode extends TerraDrawBaseDrawMode<Grea
|
|
|
21
25
|
private closingPointId;
|
|
22
26
|
private keyEvents;
|
|
23
27
|
private snappingEnabled;
|
|
28
|
+
private cursors;
|
|
24
29
|
private snapping;
|
|
25
30
|
constructor(options?: {
|
|
26
31
|
snapping?: boolean;
|
|
27
32
|
pointerDistance?: number;
|
|
28
33
|
styles?: Partial<GreateCircleStyling>;
|
|
29
34
|
keyEvents?: TerraDrawGreateCircleModeKeyEvents | null;
|
|
35
|
+
cursors?: Cursors;
|
|
30
36
|
});
|
|
31
37
|
private close;
|
|
32
38
|
/** @internal */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
@@ -14,6 +14,10 @@ type LineStringStyling = {
|
|
|
14
14
|
closingPointOutlineColor: HexColorStyling;
|
|
15
15
|
closingPointOutlineWidth: NumericStyling;
|
|
16
16
|
};
|
|
17
|
+
interface Cursors {
|
|
18
|
+
start?: Cursor;
|
|
19
|
+
close?: Cursor;
|
|
20
|
+
}
|
|
17
21
|
export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineStringStyling> {
|
|
18
22
|
mode: string;
|
|
19
23
|
private currentCoordinate;
|
|
@@ -22,6 +26,7 @@ export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineS
|
|
|
22
26
|
private allowSelfIntersections;
|
|
23
27
|
private keyEvents;
|
|
24
28
|
private snappingEnabled;
|
|
29
|
+
private cursors;
|
|
25
30
|
private mouseMove;
|
|
26
31
|
private snapping;
|
|
27
32
|
constructor(options?: {
|
|
@@ -30,6 +35,7 @@ export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineS
|
|
|
30
35
|
pointerDistance?: number;
|
|
31
36
|
styles?: Partial<LineStringStyling>;
|
|
32
37
|
keyEvents?: TerraDrawLineStringModeKeyEvents | null;
|
|
38
|
+
cursors?: Cursors;
|
|
33
39
|
});
|
|
34
40
|
private close;
|
|
35
41
|
/** @internal */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, NumericStyling, HexColorStyling } from "../../common";
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, NumericStyling, HexColorStyling, Cursor } from "../../common";
|
|
2
2
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
3
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
4
|
type PointModeStyling = {
|
|
@@ -7,10 +7,15 @@ type PointModeStyling = {
|
|
|
7
7
|
pointOutlineColor: HexColorStyling;
|
|
8
8
|
pointOutlineWidth: NumericStyling;
|
|
9
9
|
};
|
|
10
|
+
interface Cursors {
|
|
11
|
+
create?: Cursor;
|
|
12
|
+
}
|
|
10
13
|
export declare class TerraDrawPointMode extends TerraDrawBaseDrawMode<PointModeStyling> {
|
|
11
14
|
mode: string;
|
|
15
|
+
private cursors;
|
|
12
16
|
constructor(options?: {
|
|
13
17
|
styles?: Partial<PointModeStyling>;
|
|
18
|
+
cursors?: Cursors;
|
|
14
19
|
});
|
|
15
20
|
/** @internal */
|
|
16
21
|
start(): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
@@ -16,6 +16,10 @@ type PolygonStyling = {
|
|
|
16
16
|
closingPointOutlineWidth: NumericStyling;
|
|
17
17
|
closingPointOutlineColor: HexColorStyling;
|
|
18
18
|
};
|
|
19
|
+
interface Cursors {
|
|
20
|
+
start?: Cursor;
|
|
21
|
+
close?: Cursor;
|
|
22
|
+
}
|
|
19
23
|
export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonStyling> {
|
|
20
24
|
mode: string;
|
|
21
25
|
private currentCoordinate;
|
|
@@ -26,6 +30,7 @@ export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonS
|
|
|
26
30
|
private snapping;
|
|
27
31
|
private pixelDistance;
|
|
28
32
|
private closingPoints;
|
|
33
|
+
private cursors;
|
|
29
34
|
private mouseMove;
|
|
30
35
|
constructor(options?: {
|
|
31
36
|
allowSelfIntersections?: boolean;
|
|
@@ -33,6 +38,7 @@ export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonS
|
|
|
33
38
|
pointerDistance?: number;
|
|
34
39
|
styles?: Partial<PolygonStyling>;
|
|
35
40
|
keyEvents?: TerraDrawPolygonModeKeyEvents | null;
|
|
41
|
+
cursors?: Cursors;
|
|
36
42
|
});
|
|
37
43
|
private close;
|
|
38
44
|
/** @internal */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
2
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
3
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
4
|
type TerraDrawRectangleModeKeyEvents = {
|
|
@@ -11,15 +11,20 @@ type RectanglePolygonStyling = {
|
|
|
11
11
|
outlineWidth: NumericStyling;
|
|
12
12
|
fillOpacity: NumericStyling;
|
|
13
13
|
};
|
|
14
|
+
interface Cursors {
|
|
15
|
+
start?: Cursor;
|
|
16
|
+
}
|
|
14
17
|
export declare class TerraDrawRectangleMode extends TerraDrawBaseDrawMode<RectanglePolygonStyling> {
|
|
15
18
|
mode: string;
|
|
16
19
|
private center;
|
|
17
20
|
private clickCount;
|
|
18
21
|
private currentRectangleId;
|
|
19
22
|
private keyEvents;
|
|
23
|
+
private cursors;
|
|
20
24
|
constructor(options?: {
|
|
21
25
|
styles?: Partial<RectanglePolygonStyling>;
|
|
22
26
|
keyEvents?: TerraDrawRectangleModeKeyEvents | null;
|
|
27
|
+
cursors?: Cursors;
|
|
23
28
|
});
|
|
24
29
|
private updateRectangle;
|
|
25
30
|
private close;
|
|
@@ -12,7 +12,7 @@ export declare class DragCoordinateBehavior extends TerraDrawModeBehavior {
|
|
|
12
12
|
private draggedCoordinate;
|
|
13
13
|
private getClosestCoordinate;
|
|
14
14
|
getDraggableIndex(event: TerraDrawMouseEvent, selectedId: string): number;
|
|
15
|
-
drag(event: TerraDrawMouseEvent): boolean;
|
|
15
|
+
drag(event: TerraDrawMouseEvent, allowSelfIntersection: boolean): boolean;
|
|
16
16
|
isDragging(): boolean;
|
|
17
17
|
startDragging(id: string, index: number): void;
|
|
18
18
|
stopDragging(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TerraDrawMouseEvent } from "../../../common";
|
|
2
2
|
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
-
import {
|
|
3
|
+
import { FeatureAtPointerEventBehavior } from "./feature-at-pointer-event.behavior";
|
|
4
4
|
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
5
5
|
import { MidPointBehavior } from "./midpoint.behavior";
|
|
6
6
|
export declare class DragFeatureBehavior extends TerraDrawModeBehavior {
|
|
@@ -8,7 +8,7 @@ export declare class DragFeatureBehavior extends TerraDrawModeBehavior {
|
|
|
8
8
|
private readonly featuresAtMouseEvent;
|
|
9
9
|
private readonly selectionPoints;
|
|
10
10
|
private readonly midPoints;
|
|
11
|
-
constructor(config: BehaviorConfig, featuresAtMouseEvent:
|
|
11
|
+
constructor(config: BehaviorConfig, featuresAtMouseEvent: FeatureAtPointerEventBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
12
12
|
private draggedFeatureId;
|
|
13
13
|
private dragPosition;
|
|
14
14
|
startDragging(event: TerraDrawMouseEvent, id: string): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TerraDrawMouseEvent } from "../../../common";
|
|
2
|
+
import { GeoJSONStoreFeatures } from "../../../store/store";
|
|
3
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
4
|
+
import { ClickBoundingBoxBehavior } from "../../click-bounding-box.behavior";
|
|
5
|
+
import { PixelDistanceBehavior } from "../../pixel-distance.behavior";
|
|
6
|
+
export declare class FeatureAtPointerEventBehavior extends TerraDrawModeBehavior {
|
|
7
|
+
readonly config: BehaviorConfig;
|
|
8
|
+
private readonly createClickBoundingBox;
|
|
9
|
+
private readonly pixelDistance;
|
|
10
|
+
constructor(config: BehaviorConfig, createClickBoundingBox: ClickBoundingBoxBehavior, pixelDistance: PixelDistanceBehavior);
|
|
11
|
+
find(event: TerraDrawMouseEvent, hasSelection: boolean): {
|
|
12
|
+
clickedFeature: GeoJSONStoreFeatures | undefined;
|
|
13
|
+
clickedMidPoint: GeoJSONStoreFeatures | undefined;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawKeyboardEvent, TerraDrawAdapterStyling, HexColorStyling, NumericStyling } from "../../common";
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawKeyboardEvent, TerraDrawAdapterStyling, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
2
|
import { ModeTypes, TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
@@ -13,6 +13,7 @@ type ModeFlags = {
|
|
|
13
13
|
draggable?: boolean;
|
|
14
14
|
rotateable?: boolean;
|
|
15
15
|
scaleable?: boolean;
|
|
16
|
+
selfIntersectable?: boolean;
|
|
16
17
|
coordinates?: {
|
|
17
18
|
midpoints?: boolean;
|
|
18
19
|
draggable?: boolean;
|
|
@@ -40,6 +41,12 @@ type SelectionStyling = {
|
|
|
40
41
|
midPointWidth: NumericStyling;
|
|
41
42
|
midPointOutlineWidth: NumericStyling;
|
|
42
43
|
};
|
|
44
|
+
interface Cursors {
|
|
45
|
+
pointerOver?: Cursor;
|
|
46
|
+
dragStart?: Cursor;
|
|
47
|
+
dragEnd?: Cursor;
|
|
48
|
+
insertMidpoint?: Cursor;
|
|
49
|
+
}
|
|
43
50
|
export declare class TerraDrawSelectMode extends TerraDrawBaseDrawMode<SelectionStyling> {
|
|
44
51
|
type: ModeTypes;
|
|
45
52
|
mode: string;
|
|
@@ -57,6 +64,7 @@ export declare class TerraDrawSelectMode extends TerraDrawBaseDrawMode<Selection
|
|
|
57
64
|
private dragCoordinate;
|
|
58
65
|
private rotateFeature;
|
|
59
66
|
private scaleFeature;
|
|
67
|
+
private cursors;
|
|
60
68
|
constructor(options?: {
|
|
61
69
|
styles?: Partial<SelectionStyling>;
|
|
62
70
|
pointerDistance?: number;
|
|
@@ -65,7 +73,9 @@ export declare class TerraDrawSelectMode extends TerraDrawBaseDrawMode<Selection
|
|
|
65
73
|
};
|
|
66
74
|
keyEvents?: TerraDrawSelectModeKeyEvents | null;
|
|
67
75
|
dragEventThrottle?: number;
|
|
76
|
+
cursors?: Cursors;
|
|
68
77
|
});
|
|
78
|
+
setSelecting(): void;
|
|
69
79
|
registerBehaviors(config: BehaviorConfig): void;
|
|
70
80
|
private deselect;
|
|
71
81
|
private deleteSelected;
|
|
@@ -8,6 +8,8 @@ export declare class SnappingBehavior extends TerraDrawModeBehavior {
|
|
|
8
8
|
private readonly pixelDistance;
|
|
9
9
|
private readonly clickBoundingBox;
|
|
10
10
|
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, clickBoundingBox: ClickBoundingBoxBehavior);
|
|
11
|
+
/** Returns the nearest snappable coordinate - on first click there is no currentId so no need to provide */
|
|
12
|
+
getSnappableCoordinateFirstClick: (event: TerraDrawMouseEvent) => Position | undefined;
|
|
11
13
|
getSnappableCoordinate: (event: TerraDrawMouseEvent, currentFeatureId: string) => Position | undefined;
|
|
12
14
|
private getSnappable;
|
|
13
15
|
}
|