terra-draw 0.0.1-alpha.4 → 0.0.1-alpha.40
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 +425 -0
- package/README.md +25 -4
- package/dist/adapters/common/adapter-listener.d.ts +22 -0
- package/dist/adapters/common/base-adapter.d.ts +31 -0
- package/dist/adapters/common/base.adapter.d.ts +47 -0
- package/dist/adapters/google-maps.adapter.d.ts +87 -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 +117 -0
- package/dist/common.d.ts +93 -99
- package/dist/extend-types.d.ts +4 -0
- 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-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 +55 -30
- package/dist/modes/circle/circle.mode.d.ts +49 -27
- package/dist/modes/click-bounding-box.behavior.d.ts +7 -7
- package/dist/modes/freehand/freehand.mode.d.ts +55 -29
- package/dist/modes/great-circle-snapping.behavior.d.ts +13 -0
- package/dist/modes/greatcircle/great-circle.mode.d.ts +58 -0
- package/dist/modes/linestring/linestring.mode.d.ts +61 -34
- package/dist/modes/pixel-distance.behavior.d.ts +7 -7
- package/dist/modes/point/point.mode.d.ts +39 -18
- package/dist/modes/polygon/behaviors/closing-points.behavior.d.ts +19 -0
- package/dist/modes/polygon/polygon.mode.d.ts +64 -37
- package/dist/modes/rectangle/rectangle.mode.d.ts +50 -0
- package/dist/modes/render/render.mode.d.ts +39 -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/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 +100 -62
- package/dist/modes/snapping.behavior.d.ts +13 -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 +159 -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/{CONTRIBUTING.md → guides/CONTRIBUTING.md} +7 -7
- package/guides/DEVELOPMENT.md +156 -0
- package/guides/GETTING_STARTED.md +292 -0
- package/jest.config.ts +22 -22
- package/logo.png +0 -0
- package/package.json +151 -87
- package/readme.gif +0 -0
- package/scratch/release.sh +6 -0
- package/tsconfig.json +20 -12
- package/DEVELOPMENT.md +0 -77
- /package/{CODE_OF_CONDUCT.md → guides/CODE_OF_CONDUCT.md} +0 -0
|
@@ -1,29 +1,55 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../../common";
|
|
2
|
-
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
-
|
|
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
|
-
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColor } from "../../common";
|
|
2
|
+
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
+
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
4
|
+
type TerraDrawFreehandModeKeyEvents = {
|
|
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
|
+
closingPointColor: HexColor;
|
|
14
|
+
closingPointWidth: number;
|
|
15
|
+
closingPointOutlineColor: HexColor;
|
|
16
|
+
closingPointOutlineWidth: number;
|
|
17
|
+
};
|
|
18
|
+
export declare class TerraDrawFreehandMode extends TerraDrawBaseDrawMode<FreehandPolygonStyling> {
|
|
19
|
+
mode: string;
|
|
20
|
+
private startingClick;
|
|
21
|
+
private currentId;
|
|
22
|
+
private closingPointId;
|
|
23
|
+
private minDistance;
|
|
24
|
+
private keyEvents;
|
|
25
|
+
constructor(options?: {
|
|
26
|
+
styles?: Partial<FreehandPolygonStyling>;
|
|
27
|
+
minDistance?: number;
|
|
28
|
+
keyEvents?: TerraDrawFreehandModeKeyEvents | null;
|
|
29
|
+
});
|
|
30
|
+
private close;
|
|
31
|
+
/** @internal */
|
|
32
|
+
start(): void;
|
|
33
|
+
/** @internal */
|
|
34
|
+
stop(): void;
|
|
35
|
+
/** @internal */
|
|
36
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
37
|
+
/** @internal */
|
|
38
|
+
onClick(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,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,58 @@
|
|
|
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
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -1,34 +1,61 @@
|
|
|
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
|
-
|
|
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 TerraDrawLineStringModeKeyEvents = {
|
|
6
|
+
cancel: KeyboardEvent["key"] | null;
|
|
7
|
+
finish: KeyboardEvent["key"] | null;
|
|
8
|
+
};
|
|
9
|
+
type LineStringStyling = {
|
|
10
|
+
lineStringWidth: number;
|
|
11
|
+
lineStringColor: HexColor;
|
|
12
|
+
closingPointColor: HexColor;
|
|
13
|
+
closingPointWidth: number;
|
|
14
|
+
closingPointOutlineColor: HexColor;
|
|
15
|
+
closingPointOutlineWidth: number;
|
|
16
|
+
};
|
|
17
|
+
export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineStringStyling> {
|
|
18
|
+
mode: string;
|
|
19
|
+
private currentCoordinate;
|
|
20
|
+
private currentId;
|
|
21
|
+
private closingPointId;
|
|
22
|
+
private allowSelfIntersections;
|
|
23
|
+
private keyEvents;
|
|
24
|
+
private snappingEnabled;
|
|
25
|
+
private mouseMove;
|
|
26
|
+
private snapping;
|
|
27
|
+
constructor(options?: {
|
|
28
|
+
snapping?: boolean;
|
|
29
|
+
allowSelfIntersections?: boolean;
|
|
30
|
+
pointerDistance?: number;
|
|
31
|
+
styles?: Partial<LineStringStyling>;
|
|
32
|
+
keyEvents?: TerraDrawLineStringModeKeyEvents | null;
|
|
33
|
+
});
|
|
34
|
+
private close;
|
|
35
|
+
/** @internal */
|
|
36
|
+
registerBehaviors(config: BehaviorConfig): void;
|
|
37
|
+
/** @internal */
|
|
38
|
+
start(): void;
|
|
39
|
+
/** @internal */
|
|
40
|
+
stop(): void;
|
|
41
|
+
/** @internal */
|
|
42
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
43
|
+
/** @internal */
|
|
44
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
45
|
+
/** @internal */
|
|
46
|
+
onKeyDown(): void;
|
|
47
|
+
/** @internal */
|
|
48
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
49
|
+
/** @internal */
|
|
50
|
+
onDragStart(): void;
|
|
51
|
+
/** @internal */
|
|
52
|
+
onDrag(): void;
|
|
53
|
+
/** @internal */
|
|
54
|
+
onDragEnd(): void;
|
|
55
|
+
/** @internal */
|
|
56
|
+
cleanUp(): void;
|
|
57
|
+
/** @internal */
|
|
58
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
59
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
2
|
-
import { TerraDrawMouseEvent } from "../common";
|
|
3
|
-
import { Position } from "geojson";
|
|
4
|
-
export declare class PixelDistanceBehavior extends TerraDrawModeBehavior {
|
|
5
|
-
constructor(config: BehaviorConfig);
|
|
6
|
-
measure(clickEvent: TerraDrawMouseEvent, secondCoordinate: Position): number;
|
|
7
|
-
}
|
|
1
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
2
|
+
import { TerraDrawMouseEvent } from "../common";
|
|
3
|
+
import { Position } from "geojson";
|
|
4
|
+
export declare class PixelDistanceBehavior extends TerraDrawModeBehavior {
|
|
5
|
+
constructor(config: BehaviorConfig);
|
|
6
|
+
measure(clickEvent: TerraDrawMouseEvent, secondCoordinate: Position): number;
|
|
7
|
+
}
|
|
@@ -1,18 +1,39 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling } from "../../common";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, HexColor } from "../../common";
|
|
2
|
+
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
|
+
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
|
+
type PointModeStyling = {
|
|
5
|
+
pointWidth: number;
|
|
6
|
+
pointColor: HexColor;
|
|
7
|
+
pointOutlineColor: HexColor;
|
|
8
|
+
pointOutlineWidth: number;
|
|
9
|
+
};
|
|
10
|
+
export declare class TerraDrawPointMode extends TerraDrawBaseDrawMode<PointModeStyling> {
|
|
11
|
+
mode: string;
|
|
12
|
+
constructor(options?: {
|
|
13
|
+
styles?: Partial<PointModeStyling>;
|
|
14
|
+
});
|
|
15
|
+
/** @internal */
|
|
16
|
+
start(): void;
|
|
17
|
+
/** @internal */
|
|
18
|
+
stop(): void;
|
|
19
|
+
/** @internal */
|
|
20
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
21
|
+
/** @internal */
|
|
22
|
+
onMouseMove(): void;
|
|
23
|
+
/** @internal */
|
|
24
|
+
onKeyDown(): void;
|
|
25
|
+
/** @internal */
|
|
26
|
+
onKeyUp(): void;
|
|
27
|
+
/** @internal */
|
|
28
|
+
cleanUp(): void;
|
|
29
|
+
/** @internal */
|
|
30
|
+
onDragStart(): void;
|
|
31
|
+
/** @internal */
|
|
32
|
+
onDrag(): void;
|
|
33
|
+
/** @internal */
|
|
34
|
+
onDragEnd(): void;
|
|
35
|
+
/** @internal */
|
|
36
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
37
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Position } from "geojson";
|
|
2
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
+
import { TerraDrawMouseEvent } from "../../../common";
|
|
4
|
+
import { PixelDistanceBehavior } from "../../pixel-distance.behavior";
|
|
5
|
+
export declare class ClosingPointsBehavior extends TerraDrawModeBehavior {
|
|
6
|
+
readonly config: BehaviorConfig;
|
|
7
|
+
private readonly pixelDistance;
|
|
8
|
+
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior);
|
|
9
|
+
private _startEndPoints;
|
|
10
|
+
get ids(): string[];
|
|
11
|
+
set ids(_: string[]);
|
|
12
|
+
create(selectedCoords: Position[], mode: string): void;
|
|
13
|
+
delete(): void;
|
|
14
|
+
update(updatedCoordinates: Position[]): void;
|
|
15
|
+
isClosingPoint(event: TerraDrawMouseEvent): {
|
|
16
|
+
isClosing: boolean;
|
|
17
|
+
isPreviousClosing: boolean;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -1,37 +1,64 @@
|
|
|
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, HexColor } 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: HexColor;
|
|
11
|
+
outlineColor: HexColor;
|
|
12
|
+
outlineWidth: number;
|
|
13
|
+
fillOpacity: number;
|
|
14
|
+
closingPointWidth: number;
|
|
15
|
+
closingPointColor: HexColor;
|
|
16
|
+
closingPointOutlineWidth: number;
|
|
17
|
+
closingPointOutlineColor: HexColor;
|
|
18
|
+
};
|
|
19
|
+
export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonStyling> {
|
|
20
|
+
mode: string;
|
|
21
|
+
private currentCoordinate;
|
|
22
|
+
private currentId;
|
|
23
|
+
private allowSelfIntersections;
|
|
24
|
+
private keyEvents;
|
|
25
|
+
private snappingEnabled;
|
|
26
|
+
private snapping;
|
|
27
|
+
private pixelDistance;
|
|
28
|
+
private closingPoints;
|
|
29
|
+
private mouseMove;
|
|
30
|
+
constructor(options?: {
|
|
31
|
+
allowSelfIntersections?: boolean;
|
|
32
|
+
snapping?: boolean;
|
|
33
|
+
pointerDistance?: number;
|
|
34
|
+
styles?: Partial<PolygonStyling>;
|
|
35
|
+
keyEvents?: TerraDrawPolygonModeKeyEvents | null;
|
|
36
|
+
});
|
|
37
|
+
private close;
|
|
38
|
+
/** @internal */
|
|
39
|
+
registerBehaviors(config: BehaviorConfig): void;
|
|
40
|
+
/** @internal */
|
|
41
|
+
start(): void;
|
|
42
|
+
/** @internal */
|
|
43
|
+
stop(): void;
|
|
44
|
+
/** @internal */
|
|
45
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
46
|
+
/** @internal */
|
|
47
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
48
|
+
/** @internal */
|
|
49
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
50
|
+
/** @internal */
|
|
51
|
+
onKeyDown(): void;
|
|
52
|
+
/** @internal */
|
|
53
|
+
onDragStart(): void;
|
|
54
|
+
/** @internal */
|
|
55
|
+
onDrag(): void;
|
|
56
|
+
/** @internal */
|
|
57
|
+
onDragEnd(): void;
|
|
58
|
+
/** @internal */
|
|
59
|
+
cleanUp(): void;
|
|
60
|
+
/** @internal */
|
|
61
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
62
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
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 RectanglePolygonStyling = {
|
|
9
|
+
fillColor: HexColor;
|
|
10
|
+
outlineColor: HexColor;
|
|
11
|
+
outlineWidth: number;
|
|
12
|
+
fillOpacity: number;
|
|
13
|
+
};
|
|
14
|
+
export declare class TerraDrawRectangleMode extends TerraDrawBaseDrawMode<RectanglePolygonStyling> {
|
|
15
|
+
mode: string;
|
|
16
|
+
private center;
|
|
17
|
+
private clickCount;
|
|
18
|
+
private currentRectangleId;
|
|
19
|
+
private keyEvents;
|
|
20
|
+
constructor(options?: {
|
|
21
|
+
styles?: Partial<RectanglePolygonStyling>;
|
|
22
|
+
keyEvents?: TerraDrawRectangleModeKeyEvents | null;
|
|
23
|
+
});
|
|
24
|
+
private updateRectangle;
|
|
25
|
+
private close;
|
|
26
|
+
/** @internal */
|
|
27
|
+
start(): void;
|
|
28
|
+
/** @internal */
|
|
29
|
+
stop(): void;
|
|
30
|
+
/** @internal */
|
|
31
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
32
|
+
/** @internal */
|
|
33
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
34
|
+
/** @internal */
|
|
35
|
+
onKeyDown(): void;
|
|
36
|
+
/** @internal */
|
|
37
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
38
|
+
/** @internal */
|
|
39
|
+
onDragStart(): void;
|
|
40
|
+
/** @internal */
|
|
41
|
+
onDrag(): void;
|
|
42
|
+
/** @internal */
|
|
43
|
+
onDragEnd(): void;
|
|
44
|
+
/** @internal */
|
|
45
|
+
cleanUp(): void;
|
|
46
|
+
/** @internal */
|
|
47
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
48
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { TerraDrawAdapterStyling } from "../../common";
|
|
2
|
+
import { ModeTypes, TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
+
import { BehaviorConfig } from "../base.behavior";
|
|
4
|
+
import { GeoJSONStoreFeatures } from "../../terra-draw";
|
|
5
|
+
type RenderModeStylingExt<T extends TerraDrawAdapterStyling> = {};
|
|
6
|
+
type RenderModeStyling = RenderModeStylingExt<TerraDrawAdapterStyling>;
|
|
7
|
+
export declare class TerraDrawRenderMode extends TerraDrawBaseDrawMode<RenderModeStyling> {
|
|
8
|
+
type: ModeTypes;
|
|
9
|
+
mode: string;
|
|
10
|
+
constructor(options: {
|
|
11
|
+
styles: Partial<TerraDrawAdapterStyling>;
|
|
12
|
+
});
|
|
13
|
+
/** @internal */
|
|
14
|
+
registerBehaviors(behaviorConfig: BehaviorConfig): void;
|
|
15
|
+
/** @internal */
|
|
16
|
+
start(): void;
|
|
17
|
+
/** @internal */
|
|
18
|
+
stop(): void;
|
|
19
|
+
/** @internal */
|
|
20
|
+
onKeyUp(): void;
|
|
21
|
+
/** @internal */
|
|
22
|
+
onKeyDown(): void;
|
|
23
|
+
/** @internal */
|
|
24
|
+
onClick(): void;
|
|
25
|
+
/** @internal */
|
|
26
|
+
onDragStart(): void;
|
|
27
|
+
/** @internal */
|
|
28
|
+
onDrag(): void;
|
|
29
|
+
/** @internal */
|
|
30
|
+
onDragEnd(): void;
|
|
31
|
+
/** @internal */
|
|
32
|
+
onMouseMove(): void;
|
|
33
|
+
/** @internal */
|
|
34
|
+
cleanUp(): void;
|
|
35
|
+
/** @internal */
|
|
36
|
+
styleFeature(): TerraDrawAdapterStyling;
|
|
37
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
38
|
+
}
|
|
39
|
+
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): 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 { FeaturesAtMouseEventBehavior } from "./features-at-mouse-event.behavior";
|
|
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 { FeaturesAtMouseEventBehavior } from "./features-at-mouse-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: FeaturesAtMouseEventBehavior, 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
|
+
}
|
|
@@ -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
|
+
}
|