terra-draw 0.0.1-alpha.63 → 0.0.1-alpha.65
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/devcontainer.json +9 -3
- package/README.md +3 -3
- package/dist/geometry/measure/area.d.ts +2 -0
- package/dist/geometry/web-mercator-center.d.ts +5 -0
- package/dist/modes/select/behaviors/drag-coordinate-resize.behavior.d.ts +2 -2
- package/dist/modes/select/behaviors/drag-coordinate.behavior.d.ts +2 -2
- package/dist/modes/select/behaviors/drag-feature.behavior.d.ts +2 -2
- package/dist/modes/select/behaviors/rotate-feature.behavior.d.ts +2 -2
- package/dist/modes/select/behaviors/scale-feature.behavior.d.ts +2 -2
- package/dist/modes/select/select.mode.d.ts +2 -0
- package/dist/store/store.d.ts +1 -1
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- package/dist/terra-draw.d.ts +3 -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/dist/validations/max-size.validation.d.ts +2 -0
- package/dist/validations/min-size.validation.d.ts +2 -0
- package/package.json +11 -11
- package/dist/adapters/common/adapter-listener.d.ts +0 -22
- package/dist/adapters/common/base.adapter.d.ts +0 -59
- package/e2e/src/index.ts +0 -165
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
"name": "terra-draw",
|
|
3
3
|
"dockerFile": "Dockerfile",
|
|
4
4
|
"build": {
|
|
5
|
-
"args": {
|
|
5
|
+
"args": {
|
|
6
|
+
"NODE_MAJOR_VERSION": "20"
|
|
7
|
+
}
|
|
6
8
|
},
|
|
7
9
|
"postCreateCommand": [".devcontainer/post-create.sh"],
|
|
8
10
|
"portsAttributes": {
|
|
9
|
-
"3000": {
|
|
10
|
-
|
|
11
|
+
"3000": {
|
|
12
|
+
"label": "Docs"
|
|
13
|
+
},
|
|
14
|
+
"9000": {
|
|
15
|
+
"label": "Development"
|
|
16
|
+
}
|
|
11
17
|
},
|
|
12
18
|
"customizations": {
|
|
13
19
|
"vscode": {
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Terra Draw uses the concept of 'adapters' to allow it to work with a host of dif
|
|
|
16
16
|
- [Leaflet](https://leafletjs.com/) v1
|
|
17
17
|
- [OpenLayers](https://openlayers.org/) v7
|
|
18
18
|
- [Mapbox GL JS](https://www.mapbox.com/mapbox-gljs) v2
|
|
19
|
-
- [MapLibre](https://maplibre.org/
|
|
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
|
|
21
21
|
- [ArcGIS JavaScript SDK](https://developers.arcgis.com/javascript/latest/) v4 (MapView)
|
|
22
22
|
|
|
@@ -26,8 +26,8 @@ Please see the [the getting started guide](./guides/1.GETTING_STARTED.md) - this
|
|
|
26
26
|
|
|
27
27
|
### Development & Contributing
|
|
28
28
|
|
|
29
|
-
* For development, please see the [the development documentation](./guides/
|
|
30
|
-
* For guidance on contributing, please see the [the contributing documentation](./guides/
|
|
29
|
+
* For development, please see the [the development documentation](./guides/7.DEVELOPMENT.md)
|
|
30
|
+
* For guidance on contributing, please see the [the contributing documentation](./guides/7.DEVELOPMENT.md#contributing)
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
### Project Website
|
|
@@ -3,7 +3,7 @@ import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
|
3
3
|
import { PixelDistanceBehavior } from "../../pixel-distance.behavior";
|
|
4
4
|
import { MidPointBehavior } from "./midpoint.behavior";
|
|
5
5
|
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
6
|
-
import { FeatureId } from "../../../store/store";
|
|
6
|
+
import { FeatureId, GeoJSONStoreFeatures } from "../../../store/store";
|
|
7
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;
|
|
@@ -58,5 +58,5 @@ export declare class DragCoordinateResizeBehavior extends TerraDrawModeBehavior
|
|
|
58
58
|
* @param resizeOption - the resize option, either "center-web-mercator" or "opposite-web-mercator"
|
|
59
59
|
* @returns - true is resize was successful, false otherwise
|
|
60
60
|
*/
|
|
61
|
-
drag(event: TerraDrawMouseEvent, resizeOption: ResizeOptions): boolean;
|
|
61
|
+
drag(event: TerraDrawMouseEvent, resizeOption: ResizeOptions, validateFeature?: (feature: GeoJSONStoreFeatures) => boolean): boolean;
|
|
62
62
|
}
|
|
@@ -3,7 +3,7 @@ import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
|
3
3
|
import { PixelDistanceBehavior } from "../../pixel-distance.behavior";
|
|
4
4
|
import { MidPointBehavior } from "./midpoint.behavior";
|
|
5
5
|
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
6
|
-
import { FeatureId } from "../../../store/store";
|
|
6
|
+
import { FeatureId, GeoJSONStoreFeatures } from "../../../store/store";
|
|
7
7
|
export declare class DragCoordinateBehavior extends TerraDrawModeBehavior {
|
|
8
8
|
readonly config: BehaviorConfig;
|
|
9
9
|
private readonly pixelDistance;
|
|
@@ -13,7 +13,7 @@ export declare class DragCoordinateBehavior extends TerraDrawModeBehavior {
|
|
|
13
13
|
private draggedCoordinate;
|
|
14
14
|
private getClosestCoordinate;
|
|
15
15
|
getDraggableIndex(event: TerraDrawMouseEvent, selectedId: FeatureId): number;
|
|
16
|
-
drag(event: TerraDrawMouseEvent, allowSelfIntersection: boolean): boolean;
|
|
16
|
+
drag(event: TerraDrawMouseEvent, allowSelfIntersection: boolean, validateFeature?: (feature: GeoJSONStoreFeatures) => boolean): boolean;
|
|
17
17
|
isDragging(): boolean;
|
|
18
18
|
startDragging(id: FeatureId, index: number): void;
|
|
19
19
|
stopDragging(): void;
|
|
@@ -3,7 +3,7 @@ import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
|
3
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
|
-
import { FeatureId } from "../../../store/store";
|
|
6
|
+
import { FeatureId, GeoJSONStoreFeatures } from "../../../store/store";
|
|
7
7
|
export declare class DragFeatureBehavior extends TerraDrawModeBehavior {
|
|
8
8
|
readonly config: BehaviorConfig;
|
|
9
9
|
private readonly featuresAtMouseEvent;
|
|
@@ -16,5 +16,5 @@ export declare class DragFeatureBehavior extends TerraDrawModeBehavior {
|
|
|
16
16
|
stopDragging(): void;
|
|
17
17
|
isDragging(): boolean;
|
|
18
18
|
canDrag(event: TerraDrawMouseEvent, selectedId: FeatureId): boolean;
|
|
19
|
-
drag(event: TerraDrawMouseEvent): false | undefined;
|
|
19
|
+
drag(event: TerraDrawMouseEvent, validateFeature?: (feature: GeoJSONStoreFeatures) => boolean): false | undefined;
|
|
20
20
|
}
|
|
@@ -2,7 +2,7 @@ import { TerraDrawMouseEvent } from "../../../common";
|
|
|
2
2
|
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
3
|
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
4
4
|
import { MidPointBehavior } from "./midpoint.behavior";
|
|
5
|
-
import { FeatureId } from "../../../store/store";
|
|
5
|
+
import { FeatureId, GeoJSONStoreFeatures } from "../../../store/store";
|
|
6
6
|
export declare class RotateFeatureBehavior extends TerraDrawModeBehavior {
|
|
7
7
|
readonly config: BehaviorConfig;
|
|
8
8
|
private readonly selectionPoints;
|
|
@@ -10,5 +10,5 @@ export declare class RotateFeatureBehavior extends TerraDrawModeBehavior {
|
|
|
10
10
|
constructor(config: BehaviorConfig, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
11
11
|
private lastBearing;
|
|
12
12
|
reset(): void;
|
|
13
|
-
rotate(event: TerraDrawMouseEvent, selectedId: FeatureId):
|
|
13
|
+
rotate(event: TerraDrawMouseEvent, selectedId: FeatureId, validateFeature?: (feature: GeoJSONStoreFeatures) => boolean): false | undefined;
|
|
14
14
|
}
|
|
@@ -2,7 +2,7 @@ import { TerraDrawMouseEvent } from "../../../common";
|
|
|
2
2
|
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
3
|
import { SelectionPointBehavior } from "./selection-point.behavior";
|
|
4
4
|
import { MidPointBehavior } from "./midpoint.behavior";
|
|
5
|
-
import { FeatureId } from "../../../store/store";
|
|
5
|
+
import { FeatureId, GeoJSONStoreFeatures } from "../../../store/store";
|
|
6
6
|
export declare class ScaleFeatureBehavior extends TerraDrawModeBehavior {
|
|
7
7
|
readonly config: BehaviorConfig;
|
|
8
8
|
private readonly selectionPoints;
|
|
@@ -10,5 +10,5 @@ export declare class ScaleFeatureBehavior extends TerraDrawModeBehavior {
|
|
|
10
10
|
constructor(config: BehaviorConfig, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
|
|
11
11
|
private lastDistance;
|
|
12
12
|
reset(): void;
|
|
13
|
-
scale(event: TerraDrawMouseEvent, selectedId: FeatureId):
|
|
13
|
+
scale(event: TerraDrawMouseEvent, selectedId: FeatureId, validateFeature?: (feature: GeoJSONStoreFeatures) => boolean): false | undefined;
|
|
14
14
|
}
|
|
@@ -11,6 +11,7 @@ type TerraDrawSelectModeKeyEvents = {
|
|
|
11
11
|
};
|
|
12
12
|
type ModeFlags = {
|
|
13
13
|
feature?: {
|
|
14
|
+
validation?: (geometry: GeoJSONStoreFeatures) => boolean;
|
|
14
15
|
draggable?: boolean;
|
|
15
16
|
rotateable?: boolean;
|
|
16
17
|
scaleable?: boolean;
|
|
@@ -78,6 +79,7 @@ export declare class TerraDrawSelectMode extends TerraDrawBaseSelectMode<Selecti
|
|
|
78
79
|
private scaleFeature;
|
|
79
80
|
private dragCoordinateResizeFeature;
|
|
80
81
|
private cursors;
|
|
82
|
+
private validations;
|
|
81
83
|
constructor(options?: TerraDrawSelectModeOptions<SelectionStyling>);
|
|
82
84
|
selectFeature(featureId: FeatureId): void;
|
|
83
85
|
setSelecting(): void;
|
package/dist/store/store.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type GeoJSONStoreConfig<Id extends FeatureId> = {
|
|
|
20
20
|
tracked?: boolean;
|
|
21
21
|
};
|
|
22
22
|
export declare const defaultIdStrategy: {
|
|
23
|
-
getId: <
|
|
23
|
+
getId: <FeatureId>() => FeatureId;
|
|
24
24
|
isValidId: (id: FeatureId) => boolean;
|
|
25
25
|
};
|
|
26
26
|
export declare class GeoJSONStore<Id extends FeatureId = FeatureId> {
|