terra-draw 0.0.1-alpha.57 → 0.0.1-alpha.59
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/README.md +7 -5
- package/dist/adapters/leaflet.adapter.d.ts +2 -1
- package/dist/adapters/mapbox-gl.adapter.d.ts +2 -1
- package/dist/adapters/openlayers.adapter.d.ts +2 -1
- package/dist/common.d.ts +1 -0
- package/dist/modes/base.mode.d.ts +5 -0
- package/dist/modes/select/behaviors/drag-coordinate-resize.behavior.d.ts +8 -2
- package/dist/modes/select/select.mode.d.ts +6 -4
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- package/dist/terra-draw.d.ts +18 -0
- 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 +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,18 +24,20 @@ Terra Draw uses the concept of 'adapters' to allow it to work with a host of dif
|
|
|
24
24
|
|
|
25
25
|
Please see the [the getting started guide](./guides/1.GETTING_STARTED.md) - this provides a host of information on how to get up and running with Terra Draw.
|
|
26
26
|
|
|
27
|
-
### Development
|
|
27
|
+
### Development & Contributing
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
* For development, please see the [the development documentation](./guides/6.DEVELOPMENT.md)
|
|
30
|
+
* For guidance on contributing, please see the [the contributing documentation](./guides/CONTRIBUTING.md)
|
|
30
31
|
|
|
31
|
-
### Contributing
|
|
32
|
-
|
|
33
|
-
Please see the [the contributing documentation](./guides/CONTRIBUTING.md)
|
|
34
32
|
|
|
35
33
|
### Project Website
|
|
36
34
|
|
|
37
35
|
You can check out the official Terra Draw website at [terradraw.io](https://www.terradraw.io). If you are interested in contributing to the website please see [this repository](https://www.github.com/JamesLMilner/terra-draw-website).
|
|
38
36
|
|
|
37
|
+
### Contact
|
|
38
|
+
|
|
39
|
+
Email: [contact@terradraw.io](mailto:contact@terradraw.io)
|
|
40
|
+
|
|
39
41
|
### License
|
|
40
42
|
|
|
41
43
|
MIT
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawChanges, SetCursor, TerraDrawStylingFunction } from "../common";
|
|
1
|
+
import { TerraDrawChanges, SetCursor, TerraDrawStylingFunction, TerraDrawCallbacks } from "../common";
|
|
2
2
|
import L from "leaflet";
|
|
3
3
|
import { BaseAdapterConfig, TerraDrawBaseAdapter } from "./common/base.adapter";
|
|
4
4
|
export declare class TerraDrawLeafletAdapter extends TerraDrawBaseAdapter {
|
|
@@ -93,4 +93,5 @@ export declare class TerraDrawLeafletAdapter extends TerraDrawBaseAdapter {
|
|
|
93
93
|
* @returns void
|
|
94
94
|
* */
|
|
95
95
|
clear(): void;
|
|
96
|
+
register(callbacks: TerraDrawCallbacks): void;
|
|
96
97
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawChanges, SetCursor, TerraDrawStylingFunction } from "../common";
|
|
1
|
+
import { TerraDrawChanges, SetCursor, TerraDrawStylingFunction, TerraDrawCallbacks } from "../common";
|
|
2
2
|
import mapboxgl from "mapbox-gl";
|
|
3
3
|
import { BaseAdapterConfig, TerraDrawBaseAdapter } from "./common/base.adapter";
|
|
4
4
|
export declare class TerraDrawMapboxGLAdapter extends TerraDrawBaseAdapter {
|
|
@@ -85,4 +85,5 @@ export declare class TerraDrawMapboxGLAdapter extends TerraDrawBaseAdapter {
|
|
|
85
85
|
* @returns void
|
|
86
86
|
* */
|
|
87
87
|
clear(): void;
|
|
88
|
+
register(callbacks: TerraDrawCallbacks): void;
|
|
88
89
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawChanges, SetCursor, TerraDrawStylingFunction } from "../common";
|
|
1
|
+
import { TerraDrawChanges, SetCursor, TerraDrawStylingFunction, TerraDrawCallbacks } from "../common";
|
|
2
2
|
import CircleGeom from "ol/geom/Circle";
|
|
3
3
|
import Feature from "ol/Feature";
|
|
4
4
|
import GeoJSON from "ol/format/GeoJSON";
|
|
@@ -113,5 +113,6 @@ export declare class TerraDrawOpenLayersAdapter extends TerraDrawBaseAdapter {
|
|
|
113
113
|
* @returns void
|
|
114
114
|
* */
|
|
115
115
|
clear(): void;
|
|
116
|
+
register(callbacks: TerraDrawCallbacks): void;
|
|
116
117
|
}
|
|
117
118
|
export {};
|
package/dist/common.d.ts
CHANGED
|
@@ -69,6 +69,7 @@ export interface TerraDrawCallbacks {
|
|
|
69
69
|
onDrag: (event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void) => void;
|
|
70
70
|
onDragEnd: (event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void) => void;
|
|
71
71
|
onClear: () => void;
|
|
72
|
+
onReady?(): void;
|
|
72
73
|
}
|
|
73
74
|
export interface TerraDrawChanges {
|
|
74
75
|
created: GeoJSONStoreFeatures[];
|
|
@@ -55,3 +55,8 @@ export declare abstract class TerraDrawBaseDrawMode<T extends CustomStyling> {
|
|
|
55
55
|
protected getNumericStylingValue(value: number | ((feature: GeoJSONStoreFeatures) => number) | undefined, defaultValue: number, feature: GeoJSONStoreFeatures): number;
|
|
56
56
|
private getStylingValue;
|
|
57
57
|
}
|
|
58
|
+
export declare abstract class TerraDrawBaseSelectMode<T extends CustomStyling> extends TerraDrawBaseDrawMode<T> {
|
|
59
|
+
type: ModeTypes;
|
|
60
|
+
abstract selectFeature(featureId: FeatureId): void;
|
|
61
|
+
abstract deselectFeature(featureId: FeatureId): void;
|
|
62
|
+
}
|
|
@@ -4,19 +4,25 @@ 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-fixed" | "opposite-
|
|
7
|
+
export type ResizeOptions = "center-fixed" | "opposite-fixed" | "opposite" | "center" | "center-planar" | "opposite-planar";
|
|
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
|
-
|
|
13
|
+
private readonly minDistanceFromSelectionPoint;
|
|
14
|
+
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior, minDistanceFromSelectionPoint: number);
|
|
14
15
|
private draggedCoordinate;
|
|
15
16
|
private getClosestCoordinate;
|
|
16
17
|
getDraggableIndex(event: TerraDrawMouseEvent, selectedId: FeatureId): number;
|
|
17
18
|
private lastDistance;
|
|
19
|
+
private lastDistanceX;
|
|
20
|
+
private lastDistanceY;
|
|
18
21
|
drag(event: TerraDrawMouseEvent, resizeOption: ResizeOptions): boolean;
|
|
22
|
+
private validateScale;
|
|
23
|
+
private scalePlanar;
|
|
19
24
|
private getCenterOrigin;
|
|
25
|
+
private getBBox;
|
|
20
26
|
private getOppositeOrigin;
|
|
21
27
|
isDragging(): boolean;
|
|
22
28
|
startDragging(id: FeatureId, index: number): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TerraDrawMouseEvent, TerraDrawKeyboardEvent, TerraDrawAdapterStyling, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
|
2
|
-
import { BaseModeOptions, CustomStyling,
|
|
2
|
+
import { BaseModeOptions, CustomStyling, TerraDrawBaseSelectMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
|
-
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
4
|
+
import { FeatureId, GeoJSONStoreFeatures } from "../../store/store";
|
|
5
5
|
import { ResizeOptions } from "./behaviors/drag-coordinate-resize.behavior";
|
|
6
6
|
type TerraDrawSelectModeKeyEvents = {
|
|
7
7
|
deselect: KeyboardEvent["key"] | null;
|
|
@@ -59,8 +59,7 @@ interface TerraDrawSelectModeOptions<T extends CustomStyling> extends BaseModeOp
|
|
|
59
59
|
cursors?: Cursors;
|
|
60
60
|
allowManualDeselection?: boolean;
|
|
61
61
|
}
|
|
62
|
-
export declare class TerraDrawSelectMode extends
|
|
63
|
-
type: ModeTypes;
|
|
62
|
+
export declare class TerraDrawSelectMode extends TerraDrawBaseSelectMode<SelectionStyling> {
|
|
64
63
|
mode: string;
|
|
65
64
|
private allowManualDeselection;
|
|
66
65
|
private dragEventThrottle;
|
|
@@ -80,11 +79,14 @@ export declare class TerraDrawSelectMode extends TerraDrawBaseDrawMode<Selection
|
|
|
80
79
|
private dragCoordinateResizeFeature;
|
|
81
80
|
private cursors;
|
|
82
81
|
constructor(options?: TerraDrawSelectModeOptions<SelectionStyling>);
|
|
82
|
+
selectFeature(featureId: FeatureId): void;
|
|
83
83
|
setSelecting(): void;
|
|
84
84
|
registerBehaviors(config: BehaviorConfig): void;
|
|
85
|
+
deselectFeature(): void;
|
|
85
86
|
private deselect;
|
|
86
87
|
private deleteSelected;
|
|
87
88
|
private onRightClick;
|
|
89
|
+
private select;
|
|
88
90
|
private onLeftClick;
|
|
89
91
|
/** @internal */
|
|
90
92
|
start(): void;
|