terra-draw 0.0.1-alpha.6 → 0.0.1-alpha.61
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 +30 -6
- package/dist/adapters/arcgis-maps-sdk.adapter.d.ts +105 -0
- package/dist/adapters/common/adapter-listener.d.ts +22 -0
- package/dist/adapters/common/base.adapter.d.ts +59 -0
- package/dist/adapters/google-maps.adapter.d.ts +90 -39
- package/dist/adapters/leaflet.adapter.d.ts +97 -33
- package/dist/adapters/mapbox-gl.adapter.d.ts +89 -37
- package/dist/adapters/maplibre-gl.adapter.d.ts +71 -0
- package/dist/adapters/openlayers.adapter.d.ts +118 -0
- package/dist/common.d.ts +103 -98
- 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 +62 -33
- package/dist/modes/circle/circle.mode.d.ts +55 -35
- package/dist/modes/click-bounding-box.behavior.d.ts +6 -7
- package/dist/modes/freehand/freehand.mode.d.ts +63 -37
- package/dist/modes/great-circle-snapping.behavior.d.ts +14 -0
- package/dist/modes/greatcircle/great-circle.mode.d.ts +64 -0
- package/dist/modes/linestring/linestring.mode.d.ts +67 -40
- package/dist/modes/pixel-distance.behavior.d.ts +7 -7
- package/dist/modes/point/point.mode.d.ts +44 -26
- package/dist/modes/polygon/behaviors/closing-points.behavior.d.ts +19 -19
- package/dist/modes/polygon/polygon.mode.d.ts +70 -49
- package/dist/modes/rectangle/rectangle.mode.d.ts +55 -0
- package/dist/modes/render/render.mode.d.ts +52 -23
- package/dist/modes/select/behaviors/drag-coordinate-resize.behavior.d.ts +28 -0
- package/dist/modes/select/behaviors/drag-coordinate.behavior.d.ts +20 -13
- package/dist/modes/select/behaviors/drag-feature.behavior.d.ts +20 -17
- package/dist/modes/select/behaviors/{features-at-mouse-event.behavior.d.ts → feature-at-pointer-event.behavior.d.ts} +15 -15
- package/dist/modes/select/behaviors/midpoint.behavior.d.ts +19 -18
- package/dist/modes/select/behaviors/rotate-feature.behavior.d.ts +14 -13
- package/dist/modes/select/behaviors/scale-feature.behavior.d.ts +14 -13
- package/dist/modes/select/behaviors/selection-point.behavior.d.ts +19 -18
- package/dist/modes/select/select.mode.d.ts +117 -78
- package/dist/modes/snapping.behavior.d.ts +16 -13
- package/dist/modes/static/static.mode.d.ts +32 -30
- 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 +16 -0
- package/dist/store/store.d.ts +59 -48
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- package/dist/terra-draw.d.ts +220 -48
- 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/e2e/README.md +29 -0
- package/e2e/package-lock.json +4249 -0
- package/e2e/package.json +26 -0
- package/e2e/playwright.config.ts +77 -0
- package/e2e/public/index.html +53 -0
- package/e2e/src/index.ts +165 -0
- package/e2e/tests/leaflet.spec.ts +413 -0
- package/e2e/tests/setup.ts +164 -0
- package/e2e/webpack.config.js +36 -0
- package/jest.nocheck.config.ts +17 -0
- package/package.json +157 -87
- package/readme.gif +0 -0
- package/tsconfig.json +17 -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,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,26 +1,44 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling,
|
|
2
|
-
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
|
-
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
|
-
|
|
5
|
-
pointWidth:
|
|
6
|
-
pointColor:
|
|
7
|
-
pointOutlineColor:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, NumericStyling, HexColorStyling, Cursor } from "../../common";
|
|
2
|
+
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
|
+
import { BaseModeOptions, CustomStyling, TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
|
+
type PointModeStyling = {
|
|
5
|
+
pointWidth: NumericStyling;
|
|
6
|
+
pointColor: HexColorStyling;
|
|
7
|
+
pointOutlineColor: HexColorStyling;
|
|
8
|
+
pointOutlineWidth: NumericStyling;
|
|
9
|
+
};
|
|
10
|
+
interface Cursors {
|
|
11
|
+
create?: Cursor;
|
|
12
|
+
}
|
|
13
|
+
interface TerraDrawPointModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
14
|
+
cursors?: Cursors;
|
|
15
|
+
}
|
|
16
|
+
export declare class TerraDrawPointMode extends TerraDrawBaseDrawMode<PointModeStyling> {
|
|
17
|
+
mode: string;
|
|
18
|
+
private cursors;
|
|
19
|
+
constructor(options?: TerraDrawPointModeOptions<PointModeStyling>);
|
|
20
|
+
/** @internal */
|
|
21
|
+
start(): void;
|
|
22
|
+
/** @internal */
|
|
23
|
+
stop(): void;
|
|
24
|
+
/** @internal */
|
|
25
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
26
|
+
/** @internal */
|
|
27
|
+
onMouseMove(): void;
|
|
28
|
+
/** @internal */
|
|
29
|
+
onKeyDown(): void;
|
|
30
|
+
/** @internal */
|
|
31
|
+
onKeyUp(): void;
|
|
32
|
+
/** @internal */
|
|
33
|
+
cleanUp(): void;
|
|
34
|
+
/** @internal */
|
|
35
|
+
onDragStart(): void;
|
|
36
|
+
/** @internal */
|
|
37
|
+
onDrag(): void;
|
|
38
|
+
/** @internal */
|
|
39
|
+
onDragEnd(): void;
|
|
40
|
+
/** @internal */
|
|
41
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
42
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -1,19 +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
|
+
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,49 +1,70 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent,
|
|
2
|
-
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
-
import { BehaviorConfig } from "../base.behavior";
|
|
4
|
-
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
5
|
-
|
|
6
|
-
cancel
|
|
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
|
-
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
|
+
import { TerraDrawBaseDrawMode, BaseModeOptions, CustomStyling } 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
|
+
interface TerraDrawPolygonModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
24
|
+
allowSelfIntersections?: boolean;
|
|
25
|
+
snapping?: boolean;
|
|
26
|
+
pointerDistance?: number;
|
|
27
|
+
keyEvents?: TerraDrawPolygonModeKeyEvents | null;
|
|
28
|
+
cursors?: Cursors;
|
|
29
|
+
}
|
|
30
|
+
export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonStyling> {
|
|
31
|
+
mode: string;
|
|
32
|
+
private currentCoordinate;
|
|
33
|
+
private currentId;
|
|
34
|
+
private allowSelfIntersections;
|
|
35
|
+
private keyEvents;
|
|
36
|
+
private snappingEnabled;
|
|
37
|
+
private snapping;
|
|
38
|
+
private pixelDistance;
|
|
39
|
+
private closingPoints;
|
|
40
|
+
private cursors;
|
|
41
|
+
private mouseMove;
|
|
42
|
+
constructor(options?: TerraDrawPolygonModeOptions<PolygonStyling>);
|
|
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 { BaseModeOptions, CustomStyling, 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
|
+
interface TerraDrawRectangleModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
18
|
+
keyEvents?: TerraDrawRectangleModeKeyEvents | null;
|
|
19
|
+
cursors?: Cursors;
|
|
20
|
+
}
|
|
21
|
+
export declare class TerraDrawRectangleMode extends TerraDrawBaseDrawMode<RectanglePolygonStyling> {
|
|
22
|
+
mode: string;
|
|
23
|
+
private center;
|
|
24
|
+
private clickCount;
|
|
25
|
+
private currentRectangleId;
|
|
26
|
+
private keyEvents;
|
|
27
|
+
private cursors;
|
|
28
|
+
constructor(options?: TerraDrawRectangleModeOptions<RectanglePolygonStyling>);
|
|
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 {};
|
|
@@ -1,23 +1,52 @@
|
|
|
1
|
-
import { TerraDrawAdapterStyling } 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
|
-
|
|
1
|
+
import { HexColorStyling, NumericStyling, TerraDrawAdapterStyling } from "../../common";
|
|
2
|
+
import { BaseModeOptions, CustomStyling, 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
|
+
interface TerraDrawRenderModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
19
|
+
modeName: string;
|
|
20
|
+
styles: Partial<T>;
|
|
21
|
+
}
|
|
22
|
+
export declare class TerraDrawRenderMode extends TerraDrawBaseDrawMode<RenderModeStyling> {
|
|
23
|
+
type: ModeTypes;
|
|
24
|
+
mode: string;
|
|
25
|
+
constructor(options: TerraDrawRenderModeOptions<RenderModeStyling>);
|
|
26
|
+
/** @internal */
|
|
27
|
+
registerBehaviors(behaviorConfig: BehaviorConfig): void;
|
|
28
|
+
/** @internal */
|
|
29
|
+
start(): void;
|
|
30
|
+
/** @internal */
|
|
31
|
+
stop(): void;
|
|
32
|
+
/** @internal */
|
|
33
|
+
onKeyUp(): void;
|
|
34
|
+
/** @internal */
|
|
35
|
+
onKeyDown(): void;
|
|
36
|
+
/** @internal */
|
|
37
|
+
onClick(): void;
|
|
38
|
+
/** @internal */
|
|
39
|
+
onDragStart(): void;
|
|
40
|
+
/** @internal */
|
|
41
|
+
onDrag(): void;
|
|
42
|
+
/** @internal */
|
|
43
|
+
onDragEnd(): void;
|
|
44
|
+
/** @internal */
|
|
45
|
+
onMouseMove(): void;
|
|
46
|
+
/** @internal */
|
|
47
|
+
cleanUp(): void;
|
|
48
|
+
/** @internal */
|
|
49
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
50
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
import { FeatureId } from "../../../store/store";
|
|
7
|
+
export type ResizeOptions = "center-fixed" | "opposite-fixed" | "opposite" | "center" | "center-planar" | "opposite-planar";
|
|
8
|
+
export declare class DragCoordinateResizeBehavior extends TerraDrawModeBehavior {
|
|
9
|
+
readonly config: BehaviorConfig;
|
|
10
|
+
private readonly pixelDistance;
|
|
11
|
+
private readonly selectionPoints;
|
|
12
|
+
private readonly midPoints;
|
|
13
|
+
private readonly minDistanceFromSelectionPoint;
|
|
14
|
+
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior, minDistanceFromSelectionPoint: number);
|
|
15
|
+
private draggedCoordinate;
|
|
16
|
+
private getClosestCoordinate;
|
|
17
|
+
getDraggableIndex(event: TerraDrawMouseEvent, selectedId: FeatureId): number;
|
|
18
|
+
drag(event: TerraDrawMouseEvent, resizeOption: ResizeOptions): boolean;
|
|
19
|
+
private validateScale;
|
|
20
|
+
private scalePlanar;
|
|
21
|
+
private getCenterOrigin;
|
|
22
|
+
private getBBox;
|
|
23
|
+
private getOppositeOrigin;
|
|
24
|
+
isDragging(): boolean;
|
|
25
|
+
startDragging(id: FeatureId, index: number): void;
|
|
26
|
+
stopDragging(): void;
|
|
27
|
+
private boundingBoxMaps;
|
|
28
|
+
}
|
|
@@ -1,13 +1,20 @@
|
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
private readonly
|
|
10
|
-
private readonly
|
|
11
|
-
|
|
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
|
+
import { FeatureId } from "../../../store/store";
|
|
7
|
+
export declare class DragCoordinateBehavior extends TerraDrawModeBehavior {
|
|
8
|
+
readonly config: BehaviorConfig;
|
|
9
|
+
private readonly pixelDistance;
|
|
10
|
+
private readonly selectionPoints;
|
|
11
|
+
private readonly midPoints;
|
|
12
|
+
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
13
|
+
private draggedCoordinate;
|
|
14
|
+
private getClosestCoordinate;
|
|
15
|
+
getDraggableIndex(event: TerraDrawMouseEvent, selectedId: FeatureId): number;
|
|
16
|
+
drag(event: TerraDrawMouseEvent, allowSelfIntersection: boolean): boolean;
|
|
17
|
+
isDragging(): boolean;
|
|
18
|
+
startDragging(id: FeatureId, index: number): void;
|
|
19
|
+
stopDragging(): void;
|
|
20
|
+
}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent } from "../../../common";
|
|
2
|
-
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
export declare class DragFeatureBehavior extends TerraDrawModeBehavior {
|
|
8
|
-
readonly config: BehaviorConfig;
|
|
9
|
-
private readonly featuresAtMouseEvent;
|
|
10
|
-
private readonly selectionPoints;
|
|
11
|
-
private readonly midPoints;
|
|
12
|
-
constructor(config: BehaviorConfig, featuresAtMouseEvent:
|
|
13
|
-
private
|
|
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
|
+
import { FeatureId } from "../../../store/store";
|
|
7
|
+
export declare class DragFeatureBehavior extends TerraDrawModeBehavior {
|
|
8
|
+
readonly config: BehaviorConfig;
|
|
9
|
+
private readonly featuresAtMouseEvent;
|
|
10
|
+
private readonly selectionPoints;
|
|
11
|
+
private readonly midPoints;
|
|
12
|
+
constructor(config: BehaviorConfig, featuresAtMouseEvent: FeatureAtPointerEventBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
13
|
+
private draggedFeatureId;
|
|
14
|
+
private dragPosition;
|
|
15
|
+
startDragging(event: TerraDrawMouseEvent, id: FeatureId): void;
|
|
16
|
+
stopDragging(): void;
|
|
17
|
+
isDragging(): boolean;
|
|
18
|
+
canDrag(event: TerraDrawMouseEvent, selectedId: FeatureId): boolean;
|
|
19
|
+
drag(event: TerraDrawMouseEvent): false | undefined;
|
|
20
|
+
}
|
|
@@ -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
|
|
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 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,18 +1,19 @@
|
|
|
1
|
-
import { Point, Position } from "geojson";
|
|
2
|
-
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
-
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
1
|
+
import { Point, Position } from "geojson";
|
|
2
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
+
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
4
|
+
import { FeatureId } from "../../../store/store";
|
|
5
|
+
export declare class MidPointBehavior extends TerraDrawModeBehavior {
|
|
6
|
+
readonly config: BehaviorConfig;
|
|
7
|
+
private readonly selectionPointBehavior;
|
|
8
|
+
constructor(config: BehaviorConfig, selectionPointBehavior: SelectionPointBehavior);
|
|
9
|
+
private _midPoints;
|
|
10
|
+
get ids(): string[];
|
|
11
|
+
set ids(_: string[]);
|
|
12
|
+
insert(midPointId: string, coordinatePrecision: number): void;
|
|
13
|
+
create(selectedCoords: Position[], featureId: FeatureId, coordinatePrecision: number): void;
|
|
14
|
+
delete(): void;
|
|
15
|
+
getUpdated(updatedCoordinates: Position[]): {
|
|
16
|
+
id: string;
|
|
17
|
+
geometry: Point;
|
|
18
|
+
}[] | undefined;
|
|
19
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
private readonly
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
import { FeatureId } from "../../../store/store";
|
|
6
|
+
export declare class RotateFeatureBehavior extends TerraDrawModeBehavior {
|
|
7
|
+
readonly config: BehaviorConfig;
|
|
8
|
+
private readonly selectionPoints;
|
|
9
|
+
private readonly midPoints;
|
|
10
|
+
constructor(config: BehaviorConfig, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
11
|
+
private lastBearing;
|
|
12
|
+
reset(): void;
|
|
13
|
+
rotate(event: TerraDrawMouseEvent, selectedId: FeatureId): void;
|
|
14
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
private readonly
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
import { FeatureId } from "../../../store/store";
|
|
6
|
+
export declare class ScaleFeatureBehavior extends TerraDrawModeBehavior {
|
|
7
|
+
readonly config: BehaviorConfig;
|
|
8
|
+
private readonly selectionPoints;
|
|
9
|
+
private readonly midPoints;
|
|
10
|
+
constructor(config: BehaviorConfig, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
11
|
+
private lastDistance;
|
|
12
|
+
reset(): void;
|
|
13
|
+
scale(event: TerraDrawMouseEvent, selectedId: FeatureId): void;
|
|
14
|
+
}
|