terra-draw 0.0.1-alpha.62 → 0.0.1-alpha.63
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/geometry/project/web-mercator.d.ts +20 -0
- package/dist/modes/select/behaviors/drag-coordinate-resize.behavior.d.ts +44 -10
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -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/src/index.ts +2 -2
- package/e2e/tests/leaflet.spec.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert longitude and latitude to web mercator x and y
|
|
3
|
+
* @param lng
|
|
4
|
+
* @param lat
|
|
5
|
+
* @returns - web mercator x and y
|
|
6
|
+
*/
|
|
7
|
+
export declare const lngLatToWebMercatorXY: (lng: number, lat: number) => {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Convert web mercator x and y to longitude and latitude
|
|
13
|
+
* @param x - web mercator x
|
|
14
|
+
* @param y - web mercator y
|
|
15
|
+
* @returns - longitude and latitude
|
|
16
|
+
*/
|
|
17
|
+
export declare const webMercatorXYToLngLat: (x: number, y: number) => {
|
|
18
|
+
lng: number;
|
|
19
|
+
lat: number;
|
|
20
|
+
};
|
|
@@ -4,25 +4,59 @@ import { PixelDistanceBehavior } from "../../pixel-distance.behavior";
|
|
|
4
4
|
import { MidPointBehavior } from "./midpoint.behavior";
|
|
5
5
|
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
6
6
|
import { FeatureId } from "../../../store/store";
|
|
7
|
-
export type ResizeOptions = "center-
|
|
7
|
+
export type ResizeOptions = "center-web-mercator" | "opposite-web-mercator" | "center-fixed-web-mercator" | "opposite-fixed-web-mercator";
|
|
8
8
|
export declare class DragCoordinateResizeBehavior extends TerraDrawModeBehavior {
|
|
9
9
|
readonly config: BehaviorConfig;
|
|
10
10
|
private readonly pixelDistance;
|
|
11
11
|
private readonly selectionPoints;
|
|
12
12
|
private readonly midPoints;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
14
|
+
private minimumScale;
|
|
15
15
|
private draggedCoordinate;
|
|
16
|
+
private boundingBoxMaps;
|
|
16
17
|
private getClosestCoordinate;
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
private isValidDragWebMercator;
|
|
19
|
+
private getSelectedFeatureDataWebMercator;
|
|
20
|
+
private centerWebMercatorDrag;
|
|
21
|
+
private centerFixedWebMercatorDrag;
|
|
22
|
+
private scaleFixedWebMercator;
|
|
23
|
+
private oppositeFixedWebMercatorDrag;
|
|
24
|
+
private oppositeWebMercatorDrag;
|
|
25
|
+
private scaleWebMercator;
|
|
26
|
+
private getFeature;
|
|
27
|
+
private getNormalisedCoordinates;
|
|
19
28
|
private validateScale;
|
|
20
|
-
private
|
|
21
|
-
private
|
|
22
|
-
private
|
|
23
|
-
|
|
29
|
+
private performWebMercatorScale;
|
|
30
|
+
private getBBoxWebMercator;
|
|
31
|
+
private getIndexesWebMercator;
|
|
32
|
+
/**
|
|
33
|
+
* @returns - true if the feature is being dragged (resized), false otherwise
|
|
34
|
+
*/
|
|
24
35
|
isDragging(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Starts the resizing of the feature
|
|
38
|
+
* @param id - feature id of the feature that is being dragged
|
|
39
|
+
* @param index - index of the coordinate that is being dragged
|
|
40
|
+
* @returns - void
|
|
41
|
+
*/
|
|
25
42
|
startDragging(id: FeatureId, index: number): void;
|
|
43
|
+
/**
|
|
44
|
+
* Stops the resizing of the feature
|
|
45
|
+
* @returns - void *
|
|
46
|
+
*/
|
|
26
47
|
stopDragging(): void;
|
|
27
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Returns the index of the coordinate that is going to be dragged
|
|
50
|
+
* @param event - cursor event
|
|
51
|
+
* @param selectedId - feature id of the feature that is selected
|
|
52
|
+
* @returns - the index to be dragged
|
|
53
|
+
*/
|
|
54
|
+
getDraggableIndex(event: TerraDrawMouseEvent, selectedId: FeatureId): number;
|
|
55
|
+
/**
|
|
56
|
+
* Resizes the feature based on the cursor event
|
|
57
|
+
* @param event - cursor event
|
|
58
|
+
* @param resizeOption - the resize option, either "center-web-mercator" or "opposite-web-mercator"
|
|
59
|
+
* @returns - true is resize was successful, false otherwise
|
|
60
|
+
*/
|
|
61
|
+
drag(event: TerraDrawMouseEvent, resizeOption: ResizeOptions): boolean;
|
|
28
62
|
}
|