terra-draw 0.0.1-alpha.41 → 0.0.1-alpha.42
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/CHANGELOG.md +2 -0
- package/dist/common.d.ts +2 -0
- package/dist/modes/base.mode.d.ts +5 -2
- package/dist/modes/circle/circle.mode.d.ts +5 -5
- package/dist/modes/freehand/freehand.mode.d.ts +9 -9
- package/dist/modes/greatcircle/great-circle.mode.d.ts +7 -7
- package/dist/modes/linestring/linestring.mode.d.ts +7 -7
- package/dist/modes/point/point.mode.d.ts +5 -5
- package/dist/modes/polygon/polygon.mode.d.ts +9 -9
- package/dist/modes/rectangle/rectangle.mode.d.ts +5 -5
- package/dist/modes/render/render.mode.d.ts +16 -5
- package/dist/modes/select/select.mode.d.ts +19 -19
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -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/guides/GETTING_STARTED.md +40 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/common.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { StoreChangeHandler, GeoJSONStore, GeoJSONStoreFeatures } from "./store/store";
|
|
2
2
|
export type HexColor = `#${string}`;
|
|
3
|
+
export type HexColorStyling = HexColor | ((feature: GeoJSONStoreFeatures) => HexColor);
|
|
4
|
+
export type NumericStyling = number | ((feature: GeoJSONStoreFeatures) => number);
|
|
3
5
|
export interface TerraDrawAdapterStyling {
|
|
4
6
|
pointColor: HexColor;
|
|
5
7
|
pointWidth: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
2
|
-
import { TerraDrawAdapterStyling, TerraDrawKeyboardEvent, TerraDrawModeRegisterConfig, TerraDrawModeState, TerraDrawMouseEvent } from "../common";
|
|
2
|
+
import { HexColor, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, TerraDrawModeRegisterConfig, TerraDrawModeState, TerraDrawMouseEvent } from "../common";
|
|
3
3
|
import { GeoJSONStore, GeoJSONStoreFeatures, StoreChangeHandler } from "../store/store";
|
|
4
|
-
type CustomStyling = Record<string, string | number>;
|
|
4
|
+
type CustomStyling = Record<string, string | number | ((feature: GeoJSONStoreFeatures) => HexColor) | ((feature: GeoJSONStoreFeatures) => number)>;
|
|
5
5
|
export declare enum ModeTypes {
|
|
6
6
|
Drawing = "drawing",
|
|
7
7
|
Select = "select",
|
|
@@ -51,5 +51,8 @@ export declare abstract class TerraDrawBaseDrawMode<T extends CustomStyling> {
|
|
|
51
51
|
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
52
52
|
onDrag(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
53
53
|
onDragEnd(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
54
|
+
protected getHexColorStylingValue(value: HexColor | ((feature: GeoJSONStoreFeatures) => HexColor) | undefined, defaultValue: HexColor, feature: GeoJSONStoreFeatures): HexColor;
|
|
55
|
+
protected getNumericStylingValue(value: number | ((feature: GeoJSONStoreFeatures) => number) | undefined, defaultValue: number, feature: GeoJSONStoreFeatures): number;
|
|
56
|
+
private getStylingValue;
|
|
54
57
|
}
|
|
55
58
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
2
2
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
3
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
4
|
type TerraDrawCircleModeKeyEvents = {
|
|
@@ -6,10 +6,10 @@ type TerraDrawCircleModeKeyEvents = {
|
|
|
6
6
|
finish: KeyboardEvent["key"] | null;
|
|
7
7
|
};
|
|
8
8
|
type FreehandPolygonStyling = {
|
|
9
|
-
fillColor:
|
|
10
|
-
outlineColor:
|
|
11
|
-
outlineWidth:
|
|
12
|
-
fillOpacity:
|
|
9
|
+
fillColor: HexColorStyling;
|
|
10
|
+
outlineColor: HexColorStyling;
|
|
11
|
+
outlineWidth: NumericStyling;
|
|
12
|
+
fillOpacity: NumericStyling;
|
|
13
13
|
};
|
|
14
14
|
export declare class TerraDrawCircleMode extends TerraDrawBaseDrawMode<FreehandPolygonStyling> {
|
|
15
15
|
mode: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
4
4
|
type TerraDrawFreehandModeKeyEvents = {
|
|
@@ -6,14 +6,14 @@ type TerraDrawFreehandModeKeyEvents = {
|
|
|
6
6
|
finish: KeyboardEvent["key"] | null;
|
|
7
7
|
};
|
|
8
8
|
type FreehandPolygonStyling = {
|
|
9
|
-
fillColor:
|
|
10
|
-
outlineColor:
|
|
11
|
-
outlineWidth:
|
|
12
|
-
fillOpacity:
|
|
13
|
-
closingPointColor:
|
|
14
|
-
closingPointWidth:
|
|
15
|
-
closingPointOutlineColor:
|
|
16
|
-
closingPointOutlineWidth:
|
|
9
|
+
fillColor: HexColorStyling;
|
|
10
|
+
outlineColor: HexColorStyling;
|
|
11
|
+
outlineWidth: NumericStyling;
|
|
12
|
+
fillOpacity: NumericStyling;
|
|
13
|
+
closingPointColor: HexColorStyling;
|
|
14
|
+
closingPointWidth: NumericStyling;
|
|
15
|
+
closingPointOutlineColor: HexColorStyling;
|
|
16
|
+
closingPointOutlineWidth: NumericStyling;
|
|
17
17
|
};
|
|
18
18
|
export declare class TerraDrawFreehandMode extends TerraDrawBaseDrawMode<FreehandPolygonStyling> {
|
|
19
19
|
mode: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
@@ -7,12 +7,12 @@ type TerraDrawGreateCircleModeKeyEvents = {
|
|
|
7
7
|
finish: KeyboardEvent["key"] | null;
|
|
8
8
|
};
|
|
9
9
|
type GreateCircleStyling = {
|
|
10
|
-
lineStringWidth:
|
|
11
|
-
lineStringColor:
|
|
12
|
-
closingPointColor:
|
|
13
|
-
closingPointWidth:
|
|
14
|
-
closingPointOutlineColor:
|
|
15
|
-
closingPointOutlineWidth:
|
|
10
|
+
lineStringWidth: NumericStyling;
|
|
11
|
+
lineStringColor: HexColorStyling;
|
|
12
|
+
closingPointColor: HexColorStyling;
|
|
13
|
+
closingPointWidth: NumericStyling;
|
|
14
|
+
closingPointOutlineColor: HexColorStyling;
|
|
15
|
+
closingPointOutlineWidth: NumericStyling;
|
|
16
16
|
};
|
|
17
17
|
export declare class TerraDrawGreatCircleMode extends TerraDrawBaseDrawMode<GreateCircleStyling> {
|
|
18
18
|
mode: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
@@ -7,12 +7,12 @@ type TerraDrawLineStringModeKeyEvents = {
|
|
|
7
7
|
finish: KeyboardEvent["key"] | null;
|
|
8
8
|
};
|
|
9
9
|
type LineStringStyling = {
|
|
10
|
-
lineStringWidth:
|
|
11
|
-
lineStringColor:
|
|
12
|
-
closingPointColor:
|
|
13
|
-
closingPointWidth:
|
|
14
|
-
closingPointOutlineColor:
|
|
15
|
-
closingPointOutlineWidth:
|
|
10
|
+
lineStringWidth: NumericStyling;
|
|
11
|
+
lineStringColor: HexColorStyling;
|
|
12
|
+
closingPointColor: HexColorStyling;
|
|
13
|
+
closingPointWidth: NumericStyling;
|
|
14
|
+
closingPointOutlineColor: HexColorStyling;
|
|
15
|
+
closingPointOutlineWidth: NumericStyling;
|
|
16
16
|
};
|
|
17
17
|
export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineStringStyling> {
|
|
18
18
|
mode: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, NumericStyling, HexColorStyling } from "../../common";
|
|
2
2
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
3
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
4
|
type PointModeStyling = {
|
|
5
|
-
pointWidth:
|
|
6
|
-
pointColor:
|
|
7
|
-
pointOutlineColor:
|
|
8
|
-
pointOutlineWidth:
|
|
5
|
+
pointWidth: NumericStyling;
|
|
6
|
+
pointColor: HexColorStyling;
|
|
7
|
+
pointOutlineColor: HexColorStyling;
|
|
8
|
+
pointOutlineWidth: NumericStyling;
|
|
9
9
|
};
|
|
10
10
|
export declare class TerraDrawPointMode extends TerraDrawBaseDrawMode<PointModeStyling> {
|
|
11
11
|
mode: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
@@ -7,14 +7,14 @@ type TerraDrawPolygonModeKeyEvents = {
|
|
|
7
7
|
finish?: KeyboardEvent["key"] | null;
|
|
8
8
|
};
|
|
9
9
|
type PolygonStyling = {
|
|
10
|
-
fillColor:
|
|
11
|
-
outlineColor:
|
|
12
|
-
outlineWidth:
|
|
13
|
-
fillOpacity:
|
|
14
|
-
closingPointWidth:
|
|
15
|
-
closingPointColor:
|
|
16
|
-
closingPointOutlineWidth:
|
|
17
|
-
closingPointOutlineColor:
|
|
10
|
+
fillColor: HexColorStyling;
|
|
11
|
+
outlineColor: HexColorStyling;
|
|
12
|
+
outlineWidth: NumericStyling;
|
|
13
|
+
fillOpacity: NumericStyling;
|
|
14
|
+
closingPointWidth: NumericStyling;
|
|
15
|
+
closingPointColor: HexColorStyling;
|
|
16
|
+
closingPointOutlineWidth: NumericStyling;
|
|
17
|
+
closingPointOutlineColor: HexColorStyling;
|
|
18
18
|
};
|
|
19
19
|
export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonStyling> {
|
|
20
20
|
mode: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
2
2
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
3
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
4
|
type TerraDrawRectangleModeKeyEvents = {
|
|
@@ -6,10 +6,10 @@ type TerraDrawRectangleModeKeyEvents = {
|
|
|
6
6
|
finish: KeyboardEvent["key"] | null;
|
|
7
7
|
};
|
|
8
8
|
type RectanglePolygonStyling = {
|
|
9
|
-
fillColor:
|
|
10
|
-
outlineColor:
|
|
11
|
-
outlineWidth:
|
|
12
|
-
fillOpacity:
|
|
9
|
+
fillColor: HexColorStyling;
|
|
10
|
+
outlineColor: HexColorStyling;
|
|
11
|
+
outlineWidth: NumericStyling;
|
|
12
|
+
fillOpacity: NumericStyling;
|
|
13
13
|
};
|
|
14
14
|
export declare class TerraDrawRectangleMode extends TerraDrawBaseDrawMode<RectanglePolygonStyling> {
|
|
15
15
|
mode: string;
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import { TerraDrawAdapterStyling } from "../../common";
|
|
1
|
+
import { HexColorStyling, NumericStyling, TerraDrawAdapterStyling } from "../../common";
|
|
2
2
|
import { ModeTypes, TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../terra-draw";
|
|
5
|
-
type
|
|
6
|
-
|
|
5
|
+
type RenderModeStyling = {
|
|
6
|
+
pointColor: HexColorStyling;
|
|
7
|
+
pointWidth: NumericStyling;
|
|
8
|
+
pointOutlineColor: HexColorStyling;
|
|
9
|
+
pointOutlineWidth: NumericStyling;
|
|
10
|
+
polygonFillColor: HexColorStyling;
|
|
11
|
+
polygonFillOpacity: NumericStyling;
|
|
12
|
+
polygonOutlineColor: HexColorStyling;
|
|
13
|
+
polygonOutlineWidth: NumericStyling;
|
|
14
|
+
lineStringWidth: NumericStyling;
|
|
15
|
+
lineStringColor: HexColorStyling;
|
|
16
|
+
zIndex: NumericStyling;
|
|
17
|
+
};
|
|
7
18
|
export declare class TerraDrawRenderMode extends TerraDrawBaseDrawMode<RenderModeStyling> {
|
|
8
19
|
type: ModeTypes;
|
|
9
20
|
mode: string;
|
|
10
21
|
constructor(options: {
|
|
11
|
-
styles: Partial<
|
|
22
|
+
styles: Partial<RenderModeStyling>;
|
|
12
23
|
});
|
|
13
24
|
/** @internal */
|
|
14
25
|
registerBehaviors(behaviorConfig: BehaviorConfig): void;
|
|
@@ -33,7 +44,7 @@ export declare class TerraDrawRenderMode extends TerraDrawBaseDrawMode<RenderMod
|
|
|
33
44
|
/** @internal */
|
|
34
45
|
cleanUp(): void;
|
|
35
46
|
/** @internal */
|
|
36
|
-
styleFeature(): TerraDrawAdapterStyling;
|
|
47
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
37
48
|
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
38
49
|
}
|
|
39
50
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawKeyboardEvent,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawKeyboardEvent, TerraDrawAdapterStyling, HexColorStyling, NumericStyling } from "../../common";
|
|
2
2
|
import { ModeTypes, TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
@@ -21,24 +21,24 @@ type ModeFlags = {
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
type SelectionStyling = {
|
|
24
|
-
selectedPointColor:
|
|
25
|
-
selectedPointWidth:
|
|
26
|
-
selectedPointOutlineColor:
|
|
27
|
-
selectedPointOutlineWidth:
|
|
28
|
-
selectedLineStringColor:
|
|
29
|
-
selectedLineStringWidth:
|
|
30
|
-
selectedPolygonColor:
|
|
31
|
-
selectedPolygonFillOpacity:
|
|
32
|
-
selectedPolygonOutlineColor:
|
|
33
|
-
selectedPolygonOutlineWidth:
|
|
34
|
-
selectionPointWidth:
|
|
35
|
-
selectionPointColor:
|
|
36
|
-
selectionPointOutlineColor:
|
|
37
|
-
selectionPointOutlineWidth:
|
|
38
|
-
midPointColor:
|
|
39
|
-
midPointOutlineColor:
|
|
40
|
-
midPointWidth:
|
|
41
|
-
midPointOutlineWidth:
|
|
24
|
+
selectedPointColor: HexColorStyling;
|
|
25
|
+
selectedPointWidth: NumericStyling;
|
|
26
|
+
selectedPointOutlineColor: HexColorStyling;
|
|
27
|
+
selectedPointOutlineWidth: NumericStyling;
|
|
28
|
+
selectedLineStringColor: HexColorStyling;
|
|
29
|
+
selectedLineStringWidth: NumericStyling;
|
|
30
|
+
selectedPolygonColor: HexColorStyling;
|
|
31
|
+
selectedPolygonFillOpacity: NumericStyling;
|
|
32
|
+
selectedPolygonOutlineColor: HexColorStyling;
|
|
33
|
+
selectedPolygonOutlineWidth: NumericStyling;
|
|
34
|
+
selectionPointWidth: NumericStyling;
|
|
35
|
+
selectionPointColor: HexColorStyling;
|
|
36
|
+
selectionPointOutlineColor: HexColorStyling;
|
|
37
|
+
selectionPointOutlineWidth: NumericStyling;
|
|
38
|
+
midPointColor: HexColorStyling;
|
|
39
|
+
midPointOutlineColor: HexColorStyling;
|
|
40
|
+
midPointWidth: NumericStyling;
|
|
41
|
+
midPointOutlineWidth: NumericStyling;
|
|
42
42
|
};
|
|
43
43
|
export declare class TerraDrawSelectMode extends TerraDrawBaseDrawMode<SelectionStyling> {
|
|
44
44
|
type: ModeTypes;
|