terra-draw 0.0.1-alpha.45 → 0.0.1-alpha.48
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/dist/adapters/common/base.adapter.d.ts +2 -0
- package/dist/common.d.ts +2 -1
- package/dist/geometry/shape/create-bbox.d.ts +10 -0
- package/dist/modes/click-bounding-box.behavior.d.ts +1 -2
- package/dist/modes/freehand/freehand.mode.d.ts +2 -0
- package/dist/modes/select/behaviors/drag-coordinate.behavior.d.ts +1 -1
- package/dist/modes/select/behaviors/drag-feature.behavior.d.ts +2 -2
- package/dist/modes/select/behaviors/feature-at-pointer-event.behavior.d.ts +15 -0
- package/dist/modes/select/select.mode.d.ts +2 -0
- package/dist/modes/snapping.behavior.d.ts +2 -0
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- package/dist/terra-draw.d.ts +26 -0
- package/dist/terra-draw.modern.js +1 -1
- package/dist/terra-draw.modern.js.map +1 -1
- package/dist/terra-draw.module.js +1 -1
- package/dist/terra-draw.module.js.map +1 -1
- package/dist/terra-draw.umd.js +1 -1
- package/dist/terra-draw.umd.js.map +1 -1
- package/package.json +2 -4
- package/CHANGELOG.md +0 -433
- package/guides/CODE_OF_CONDUCT.md +0 -36
- package/guides/COMMON_PATTERNS.md +0 -157
- package/guides/CONTRIBUTING.md +0 -17
- package/guides/DEVELOPMENT.md +0 -156
- package/guides/GETTING_STARTED.md +0 -216
- package/jest.config.ts +0 -27
- package/logo.png +0 -0
- package/scratch/release.sh +0 -5
- package/scripts/next-alpha-version.ts +0 -21
|
@@ -8,9 +8,11 @@ export declare abstract class TerraDrawBaseAdapter {
|
|
|
8
8
|
coordinatePrecision?: number;
|
|
9
9
|
minPixelDragDistanceDrawing?: number;
|
|
10
10
|
minPixelDragDistance?: number;
|
|
11
|
+
minPixelDragDistanceSelecting?: number;
|
|
11
12
|
});
|
|
12
13
|
protected _minPixelDragDistance: number;
|
|
13
14
|
protected _minPixelDragDistanceDrawing: number;
|
|
15
|
+
protected _minPixelDragDistanceSelecting: number;
|
|
14
16
|
protected _lastDrawEvent: TerraDrawMouseEvent | undefined;
|
|
15
17
|
protected _coordinatePrecision: number;
|
|
16
18
|
protected _heldKeys: Set<string>;
|
package/dist/common.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export interface TerraDrawModeRegisterConfig {
|
|
|
57
57
|
project: Project;
|
|
58
58
|
unproject: Unproject;
|
|
59
59
|
}
|
|
60
|
-
export type TerraDrawModeState = "unregistered" | "registered" | "started" | "drawing" | "
|
|
60
|
+
export type TerraDrawModeState = "unregistered" | "registered" | "started" | "drawing" | "selecting" | "stopped";
|
|
61
61
|
export interface TerraDrawCallbacks {
|
|
62
62
|
getState: () => TerraDrawModeState;
|
|
63
63
|
onKeyUp: (event: TerraDrawKeyboardEvent) => void;
|
|
@@ -82,6 +82,7 @@ export interface TerraDrawAdapter {
|
|
|
82
82
|
project: Project;
|
|
83
83
|
unproject: Unproject;
|
|
84
84
|
setCursor: SetCursor;
|
|
85
|
+
getLngLatFromEvent: GetLngLatFromEvent;
|
|
85
86
|
setDoubleClickToZoom: (enabled: boolean) => void;
|
|
86
87
|
getMapContainer: () => HTMLElement;
|
|
87
88
|
register(callbacks: TerraDrawCallbacks): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Feature, Polygon } from "geojson";
|
|
2
|
+
import { Unproject } from "../../common";
|
|
3
|
+
export declare function createBBoxFromPoint({ unproject, point, pointerDistance, }: {
|
|
4
|
+
point: {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
};
|
|
8
|
+
unproject: Unproject;
|
|
9
|
+
pointerDistance: number;
|
|
10
|
+
}): Feature<Polygon, import("geojson").GeoJsonProperties>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Feature, Polygon } from "geojson";
|
|
2
1
|
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
3
2
|
import { TerraDrawMouseEvent } from "../common";
|
|
4
3
|
export declare class ClickBoundingBoxBehavior extends TerraDrawModeBehavior {
|
|
5
4
|
constructor(config: BehaviorConfig);
|
|
6
|
-
create(event: TerraDrawMouseEvent): Feature<Polygon, import("geojson").GeoJsonProperties>;
|
|
5
|
+
create(event: TerraDrawMouseEvent): import("geojson").Feature<import("geojson").Polygon, import("geojson").GeoJsonProperties>;
|
|
7
6
|
}
|
|
@@ -27,9 +27,11 @@ export declare class TerraDrawFreehandMode extends TerraDrawBaseDrawMode<Freehan
|
|
|
27
27
|
private minDistance;
|
|
28
28
|
private keyEvents;
|
|
29
29
|
private cursors;
|
|
30
|
+
private preventPointsNearClose;
|
|
30
31
|
constructor(options?: {
|
|
31
32
|
styles?: Partial<FreehandPolygonStyling>;
|
|
32
33
|
minDistance?: number;
|
|
34
|
+
preventPointsNearClose?: boolean;
|
|
33
35
|
keyEvents?: TerraDrawFreehandModeKeyEvents | null;
|
|
34
36
|
cursors?: Cursors;
|
|
35
37
|
});
|
|
@@ -12,7 +12,7 @@ export declare class DragCoordinateBehavior extends TerraDrawModeBehavior {
|
|
|
12
12
|
private draggedCoordinate;
|
|
13
13
|
private getClosestCoordinate;
|
|
14
14
|
getDraggableIndex(event: TerraDrawMouseEvent, selectedId: string): number;
|
|
15
|
-
drag(event: TerraDrawMouseEvent): boolean;
|
|
15
|
+
drag(event: TerraDrawMouseEvent, allowSelfIntersection: boolean): boolean;
|
|
16
16
|
isDragging(): boolean;
|
|
17
17
|
startDragging(id: string, index: number): void;
|
|
18
18
|
stopDragging(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TerraDrawMouseEvent } from "../../../common";
|
|
2
2
|
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
-
import {
|
|
3
|
+
import { FeatureAtPointerEventBehavior } from "./feature-at-pointer-event.behavior";
|
|
4
4
|
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
5
5
|
import { MidPointBehavior } from "./midpoint.behavior";
|
|
6
6
|
export declare class DragFeatureBehavior extends TerraDrawModeBehavior {
|
|
@@ -8,7 +8,7 @@ export declare class DragFeatureBehavior extends TerraDrawModeBehavior {
|
|
|
8
8
|
private readonly featuresAtMouseEvent;
|
|
9
9
|
private readonly selectionPoints;
|
|
10
10
|
private readonly midPoints;
|
|
11
|
-
constructor(config: BehaviorConfig, featuresAtMouseEvent:
|
|
11
|
+
constructor(config: BehaviorConfig, featuresAtMouseEvent: FeatureAtPointerEventBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
12
12
|
private draggedFeatureId;
|
|
13
13
|
private dragPosition;
|
|
14
14
|
startDragging(event: TerraDrawMouseEvent, id: string): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TerraDrawMouseEvent } from "../../../common";
|
|
2
|
+
import { GeoJSONStoreFeatures } from "../../../store/store";
|
|
3
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
4
|
+
import { ClickBoundingBoxBehavior } from "../../click-bounding-box.behavior";
|
|
5
|
+
import { PixelDistanceBehavior } from "../../pixel-distance.behavior";
|
|
6
|
+
export declare class FeatureAtPointerEventBehavior extends TerraDrawModeBehavior {
|
|
7
|
+
readonly config: BehaviorConfig;
|
|
8
|
+
private readonly createClickBoundingBox;
|
|
9
|
+
private readonly pixelDistance;
|
|
10
|
+
constructor(config: BehaviorConfig, createClickBoundingBox: ClickBoundingBoxBehavior, pixelDistance: PixelDistanceBehavior);
|
|
11
|
+
find(event: TerraDrawMouseEvent, hasSelection: boolean): {
|
|
12
|
+
clickedFeature: GeoJSONStoreFeatures | undefined;
|
|
13
|
+
clickedMidPoint: GeoJSONStoreFeatures | undefined;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -13,6 +13,7 @@ type ModeFlags = {
|
|
|
13
13
|
draggable?: boolean;
|
|
14
14
|
rotateable?: boolean;
|
|
15
15
|
scaleable?: boolean;
|
|
16
|
+
selfIntersectable?: boolean;
|
|
16
17
|
coordinates?: {
|
|
17
18
|
midpoints?: boolean;
|
|
18
19
|
draggable?: boolean;
|
|
@@ -74,6 +75,7 @@ export declare class TerraDrawSelectMode extends TerraDrawBaseDrawMode<Selection
|
|
|
74
75
|
dragEventThrottle?: number;
|
|
75
76
|
cursors?: Cursors;
|
|
76
77
|
});
|
|
78
|
+
setSelecting(): void;
|
|
77
79
|
registerBehaviors(config: BehaviorConfig): void;
|
|
78
80
|
private deselect;
|
|
79
81
|
private deleteSelected;
|
|
@@ -8,6 +8,8 @@ export declare class SnappingBehavior extends TerraDrawModeBehavior {
|
|
|
8
8
|
private readonly pixelDistance;
|
|
9
9
|
private readonly clickBoundingBox;
|
|
10
10
|
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, clickBoundingBox: ClickBoundingBoxBehavior);
|
|
11
|
+
/** Returns the nearest snappable coordinate - on first click there is no currentId so no need to provide */
|
|
12
|
+
getSnappableCoordinateFirstClick: (event: TerraDrawMouseEvent) => Position | undefined;
|
|
11
13
|
getSnappableCoordinate: (event: TerraDrawMouseEvent, currentFeatureId: string) => Position | undefined;
|
|
12
14
|
private getSnappable;
|
|
13
15
|
}
|