terra-draw 0.0.1-alpha.63 → 0.0.1-alpha.64

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.
@@ -2,12 +2,18 @@
2
2
  "name": "terra-draw",
3
3
  "dockerFile": "Dockerfile",
4
4
  "build": {
5
- "args": { "NODE_MAJOR_VERSION": "18" }
5
+ "args": {
6
+ "NODE_MAJOR_VERSION": "20"
7
+ }
6
8
  },
7
9
  "postCreateCommand": [".devcontainer/post-create.sh"],
8
10
  "portsAttributes": {
9
- "3000": { "label": "Docs" },
10
- "9000": { "label": "Development" }
11
+ "3000": {
12
+ "label": "Docs"
13
+ },
14
+ "9000": {
15
+ "label": "Development"
16
+ }
11
17
  },
12
18
  "customizations": {
13
19
  "vscode": {
@@ -0,0 +1,2 @@
1
+ import { Polygon } from "geojson";
2
+ export declare function polygonAreaSquareMeters(polygon: Polygon): number;
@@ -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): void;
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): void;
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;
@@ -20,7 +20,7 @@ export type GeoJSONStoreConfig<Id extends FeatureId> = {
20
20
  tracked?: boolean;
21
21
  };
22
22
  export declare const defaultIdStrategy: {
23
- getId: <FeatureId_1>() => FeatureId_1;
23
+ getId: <FeatureId>() => FeatureId;
24
24
  isValidId: (id: FeatureId) => boolean;
25
25
  };
26
26
  export declare class GeoJSONStore<Id extends FeatureId = FeatureId> {