terra-draw 0.0.1-alpha.5 → 0.0.1-alpha.50
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/.devcontainer/Dockerfile +8 -0
- package/.devcontainer/devcontainer.json +21 -0
- package/.devcontainer/post-create.sh +16 -0
- package/README.md +26 -4
- package/dist/adapters/common/adapter-listener.d.ts +22 -0
- package/dist/adapters/common/base.adapter.d.ts +52 -0
- package/dist/adapters/google-maps.adapter.d.ts +91 -38
- package/dist/adapters/leaflet.adapter.d.ts +98 -35
- package/dist/adapters/mapbox-gl.adapter.d.ts +89 -36
- package/dist/adapters/maplibre-gl.adapter.d.ts +72 -0
- package/dist/adapters/openlayers.adapter.d.ts +118 -0
- package/dist/common.d.ts +100 -99
- package/dist/geometry/boolean/is-valid-coordinate.d.ts +4 -0
- package/dist/geometry/boolean/is-valid-linestring-feature.d.ts +2 -0
- package/dist/geometry/boolean/is-valid-point.d.ts +2 -0
- package/dist/geometry/boolean/is-valid-polygon-feature.d.ts +3 -0
- package/dist/geometry/boolean/point-in-polygon.d.ts +2 -2
- package/dist/geometry/boolean/self-intersects.d.ts +2 -2
- package/dist/geometry/centroid.d.ts +2 -2
- package/dist/geometry/coordinates-identical.d.ts +2 -2
- package/dist/geometry/get-coordinates-as-points.d.ts +6 -6
- package/dist/geometry/get-midpoints.d.ts +8 -7
- package/dist/geometry/helpers.d.ts +4 -4
- package/dist/geometry/limit-decimal-precision.d.ts +1 -1
- package/dist/geometry/measure/haversine-distance.d.ts +2 -2
- package/dist/geometry/measure/pixel-distance-to-line.d.ts +10 -10
- package/dist/geometry/measure/pixel-distance.d.ts +7 -7
- package/dist/geometry/measure/rhumb-bearing.d.ts +2 -2
- package/dist/geometry/measure/rhumb-destination.d.ts +2 -2
- package/dist/geometry/measure/rhumb-distance.d.ts +2 -2
- package/dist/geometry/midpoint-coordinate.d.ts +3 -2
- package/dist/geometry/shape/create-bbox.d.ts +10 -0
- package/dist/geometry/shape/create-circle.d.ts +7 -7
- package/dist/geometry/shape/great-circle-line.d.ts +12 -0
- package/dist/geometry/transform/rotate.d.ts +2 -2
- package/dist/geometry/transform/scale.d.ts +2 -2
- package/dist/modes/base.behavior.d.ts +19 -19
- package/dist/modes/base.mode.d.ts +58 -30
- package/dist/modes/circle/circle.mode.d.ts +54 -27
- package/dist/modes/click-bounding-box.behavior.d.ts +6 -7
- package/dist/modes/freehand/freehand.mode.d.ts +63 -29
- package/dist/modes/great-circle-snapping.behavior.d.ts +13 -0
- package/dist/modes/greatcircle/great-circle.mode.d.ts +64 -0
- package/dist/modes/linestring/linestring.mode.d.ts +67 -34
- package/dist/modes/pixel-distance.behavior.d.ts +7 -7
- package/dist/modes/point/point.mode.d.ts +44 -18
- package/dist/modes/polygon/behaviors/closing-points.behavior.d.ts +19 -0
- package/dist/modes/polygon/polygon.mode.d.ts +70 -37
- package/dist/modes/rectangle/rectangle.mode.d.ts +55 -0
- package/dist/modes/render/render.mode.d.ts +51 -0
- package/dist/modes/select/behaviors/drag-coordinate.behavior.d.ts +19 -13
- package/dist/modes/select/behaviors/drag-feature.behavior.d.ts +19 -17
- package/dist/modes/select/behaviors/feature-at-pointer-event.behavior.d.ts +15 -0
- package/dist/modes/select/behaviors/features-at-mouse-event.behavior.d.ts +15 -15
- package/dist/modes/select/behaviors/midpoint.behavior.d.ts +18 -18
- package/dist/modes/select/behaviors/rotate-feature.behavior.d.ts +13 -13
- package/dist/modes/select/behaviors/scale-feature.behavior.d.ts +13 -13
- package/dist/modes/select/behaviors/selection-point.behavior.d.ts +18 -18
- package/dist/modes/select/select.mode.d.ts +110 -62
- package/dist/modes/snapping.behavior.d.ts +15 -13
- package/dist/modes/static/static.mode.d.ts +32 -13
- package/dist/store/spatial-index/quickselect.d.ts +2 -2
- package/dist/store/spatial-index/rbush.d.ts +35 -35
- package/dist/store/spatial-index/spatial-index.d.ts +18 -18
- package/dist/store/store-feature-validation.d.ts +15 -0
- package/dist/store/store.d.ts +48 -48
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- package/dist/terra-draw.d.ts +183 -47
- 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/dist/util/geoms.d.ts +3 -3
- package/dist/util/id.d.ts +1 -1
- package/dist/util/styling.d.ts +2 -2
- package/jest.nocheck.config.ts +9 -0
- package/package.json +156 -87
- package/readme.gif +0 -0
- package/tsconfig.json +20 -12
- package/CODE_OF_CONDUCT.md +0 -36
- package/CONTRIBUTING.md +0 -17
- package/DEVELOPMENT.md +0 -77
- package/dist/bundle.js +0 -6
- package/dist/bundle.js.LICENSE.txt +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/jest.config.ts +0 -27
|
@@ -1,37 +1,70 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../../common";
|
|
2
|
-
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
-
import { BehaviorConfig } from "../base.behavior";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
|
+
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
+
import { BehaviorConfig } from "../base.behavior";
|
|
4
|
+
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
5
|
+
type TerraDrawPolygonModeKeyEvents = {
|
|
6
|
+
cancel?: KeyboardEvent["key"] | null;
|
|
7
|
+
finish?: KeyboardEvent["key"] | null;
|
|
8
|
+
};
|
|
9
|
+
type PolygonStyling = {
|
|
10
|
+
fillColor: HexColorStyling;
|
|
11
|
+
outlineColor: HexColorStyling;
|
|
12
|
+
outlineWidth: NumericStyling;
|
|
13
|
+
fillOpacity: NumericStyling;
|
|
14
|
+
closingPointWidth: NumericStyling;
|
|
15
|
+
closingPointColor: HexColorStyling;
|
|
16
|
+
closingPointOutlineWidth: NumericStyling;
|
|
17
|
+
closingPointOutlineColor: HexColorStyling;
|
|
18
|
+
};
|
|
19
|
+
interface Cursors {
|
|
20
|
+
start?: Cursor;
|
|
21
|
+
close?: Cursor;
|
|
22
|
+
}
|
|
23
|
+
export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonStyling> {
|
|
24
|
+
mode: string;
|
|
25
|
+
private currentCoordinate;
|
|
26
|
+
private currentId;
|
|
27
|
+
private allowSelfIntersections;
|
|
28
|
+
private keyEvents;
|
|
29
|
+
private snappingEnabled;
|
|
30
|
+
private snapping;
|
|
31
|
+
private pixelDistance;
|
|
32
|
+
private closingPoints;
|
|
33
|
+
private cursors;
|
|
34
|
+
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
|
+
});
|
|
43
|
+
private close;
|
|
44
|
+
/** @internal */
|
|
45
|
+
registerBehaviors(config: BehaviorConfig): void;
|
|
46
|
+
/** @internal */
|
|
47
|
+
start(): void;
|
|
48
|
+
/** @internal */
|
|
49
|
+
stop(): void;
|
|
50
|
+
/** @internal */
|
|
51
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
52
|
+
/** @internal */
|
|
53
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
54
|
+
/** @internal */
|
|
55
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
56
|
+
/** @internal */
|
|
57
|
+
onKeyDown(): void;
|
|
58
|
+
/** @internal */
|
|
59
|
+
onDragStart(): void;
|
|
60
|
+
/** @internal */
|
|
61
|
+
onDrag(): void;
|
|
62
|
+
/** @internal */
|
|
63
|
+
onDragEnd(): void;
|
|
64
|
+
/** @internal */
|
|
65
|
+
cleanUp(): void;
|
|
66
|
+
/** @internal */
|
|
67
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
68
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } 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 RectanglePolygonStyling = {
|
|
9
|
+
fillColor: HexColorStyling;
|
|
10
|
+
outlineColor: HexColorStyling;
|
|
11
|
+
outlineWidth: NumericStyling;
|
|
12
|
+
fillOpacity: NumericStyling;
|
|
13
|
+
};
|
|
14
|
+
interface Cursors {
|
|
15
|
+
start?: Cursor;
|
|
16
|
+
}
|
|
17
|
+
export declare class TerraDrawRectangleMode extends TerraDrawBaseDrawMode<RectanglePolygonStyling> {
|
|
18
|
+
mode: string;
|
|
19
|
+
private center;
|
|
20
|
+
private clickCount;
|
|
21
|
+
private currentRectangleId;
|
|
22
|
+
private keyEvents;
|
|
23
|
+
private cursors;
|
|
24
|
+
constructor(options?: {
|
|
25
|
+
styles?: Partial<RectanglePolygonStyling>;
|
|
26
|
+
keyEvents?: TerraDrawRectangleModeKeyEvents | null;
|
|
27
|
+
cursors?: Cursors;
|
|
28
|
+
});
|
|
29
|
+
private updateRectangle;
|
|
30
|
+
private close;
|
|
31
|
+
/** @internal */
|
|
32
|
+
start(): void;
|
|
33
|
+
/** @internal */
|
|
34
|
+
stop(): void;
|
|
35
|
+
/** @internal */
|
|
36
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
37
|
+
/** @internal */
|
|
38
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
39
|
+
/** @internal */
|
|
40
|
+
onKeyDown(): void;
|
|
41
|
+
/** @internal */
|
|
42
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
43
|
+
/** @internal */
|
|
44
|
+
onDragStart(): void;
|
|
45
|
+
/** @internal */
|
|
46
|
+
onDrag(): void;
|
|
47
|
+
/** @internal */
|
|
48
|
+
onDragEnd(): void;
|
|
49
|
+
/** @internal */
|
|
50
|
+
cleanUp(): void;
|
|
51
|
+
/** @internal */
|
|
52
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
53
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { HexColorStyling, NumericStyling, TerraDrawAdapterStyling } from "../../common";
|
|
2
|
+
import { ModeTypes, TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
+
import { BehaviorConfig } from "../base.behavior";
|
|
4
|
+
import { GeoJSONStoreFeatures } from "../../terra-draw";
|
|
5
|
+
type RenderModeStyling = {
|
|
6
|
+
pointColor: HexColorStyling;
|
|
7
|
+
pointWidth: NumericStyling;
|
|
8
|
+
pointOutlineColor: HexColorStyling;
|
|
9
|
+
pointOutlineWidth: NumericStyling;
|
|
10
|
+
polygonFillColor: HexColorStyling;
|
|
11
|
+
polygonFillOpacity: NumericStyling;
|
|
12
|
+
polygonOutlineColor: HexColorStyling;
|
|
13
|
+
polygonOutlineWidth: NumericStyling;
|
|
14
|
+
lineStringWidth: NumericStyling;
|
|
15
|
+
lineStringColor: HexColorStyling;
|
|
16
|
+
zIndex: NumericStyling;
|
|
17
|
+
};
|
|
18
|
+
export declare class TerraDrawRenderMode extends TerraDrawBaseDrawMode<RenderModeStyling> {
|
|
19
|
+
type: ModeTypes;
|
|
20
|
+
mode: string;
|
|
21
|
+
constructor(options: {
|
|
22
|
+
modeName: string;
|
|
23
|
+
styles: Partial<RenderModeStyling>;
|
|
24
|
+
});
|
|
25
|
+
/** @internal */
|
|
26
|
+
registerBehaviors(behaviorConfig: BehaviorConfig): void;
|
|
27
|
+
/** @internal */
|
|
28
|
+
start(): void;
|
|
29
|
+
/** @internal */
|
|
30
|
+
stop(): void;
|
|
31
|
+
/** @internal */
|
|
32
|
+
onKeyUp(): void;
|
|
33
|
+
/** @internal */
|
|
34
|
+
onKeyDown(): void;
|
|
35
|
+
/** @internal */
|
|
36
|
+
onClick(): void;
|
|
37
|
+
/** @internal */
|
|
38
|
+
onDragStart(): void;
|
|
39
|
+
/** @internal */
|
|
40
|
+
onDrag(): void;
|
|
41
|
+
/** @internal */
|
|
42
|
+
onDragEnd(): void;
|
|
43
|
+
/** @internal */
|
|
44
|
+
onMouseMove(): void;
|
|
45
|
+
/** @internal */
|
|
46
|
+
cleanUp(): void;
|
|
47
|
+
/** @internal */
|
|
48
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
49
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent } from "../../../common";
|
|
2
|
-
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
-
import { PixelDistanceBehavior } from "../../pixel-distance.behavior";
|
|
4
|
-
import { MidPointBehavior } from "./midpoint.behavior";
|
|
5
|
-
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
6
|
-
export declare class DragCoordinateBehavior extends TerraDrawModeBehavior {
|
|
7
|
-
readonly config: BehaviorConfig;
|
|
8
|
-
private readonly pixelDistance;
|
|
9
|
-
private readonly selectionPoints;
|
|
10
|
-
private readonly midPoints;
|
|
11
|
-
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { TerraDrawMouseEvent } from "../../../common";
|
|
2
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
+
import { PixelDistanceBehavior } from "../../pixel-distance.behavior";
|
|
4
|
+
import { MidPointBehavior } from "./midpoint.behavior";
|
|
5
|
+
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
6
|
+
export declare class DragCoordinateBehavior extends TerraDrawModeBehavior {
|
|
7
|
+
readonly config: BehaviorConfig;
|
|
8
|
+
private readonly pixelDistance;
|
|
9
|
+
private readonly selectionPoints;
|
|
10
|
+
private readonly midPoints;
|
|
11
|
+
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
12
|
+
private draggedCoordinate;
|
|
13
|
+
private getClosestCoordinate;
|
|
14
|
+
getDraggableIndex(event: TerraDrawMouseEvent, selectedId: string): number;
|
|
15
|
+
drag(event: TerraDrawMouseEvent, allowSelfIntersection: boolean): boolean;
|
|
16
|
+
isDragging(): boolean;
|
|
17
|
+
startDragging(id: string, index: number): void;
|
|
18
|
+
stopDragging(): void;
|
|
19
|
+
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent } from "../../../common";
|
|
2
|
-
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
readonly
|
|
9
|
-
private readonly
|
|
10
|
-
private readonly
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
private dragPosition;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { TerraDrawMouseEvent } from "../../../common";
|
|
2
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
+
import { FeatureAtPointerEventBehavior } from "./feature-at-pointer-event.behavior";
|
|
4
|
+
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
5
|
+
import { MidPointBehavior } from "./midpoint.behavior";
|
|
6
|
+
export declare class DragFeatureBehavior extends TerraDrawModeBehavior {
|
|
7
|
+
readonly config: BehaviorConfig;
|
|
8
|
+
private readonly featuresAtMouseEvent;
|
|
9
|
+
private readonly selectionPoints;
|
|
10
|
+
private readonly midPoints;
|
|
11
|
+
constructor(config: BehaviorConfig, featuresAtMouseEvent: FeatureAtPointerEventBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
12
|
+
private draggedFeatureId;
|
|
13
|
+
private dragPosition;
|
|
14
|
+
startDragging(event: TerraDrawMouseEvent, id: string): void;
|
|
15
|
+
stopDragging(): void;
|
|
16
|
+
isDragging(): boolean;
|
|
17
|
+
canDrag(event: TerraDrawMouseEvent, selectedId: string): boolean;
|
|
18
|
+
drag(event: TerraDrawMouseEvent): false | undefined;
|
|
19
|
+
}
|
|
@@ -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,15 +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 FeaturesAtMouseEventBehavior 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
|
+
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 FeaturesAtMouseEventBehavior 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,18 +1,18 @@
|
|
|
1
|
-
import { Point, Position } from "geojson";
|
|
2
|
-
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
-
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
4
|
-
export declare class MidPointBehavior extends TerraDrawModeBehavior {
|
|
5
|
-
readonly config: BehaviorConfig;
|
|
6
|
-
private readonly selectionPointBehavior;
|
|
7
|
-
constructor(config: BehaviorConfig, selectionPointBehavior: SelectionPointBehavior);
|
|
8
|
-
private _midPoints;
|
|
9
|
-
get ids(): string[];
|
|
10
|
-
set ids(_: string[]);
|
|
11
|
-
insert(midPointId: string, coordinatePrecision: number): void;
|
|
12
|
-
create(selectedCoords: Position[], featureId: string, coordinatePrecision: number): void;
|
|
13
|
-
delete(): void;
|
|
14
|
-
getUpdated(updatedCoordinates: Position[]): {
|
|
15
|
-
id: string;
|
|
16
|
-
geometry: Point;
|
|
17
|
-
}[] | undefined;
|
|
18
|
-
}
|
|
1
|
+
import { Point, Position } from "geojson";
|
|
2
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
+
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
4
|
+
export declare class MidPointBehavior extends TerraDrawModeBehavior {
|
|
5
|
+
readonly config: BehaviorConfig;
|
|
6
|
+
private readonly selectionPointBehavior;
|
|
7
|
+
constructor(config: BehaviorConfig, selectionPointBehavior: SelectionPointBehavior);
|
|
8
|
+
private _midPoints;
|
|
9
|
+
get ids(): string[];
|
|
10
|
+
set ids(_: string[]);
|
|
11
|
+
insert(midPointId: string, coordinatePrecision: number): void;
|
|
12
|
+
create(selectedCoords: Position[], featureId: string, coordinatePrecision: number): void;
|
|
13
|
+
delete(): void;
|
|
14
|
+
getUpdated(updatedCoordinates: Position[]): {
|
|
15
|
+
id: string;
|
|
16
|
+
geometry: Point;
|
|
17
|
+
}[] | undefined;
|
|
18
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent } from "../../../common";
|
|
2
|
-
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
-
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
4
|
-
import { MidPointBehavior } from "./midpoint.behavior";
|
|
5
|
-
export declare class RotateFeatureBehavior extends TerraDrawModeBehavior {
|
|
6
|
-
readonly config: BehaviorConfig;
|
|
7
|
-
private readonly selectionPoints;
|
|
8
|
-
private readonly midPoints;
|
|
9
|
-
constructor(config: BehaviorConfig, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
10
|
-
private lastBearing;
|
|
11
|
-
reset(): void;
|
|
12
|
-
rotate(event: TerraDrawMouseEvent, selectedId: string): void;
|
|
13
|
-
}
|
|
1
|
+
import { TerraDrawMouseEvent } from "../../../common";
|
|
2
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
+
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
4
|
+
import { MidPointBehavior } from "./midpoint.behavior";
|
|
5
|
+
export declare class RotateFeatureBehavior extends TerraDrawModeBehavior {
|
|
6
|
+
readonly config: BehaviorConfig;
|
|
7
|
+
private readonly selectionPoints;
|
|
8
|
+
private readonly midPoints;
|
|
9
|
+
constructor(config: BehaviorConfig, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
10
|
+
private lastBearing;
|
|
11
|
+
reset(): void;
|
|
12
|
+
rotate(event: TerraDrawMouseEvent, selectedId: string): void;
|
|
13
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent } from "../../../common";
|
|
2
|
-
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
-
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
4
|
-
import { MidPointBehavior } from "./midpoint.behavior";
|
|
5
|
-
export declare class ScaleFeatureBehavior extends TerraDrawModeBehavior {
|
|
6
|
-
readonly config: BehaviorConfig;
|
|
7
|
-
private readonly selectionPoints;
|
|
8
|
-
private readonly midPoints;
|
|
9
|
-
constructor(config: BehaviorConfig, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
10
|
-
private lastDistance;
|
|
11
|
-
reset(): void;
|
|
12
|
-
scale(event: TerraDrawMouseEvent, selectedId: string): void;
|
|
13
|
-
}
|
|
1
|
+
import { TerraDrawMouseEvent } from "../../../common";
|
|
2
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
+
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
4
|
+
import { MidPointBehavior } from "./midpoint.behavior";
|
|
5
|
+
export declare class ScaleFeatureBehavior extends TerraDrawModeBehavior {
|
|
6
|
+
readonly config: BehaviorConfig;
|
|
7
|
+
private readonly selectionPoints;
|
|
8
|
+
private readonly midPoints;
|
|
9
|
+
constructor(config: BehaviorConfig, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
10
|
+
private lastDistance;
|
|
11
|
+
reset(): void;
|
|
12
|
+
scale(event: TerraDrawMouseEvent, selectedId: string): void;
|
|
13
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { LineString, Point, Polygon, Position } from "geojson";
|
|
2
|
-
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
-
export declare class SelectionPointBehavior extends TerraDrawModeBehavior {
|
|
4
|
-
constructor(config: BehaviorConfig);
|
|
5
|
-
private _selectionPoints;
|
|
6
|
-
get ids(): string[];
|
|
7
|
-
set ids(_: string[]);
|
|
8
|
-
create(selectedCoords: Position[], type: Polygon["type"] | LineString["type"], featureId: string): void;
|
|
9
|
-
delete(): void;
|
|
10
|
-
getUpdated(updatedCoordinates: Position[]): {
|
|
11
|
-
id: string;
|
|
12
|
-
geometry: Point;
|
|
13
|
-
}[] | undefined;
|
|
14
|
-
getOneUpdated(index: number, updatedCoordinate: Position): {
|
|
15
|
-
id: string;
|
|
16
|
-
geometry: Point;
|
|
17
|
-
} | undefined;
|
|
18
|
-
}
|
|
1
|
+
import { LineString, Point, Polygon, Position } from "geojson";
|
|
2
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
+
export declare class SelectionPointBehavior extends TerraDrawModeBehavior {
|
|
4
|
+
constructor(config: BehaviorConfig);
|
|
5
|
+
private _selectionPoints;
|
|
6
|
+
get ids(): string[];
|
|
7
|
+
set ids(_: string[]);
|
|
8
|
+
create(selectedCoords: Position[], type: Polygon["type"] | LineString["type"], featureId: string): void;
|
|
9
|
+
delete(): void;
|
|
10
|
+
getUpdated(updatedCoordinates: Position[]): {
|
|
11
|
+
id: string;
|
|
12
|
+
geometry: Point;
|
|
13
|
+
}[] | undefined;
|
|
14
|
+
getOneUpdated(index: number, updatedCoordinate: Position): {
|
|
15
|
+
id: string;
|
|
16
|
+
geometry: Point;
|
|
17
|
+
} | undefined;
|
|
18
|
+
}
|
|
@@ -1,62 +1,110 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawKeyboardEvent } from "../../common";
|
|
2
|
-
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
-
import { BehaviorConfig } from "../base.behavior";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawKeyboardEvent, TerraDrawAdapterStyling, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
|
+
import { ModeTypes, TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
+
import { BehaviorConfig } from "../base.behavior";
|
|
4
|
+
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
5
|
+
type TerraDrawSelectModeKeyEvents = {
|
|
6
|
+
deselect: KeyboardEvent["key"] | null;
|
|
7
|
+
delete: KeyboardEvent["key"] | null;
|
|
8
|
+
rotate: KeyboardEvent["key"][] | null;
|
|
9
|
+
scale: KeyboardEvent["key"][] | null;
|
|
10
|
+
};
|
|
11
|
+
type ModeFlags = {
|
|
12
|
+
feature?: {
|
|
13
|
+
draggable?: boolean;
|
|
14
|
+
rotateable?: boolean;
|
|
15
|
+
scaleable?: boolean;
|
|
16
|
+
selfIntersectable?: boolean;
|
|
17
|
+
coordinates?: {
|
|
18
|
+
midpoints?: boolean;
|
|
19
|
+
draggable?: boolean;
|
|
20
|
+
deletable?: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
type SelectionStyling = {
|
|
25
|
+
selectedPointColor: HexColorStyling;
|
|
26
|
+
selectedPointWidth: NumericStyling;
|
|
27
|
+
selectedPointOutlineColor: HexColorStyling;
|
|
28
|
+
selectedPointOutlineWidth: NumericStyling;
|
|
29
|
+
selectedLineStringColor: HexColorStyling;
|
|
30
|
+
selectedLineStringWidth: NumericStyling;
|
|
31
|
+
selectedPolygonColor: HexColorStyling;
|
|
32
|
+
selectedPolygonFillOpacity: NumericStyling;
|
|
33
|
+
selectedPolygonOutlineColor: HexColorStyling;
|
|
34
|
+
selectedPolygonOutlineWidth: NumericStyling;
|
|
35
|
+
selectionPointWidth: NumericStyling;
|
|
36
|
+
selectionPointColor: HexColorStyling;
|
|
37
|
+
selectionPointOutlineColor: HexColorStyling;
|
|
38
|
+
selectionPointOutlineWidth: NumericStyling;
|
|
39
|
+
midPointColor: HexColorStyling;
|
|
40
|
+
midPointOutlineColor: HexColorStyling;
|
|
41
|
+
midPointWidth: NumericStyling;
|
|
42
|
+
midPointOutlineWidth: NumericStyling;
|
|
43
|
+
};
|
|
44
|
+
interface Cursors {
|
|
45
|
+
pointerOver?: Cursor;
|
|
46
|
+
dragStart?: Cursor;
|
|
47
|
+
dragEnd?: Cursor;
|
|
48
|
+
insertMidpoint?: Cursor;
|
|
49
|
+
}
|
|
50
|
+
export declare class TerraDrawSelectMode extends TerraDrawBaseDrawMode<SelectionStyling> {
|
|
51
|
+
type: ModeTypes;
|
|
52
|
+
mode: string;
|
|
53
|
+
private dragEventThrottle;
|
|
54
|
+
private dragEventCount;
|
|
55
|
+
private selected;
|
|
56
|
+
private flags;
|
|
57
|
+
private keyEvents;
|
|
58
|
+
private selectionPoints;
|
|
59
|
+
private midPoints;
|
|
60
|
+
private featuresAtMouseEvent;
|
|
61
|
+
private pixelDistance;
|
|
62
|
+
private clickBoundingBox;
|
|
63
|
+
private dragFeature;
|
|
64
|
+
private dragCoordinate;
|
|
65
|
+
private rotateFeature;
|
|
66
|
+
private scaleFeature;
|
|
67
|
+
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
|
+
});
|
|
78
|
+
setSelecting(): void;
|
|
79
|
+
registerBehaviors(config: BehaviorConfig): void;
|
|
80
|
+
private deselect;
|
|
81
|
+
private deleteSelected;
|
|
82
|
+
private onRightClick;
|
|
83
|
+
private onLeftClick;
|
|
84
|
+
/** @internal */
|
|
85
|
+
start(): void;
|
|
86
|
+
/** @internal */
|
|
87
|
+
stop(): void;
|
|
88
|
+
/** @internal */
|
|
89
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
90
|
+
private canScale;
|
|
91
|
+
private canRotate;
|
|
92
|
+
private preventDefaultKeyEvent;
|
|
93
|
+
/** @internal */
|
|
94
|
+
onKeyDown(event: TerraDrawKeyboardEvent): void;
|
|
95
|
+
/** @internal */
|
|
96
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
97
|
+
/** @internal */
|
|
98
|
+
cleanUp(): void;
|
|
99
|
+
/** @internal */
|
|
100
|
+
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
101
|
+
/** @internal */
|
|
102
|
+
onDrag(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
103
|
+
/** @internal */
|
|
104
|
+
onDragEnd(_: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
105
|
+
/** @internal */
|
|
106
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
107
|
+
/** @internal */
|
|
108
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
109
|
+
}
|
|
110
|
+
export {};
|