terra-draw 1.2.0 → 1.3.0

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.
@@ -1,4 +1,6 @@
1
+ import { Position } from "geojson";
1
2
  export declare function validLatitude(lat: number): boolean;
2
3
  export declare function validLongitude(lng: number): boolean;
3
- export declare function coordinateIsValid(coordinate: unknown[], coordinatePrecision: number): boolean;
4
+ export declare function coordinatePrecisionIsValid(coordinate: Position, coordinatePrecision: number): boolean;
5
+ export declare function coordinateIsValid(coordinate: unknown[]): boolean;
4
6
  export declare function getDecimalPlaces(value: number): number;
@@ -99,6 +99,7 @@ export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineS
99
99
  /** @internal */
100
100
  styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
101
101
  validateFeature(feature: unknown): StoreValidation;
102
+ private lineStringFilter;
102
103
  private snapCoordinate;
103
104
  }
104
105
  export {};
@@ -1,8 +1,8 @@
1
- import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
2
- import { Position } from "geojson";
1
+ import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor, Project, Unproject } from "../../common";
2
+ import { Polygon, Position } from "geojson";
3
3
  import { TerraDrawBaseDrawMode, BaseModeOptions, CustomStyling } from "../base.mode";
4
4
  import { BehaviorConfig } from "../base.behavior";
5
- import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
5
+ import { FeatureId, GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
6
6
  type TerraDrawPolygonModeKeyEvents = {
7
7
  cancel?: KeyboardEvent["key"] | null;
8
8
  finish?: KeyboardEvent["key"] | null;
@@ -34,7 +34,13 @@ interface Cursors {
34
34
  interface Snapping {
35
35
  toLine?: boolean;
36
36
  toCoordinate?: boolean;
37
- toCustom?: (event: TerraDrawMouseEvent) => Position | undefined;
37
+ toCustom?: (event: TerraDrawMouseEvent, context: {
38
+ currentId?: FeatureId;
39
+ currentCoordinate?: number;
40
+ getCurrentGeometrySnapshot: () => Polygon | null;
41
+ project: Project;
42
+ unproject: Unproject;
43
+ }) => Position | undefined;
38
44
  }
39
45
  interface TerraDrawPolygonModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
40
46
  snapping?: Snapping;
@@ -76,6 +82,7 @@ export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonS
76
82
  onMouseMove(event: TerraDrawMouseEvent): void;
77
83
  private updatePolygonGeometry;
78
84
  private snapCoordinate;
85
+ private polygonFilter;
79
86
  private onRightClick;
80
87
  private onLeftClick;
81
88
  /** @internal */
@@ -17,7 +17,9 @@ type ModeFlags = {
17
17
  scaleable?: boolean;
18
18
  selfIntersectable?: boolean;
19
19
  coordinates?: {
20
- midpoints?: boolean;
20
+ midpoints?: boolean | {
21
+ draggable?: boolean;
22
+ };
21
23
  draggable?: boolean;
22
24
  resizable?: ResizeOptions;
23
25
  deletable?: boolean;