terra-draw 0.0.1-alpha.55 → 0.0.1-alpha.57

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,2 +1,2 @@
1
- import { Feature, LineString, Polygon } from "geojson";
2
- export declare function transformScale(feature: Feature<Polygon | LineString>, factor: number): Feature<Polygon | LineString, import("geojson").GeoJsonProperties>;
1
+ import { Feature, LineString, Polygon, Position } from "geojson";
2
+ export declare function transformScale(feature: Feature<Polygon | LineString>, factor: number, origin: Position, axis?: "x" | "y" | "xy"): Feature<Polygon | LineString, import("geojson").GeoJsonProperties>;
@@ -0,0 +1,25 @@
1
+ import { TerraDrawMouseEvent } from "../../../common";
2
+ import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
3
+ import { PixelDistanceBehavior } from "../../pixel-distance.behavior";
4
+ import { MidPointBehavior } from "./midpoint.behavior";
5
+ import { SelectionPointBehavior } from "./selection-point.behavior";
6
+ import { FeatureId } from "../../../store/store";
7
+ export type ResizeOptions = "center-fixed" | "opposite-corner-fixed";
8
+ export declare class DragCoordinateResizeBehavior extends TerraDrawModeBehavior {
9
+ readonly config: BehaviorConfig;
10
+ private readonly pixelDistance;
11
+ private readonly selectionPoints;
12
+ private readonly midPoints;
13
+ constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior);
14
+ private draggedCoordinate;
15
+ private getClosestCoordinate;
16
+ getDraggableIndex(event: TerraDrawMouseEvent, selectedId: FeatureId): number;
17
+ private lastDistance;
18
+ drag(event: TerraDrawMouseEvent, resizeOption: ResizeOptions): boolean;
19
+ private getCenterOrigin;
20
+ private getOppositeOrigin;
21
+ isDragging(): boolean;
22
+ startDragging(id: FeatureId, index: number): void;
23
+ stopDragging(): void;
24
+ private boundingBoxMaps;
25
+ }
@@ -2,6 +2,7 @@ import { TerraDrawMouseEvent, TerraDrawKeyboardEvent, TerraDrawAdapterStyling, H
2
2
  import { BaseModeOptions, CustomStyling, ModeTypes, TerraDrawBaseDrawMode } from "../base.mode";
3
3
  import { BehaviorConfig } from "../base.behavior";
4
4
  import { GeoJSONStoreFeatures } from "../../store/store";
5
+ import { ResizeOptions } from "./behaviors/drag-coordinate-resize.behavior";
5
6
  type TerraDrawSelectModeKeyEvents = {
6
7
  deselect: KeyboardEvent["key"] | null;
7
8
  delete: KeyboardEvent["key"] | null;
@@ -17,6 +18,7 @@ type ModeFlags = {
17
18
  coordinates?: {
18
19
  midpoints?: boolean;
19
20
  draggable?: boolean;
21
+ resizable?: ResizeOptions;
20
22
  deletable?: boolean;
21
23
  };
22
24
  };
@@ -55,10 +57,12 @@ interface TerraDrawSelectModeOptions<T extends CustomStyling> extends BaseModeOp
55
57
  keyEvents?: TerraDrawSelectModeKeyEvents | null;
56
58
  dragEventThrottle?: number;
57
59
  cursors?: Cursors;
60
+ allowManualDeselection?: boolean;
58
61
  }
59
62
  export declare class TerraDrawSelectMode extends TerraDrawBaseDrawMode<SelectionStyling> {
60
63
  type: ModeTypes;
61
64
  mode: string;
65
+ private allowManualDeselection;
62
66
  private dragEventThrottle;
63
67
  private dragEventCount;
64
68
  private selected;
@@ -73,6 +77,7 @@ export declare class TerraDrawSelectMode extends TerraDrawBaseDrawMode<Selection
73
77
  private dragCoordinate;
74
78
  private rotateFeature;
75
79
  private scaleFeature;
80
+ private dragCoordinateResizeFeature;
76
81
  private cursors;
77
82
  constructor(options?: TerraDrawSelectModeOptions<SelectionStyling>);
78
83
  setSelecting(): void;