@mappable-world/mappable-types 1.0.18033998 → 1.0.18043255
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.
|
@@ -5,6 +5,13 @@ import type { BehaviorType, LngLat } from "../../common/types";
|
|
|
5
5
|
import { MMapEntity } from "../MMapEnities";
|
|
6
6
|
import { MMapHotspot } from "../MMapHotspot";
|
|
7
7
|
import type { MMapCamera, MMapLocation } from "../MMap";
|
|
8
|
+
type MapDomEvent = MouseEvent | PointerEvent | TouchEvent;
|
|
9
|
+
type CommonDetails = Pick<MapDomEvent, "type" | "shiftKey" | "altKey" | "metaKey" | "ctrlKey">;
|
|
10
|
+
type PointerEventDetails = Pick<PointerEvent, "pointerId" | "button" | "buttons" | "pointerType"> & CommonDetails;
|
|
11
|
+
type MouseEventDetails = Pick<MouseEvent, "button" | "buttons"> & CommonDetails;
|
|
12
|
+
type TouchEventDetails = CommonDetails & {
|
|
13
|
+
touches: number[];
|
|
14
|
+
};
|
|
8
15
|
export interface DomEvent {
|
|
9
16
|
/** [x, y] */
|
|
10
17
|
readonly screenCoordinates: [
|
|
@@ -12,9 +19,18 @@ export interface DomEvent {
|
|
|
12
19
|
number
|
|
13
20
|
];
|
|
14
21
|
readonly coordinates: LngLat;
|
|
15
|
-
readonly details:
|
|
22
|
+
readonly details: CommonDetails;
|
|
16
23
|
stopPropagation(): void;
|
|
17
24
|
}
|
|
25
|
+
export interface TouchDomEvent extends DomEvent {
|
|
26
|
+
readonly details: TouchEventDetails;
|
|
27
|
+
}
|
|
28
|
+
export interface MouseDomEvent extends DomEvent {
|
|
29
|
+
readonly details: MouseEventDetails;
|
|
30
|
+
}
|
|
31
|
+
export interface PointerDomEvent extends DomEvent {
|
|
32
|
+
readonly details: PointerEventDetails;
|
|
33
|
+
}
|
|
18
34
|
type HandlerEntity<TType extends string, TEntity> = {
|
|
19
35
|
type: TType;
|
|
20
36
|
entity: TEntity;
|
|
@@ -35,6 +51,9 @@ interface MapState {
|
|
|
35
51
|
getLayerState(layerId: string, type: "tile", effectiveMode?: "raster" | "vector"): TileLayerState | undefined;
|
|
36
52
|
}
|
|
37
53
|
export type DomEventHandler = (object: DomEventHandlerObject, event: DomEvent) => void;
|
|
54
|
+
export type TouchDomEventHandler = (object: DomEventHandlerObject, event: TouchDomEvent) => void;
|
|
55
|
+
export type MouseDomEventHandler = (object: DomEventHandlerObject, event: MouseDomEvent) => void;
|
|
56
|
+
export type PointerDomEventHandler = (object: DomEventHandlerObject, event: PointerDomEvent) => void;
|
|
38
57
|
type Location = Required<MMapLocation>;
|
|
39
58
|
interface UpdateObject {
|
|
40
59
|
type: "update";
|
|
@@ -55,28 +74,43 @@ export type IndoorPlansHandler = (object: {
|
|
|
55
74
|
type: IndoorPlanType;
|
|
56
75
|
indoorPlans: readonly IndoorPlan[] | null;
|
|
57
76
|
}) => void;
|
|
58
|
-
export type BehaviorMapEventHandler = (
|
|
77
|
+
export type BehaviorMapEventHandler = (event: {
|
|
59
78
|
type: BehaviorType;
|
|
60
79
|
location: Location;
|
|
61
80
|
camera: MMapCamera;
|
|
62
81
|
}) => void;
|
|
82
|
+
export type BehaviorMapEvent = {
|
|
83
|
+
type: "pinchZoom" | "scrollZoom" | "dblClick" | "magnifier" | "oneFingerZoom" | "mouseRotate" | "mouseTilt" | "pinchRotate" | "panTilt";
|
|
84
|
+
location: Location;
|
|
85
|
+
camera: MMapCamera;
|
|
86
|
+
};
|
|
87
|
+
export type DragMapEvent = {
|
|
88
|
+
type: "drag";
|
|
89
|
+
location: Location;
|
|
90
|
+
camera: MMapCamera;
|
|
91
|
+
preventDefault: () => void;
|
|
92
|
+
points: {
|
|
93
|
+
length: number;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export type BehaviorStartHandler = (event: BehaviorMapEvent | DragMapEvent) => void;
|
|
63
97
|
export type DomEvents = {
|
|
64
|
-
onTouchStart:
|
|
65
|
-
onTouchMove:
|
|
66
|
-
onTouchEnd:
|
|
67
|
-
onTouchCancel:
|
|
68
|
-
onPointerDown:
|
|
69
|
-
onPointerMove:
|
|
70
|
-
onPointerUp:
|
|
71
|
-
onPointerCancel:
|
|
98
|
+
onTouchStart: TouchDomEventHandler;
|
|
99
|
+
onTouchMove: TouchDomEventHandler;
|
|
100
|
+
onTouchEnd: TouchDomEventHandler;
|
|
101
|
+
onTouchCancel: TouchDomEventHandler;
|
|
102
|
+
onPointerDown: PointerDomEventHandler;
|
|
103
|
+
onPointerMove: PointerDomEventHandler;
|
|
104
|
+
onPointerUp: PointerDomEventHandler;
|
|
105
|
+
onPointerCancel: PointerDomEventHandler;
|
|
72
106
|
onFastClick: DomEventHandler;
|
|
73
107
|
onClick: DomEventHandler;
|
|
74
108
|
onDblClick: DomEventHandler;
|
|
75
|
-
onMouseUp:
|
|
76
|
-
onMouseDown:
|
|
77
|
-
onMouseEnter:
|
|
78
|
-
onMouseLeave:
|
|
79
|
-
onMouseMove:
|
|
109
|
+
onMouseUp: MouseDomEventHandler;
|
|
110
|
+
onMouseDown: MouseDomEventHandler;
|
|
111
|
+
onMouseEnter: MouseDomEventHandler;
|
|
112
|
+
onMouseLeave: MouseDomEventHandler;
|
|
113
|
+
onMouseMove: MouseDomEventHandler;
|
|
80
114
|
onContextMenu: DomEventHandler;
|
|
81
115
|
onRightDblClick: DomEventHandler;
|
|
82
116
|
};
|
|
@@ -86,7 +120,7 @@ export type MapEvents = {
|
|
|
86
120
|
onStateChanged: MapEventReadyStateChangeHandler;
|
|
87
121
|
};
|
|
88
122
|
export type BehaviorEvents = {
|
|
89
|
-
onActionStart:
|
|
123
|
+
onActionStart: BehaviorStartHandler;
|
|
90
124
|
onActionEnd: BehaviorMapEventHandler;
|
|
91
125
|
};
|
|
92
126
|
type IndoorPlanType = "indoorPlansChanged";
|
|
@@ -115,12 +149,14 @@ type MMapListenerProps = DomEventsProps | NullablePartial<MapEvents> | NullableP
|
|
|
115
149
|
declare class MMapListener extends MMapEntity<MMapListenerProps> {
|
|
116
150
|
private _domHandlers;
|
|
117
151
|
private _mapHandlers;
|
|
118
|
-
private
|
|
152
|
+
private _actionStartHandler?;
|
|
153
|
+
private _actionEndHandler?;
|
|
119
154
|
private _subscribeDomEvent;
|
|
120
155
|
private _subscribeMapEvent;
|
|
121
156
|
private _subscribeMapIndoorPlansEvent;
|
|
122
157
|
private _subscribeMapStateChanged;
|
|
123
|
-
private
|
|
158
|
+
private _subscribeActionEventStart;
|
|
159
|
+
private _subscribeActionEventEnd;
|
|
124
160
|
private _subscribe;
|
|
125
161
|
private _unsubscribe;
|
|
126
162
|
protected _onAttach(): void;
|