terra-draw 1.16.0 → 1.18.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.
- package/dist/common/base.adapter.d.ts +3 -0
- package/dist/common.d.ts +4 -0
- package/dist/modes/base.mode.d.ts +3 -2
- package/dist/modes/marker/marker.mode.d.ts +59 -0
- package/dist/modes/marker/marker.mode.spec.d.ts +1 -0
- package/dist/modes/static/static.mode.d.ts +3 -0
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- package/dist/terra-draw.d.ts +2 -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/package.json +1 -1
|
@@ -4,6 +4,7 @@ type BasePointerListener = (event: PointerEvent) => void;
|
|
|
4
4
|
type BaseKeyboardListener = (event: KeyboardEvent) => void;
|
|
5
5
|
type BaseMouseListener = (event: MouseEvent) => void;
|
|
6
6
|
export type BaseAdapterConfig = {
|
|
7
|
+
ignoreMismatchedPointerEvents?: boolean;
|
|
7
8
|
coordinatePrecision?: number;
|
|
8
9
|
minPixelDragDistanceDrawing?: number;
|
|
9
10
|
minPixelDragDistance?: number;
|
|
@@ -12,6 +13,8 @@ export type BaseAdapterConfig = {
|
|
|
12
13
|
export declare abstract class TerraDrawBaseAdapter implements TerraDrawAdapter {
|
|
13
14
|
constructor(config: BaseAdapterConfig);
|
|
14
15
|
private _nextKeyUpIsContextMenu;
|
|
16
|
+
private _lastPointerDownEventTarget;
|
|
17
|
+
protected _ignoreMismatchedPointerEvents: boolean;
|
|
15
18
|
protected _minPixelDragDistance: number;
|
|
16
19
|
protected _minPixelDragDistanceDrawing: number;
|
|
17
20
|
protected _minPixelDragDistanceSelecting: number;
|
package/dist/common.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { StoreChangeHandler, GeoJSONStore, GeoJSONStoreFeatures, FeatureId } fro
|
|
|
3
3
|
export type HexColor = `#${string}`;
|
|
4
4
|
export type HexColorStyling = HexColor | ((feature: GeoJSONStoreFeatures) => HexColor);
|
|
5
5
|
export type NumericStyling = number | ((feature: GeoJSONStoreFeatures) => number);
|
|
6
|
+
export type UrlStyling = string | ((feature: GeoJSONStoreFeatures) => string);
|
|
6
7
|
export interface TerraDrawAdapterStyling {
|
|
7
8
|
pointColor: HexColor;
|
|
8
9
|
pointWidth: number;
|
|
@@ -15,6 +16,9 @@ export interface TerraDrawAdapterStyling {
|
|
|
15
16
|
lineStringWidth: number;
|
|
16
17
|
lineStringColor: HexColor;
|
|
17
18
|
zIndex: number;
|
|
19
|
+
markerUrl?: string;
|
|
20
|
+
markerHeight?: number;
|
|
21
|
+
markerWidth?: number;
|
|
18
22
|
}
|
|
19
23
|
export type CartesianPoint = {
|
|
20
24
|
x: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
2
|
-
import { OnChangeContext, HexColor, OnFinishContext, Projection, TerraDrawAdapterStyling, TerraDrawGeoJSONStore, TerraDrawKeyboardEvent, TerraDrawModeRegisterConfig, TerraDrawModeState, TerraDrawMouseEvent, Validation } from "../common";
|
|
2
|
+
import { OnChangeContext, HexColor, OnFinishContext, Projection, TerraDrawAdapterStyling, TerraDrawGeoJSONStore, TerraDrawKeyboardEvent, TerraDrawModeRegisterConfig, TerraDrawModeState, TerraDrawMouseEvent, Validation, HexColorStyling, NumericStyling, UrlStyling } from "../common";
|
|
3
3
|
import { FeatureId, GeoJSONStoreFeatures, StoreChangeHandler } from "../store/store";
|
|
4
|
-
export type CustomStyling = Record<string, string | number |
|
|
4
|
+
export type CustomStyling = Record<string, string | number | HexColorStyling | NumericStyling | UrlStyling>;
|
|
5
5
|
export declare enum ModeTypes {
|
|
6
6
|
Drawing = "drawing",
|
|
7
7
|
Select = "select",
|
|
@@ -82,6 +82,7 @@ export declare abstract class TerraDrawBaseDrawMode<Styling extends CustomStylin
|
|
|
82
82
|
onDragEnd(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
83
83
|
protected getHexColorStylingValue(value: HexColor | ((feature: GeoJSONStoreFeatures) => HexColor) | undefined, defaultValue: HexColor, feature: GeoJSONStoreFeatures): HexColor;
|
|
84
84
|
protected getNumericStylingValue(value: number | ((feature: GeoJSONStoreFeatures) => number) | undefined, defaultValue: number, feature: GeoJSONStoreFeatures): number;
|
|
85
|
+
protected getUrlStylingValue(value: UrlStyling | undefined, defaultValue: string, feature: GeoJSONStoreFeatures): string;
|
|
85
86
|
private getStylingValue;
|
|
86
87
|
}
|
|
87
88
|
export declare abstract class TerraDrawBaseSelectMode<Styling extends CustomStyling> extends TerraDrawBaseDrawMode<Styling> {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, NumericStyling, Cursor, UrlStyling } from "../../common";
|
|
2
|
+
import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
|
|
3
|
+
import { BaseModeOptions, CustomStyling, TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
|
+
import { BehaviorConfig } from "../base.behavior";
|
|
5
|
+
type MarkerModeStyling = {
|
|
6
|
+
markerUrl: UrlStyling;
|
|
7
|
+
markerHeight: NumericStyling;
|
|
8
|
+
markerWidth: NumericStyling;
|
|
9
|
+
};
|
|
10
|
+
interface Cursors {
|
|
11
|
+
create?: Cursor;
|
|
12
|
+
dragStart?: Cursor;
|
|
13
|
+
dragEnd?: Cursor;
|
|
14
|
+
}
|
|
15
|
+
interface TerraDrawMarkerModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
|
16
|
+
cursors?: Cursors;
|
|
17
|
+
editable?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare class TerraDrawMarkerMode extends TerraDrawBaseDrawMode<MarkerModeStyling> {
|
|
20
|
+
mode: "marker";
|
|
21
|
+
private cursors;
|
|
22
|
+
private editable;
|
|
23
|
+
private editedFeatureId;
|
|
24
|
+
private markerUrl;
|
|
25
|
+
private markerHeight;
|
|
26
|
+
private markerWidth;
|
|
27
|
+
private pixelDistance;
|
|
28
|
+
private clickBoundingBox;
|
|
29
|
+
constructor(options?: TerraDrawMarkerModeOptions<MarkerModeStyling>);
|
|
30
|
+
updateOptions(options?: TerraDrawMarkerModeOptions<MarkerModeStyling> | undefined): void;
|
|
31
|
+
/** @internal */
|
|
32
|
+
start(): void;
|
|
33
|
+
/** @internal */
|
|
34
|
+
stop(): void;
|
|
35
|
+
/** @internal */
|
|
36
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
37
|
+
/** @internal */
|
|
38
|
+
onMouseMove(): void;
|
|
39
|
+
/** @internal */
|
|
40
|
+
onKeyDown(): void;
|
|
41
|
+
/** @internal */
|
|
42
|
+
onKeyUp(): void;
|
|
43
|
+
/** @internal */
|
|
44
|
+
cleanUp(): void;
|
|
45
|
+
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
46
|
+
/** @internal */
|
|
47
|
+
onDrag(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
48
|
+
/** @internal */
|
|
49
|
+
onDragEnd(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
50
|
+
registerBehaviors(config: BehaviorConfig): void;
|
|
51
|
+
/** @internal */
|
|
52
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
53
|
+
validateFeature(feature: unknown): StoreValidation;
|
|
54
|
+
private onLeftClick;
|
|
55
|
+
private onRightClick;
|
|
56
|
+
private getNearestPointFeature;
|
|
57
|
+
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -27,6 +27,9 @@ export declare class TerraDrawStaticMode extends TerraDrawBaseDrawMode<StaticMod
|
|
|
27
27
|
lineStringWidth: number;
|
|
28
28
|
lineStringColor: import("../../common").HexColor;
|
|
29
29
|
zIndex: number;
|
|
30
|
+
markerUrl?: string;
|
|
31
|
+
markerHeight?: number;
|
|
32
|
+
markerWidth?: number;
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
35
|
export {};
|