terra-draw 1.0.0-beta.0 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/geometry/calculate-relative-angle.d.ts +17 -0
- package/dist/geometry/determine-halfplane.d.ts +10 -0
- package/dist/geometry/measure/destination.d.ts +7 -0
- package/dist/geometry/measure/pixel-distance.d.ts +1 -1
- package/dist/modes/angled-rectangle/angled-rectangle.mode.d.ts +62 -0
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- package/dist/terra-draw.d.ts +2 -1
- 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/e2e/public/index.html +1 -0
- package/e2e/tests/leaflet.spec.ts +82 -0
- package/e2e/tests/setup.ts +19 -2
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Terra Draw centralizes map drawing logic and provides a host of out-of-the-box d
|
|
|
14
14
|
Terra Draw uses the concept of 'adapters' to allow it to work with a host of different mapping libraries. Currently supported are:
|
|
15
15
|
|
|
16
16
|
- [Leaflet](https://leafletjs.com/) v1
|
|
17
|
-
- [OpenLayers](https://openlayers.org/)
|
|
17
|
+
- [OpenLayers](https://openlayers.org/) v10
|
|
18
18
|
- [Mapbox GL JS](https://www.mapbox.com/mapbox-gljs) v2
|
|
19
19
|
- [MapLibre](https://maplibre.org/maplibre-gl-js/docs/) v2/v3
|
|
20
20
|
- [Google Maps JS API](https://developers.google.com/maps/documentation/javascript/overview) v3
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculate the relative angle between two lines
|
|
3
|
+
* @param A The first point of the first line
|
|
4
|
+
* @param B The second point of the first line and the first point of the second line
|
|
5
|
+
* @param C The second point of the second line
|
|
6
|
+
* @returns The relative angle between the two lines
|
|
7
|
+
*/
|
|
8
|
+
export declare function calculateRelativeAngle(A: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}, B: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}, C: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
}): number;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { Position } from "geojson";
|
|
2
2
|
export declare function destination(origin: Position, distance: number, bearing: number): Position;
|
|
3
|
+
export declare function webMercatorDestination({ x, y }: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}, distance: number, bearing: number): {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
};
|
|
15
|
+
interface Cursors {
|
|
16
|
+
start?: Cursor;
|
|
17
|
+
close?: Cursor;
|
|
18
|
+
}
|
|
19
|
+
interface TerraDrawPolygonModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
20
|
+
snapping?: boolean;
|
|
21
|
+
pointerDistance?: number;
|
|
22
|
+
keyEvents?: TerraDrawPolygonModeKeyEvents | null;
|
|
23
|
+
cursors?: Cursors;
|
|
24
|
+
}
|
|
25
|
+
export declare class TerraDrawAngledRectangleMode extends TerraDrawBaseDrawMode<PolygonStyling> {
|
|
26
|
+
mode: string;
|
|
27
|
+
private currentCoordinate;
|
|
28
|
+
private currentId;
|
|
29
|
+
private keyEvents;
|
|
30
|
+
private pixelDistance;
|
|
31
|
+
private cursors;
|
|
32
|
+
private mouseMove;
|
|
33
|
+
constructor(options?: TerraDrawPolygonModeOptions<PolygonStyling>);
|
|
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
|
+
private updatePolygonGeometry;
|
|
44
|
+
/** @internal */
|
|
45
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
46
|
+
/** @internal */
|
|
47
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
48
|
+
/** @internal */
|
|
49
|
+
onKeyDown(): void;
|
|
50
|
+
/** @internal */
|
|
51
|
+
onDragStart(): void;
|
|
52
|
+
/** @internal */
|
|
53
|
+
onDrag(): void;
|
|
54
|
+
/** @internal */
|
|
55
|
+
onDragEnd(): void;
|
|
56
|
+
/** @internal */
|
|
57
|
+
cleanUp(): void;
|
|
58
|
+
/** @internal */
|
|
59
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
60
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
61
|
+
}
|
|
62
|
+
export {};
|