11import { EventData , ImageSource , Style , View } from '@nativescript/core' ;
2- import { DefaultLatLonKeys , GenericMapPos , MapBounds , ScreenBounds , ScreenPos } from '../core' ;
2+ import { ClickType , DefaultLatLonKeys , GenericMapPos , MapBounds , ScreenBounds , ScreenPos } from '../core' ;
33import { Layer } from '../layers' ;
44import { Projection } from '../projections' ;
55import { Layers } from './index.common' ;
@@ -31,27 +31,53 @@ export const MapIdleEvent: string;
3131export const MapMovedEvent : string ;
3232export const MapClickedEvent : string ;
3333
34+ export interface MapInfo { }
35+
36+ export interface MapGestureInfo extends MapInfo {
37+ userAction : boolean ;
38+ }
39+
40+ export interface MapInteractionInfo extends MapGestureInfo {
41+ interaction : {
42+ isAnimationStarted : boolean ;
43+ isPanAction : boolean ;
44+ isRotateAction : boolean ;
45+ isTiltAction : boolean ;
46+ isZoomAction : boolean ;
47+ } ;
48+ }
49+
50+ export interface MapClickInfo < T = DefaultLatLonKeys > extends MapInfo {
51+ android ?: any ;
52+ ios ?: any ;
53+ clickInfo : {
54+ duration : number ;
55+ } ;
56+ clickType : ClickType ;
57+ position : GenericMapPos < T > ;
58+ }
59+
3460export interface MapEventData extends EventData {
35- data : any ;
61+ data ?: MapInfo ;
3662}
3763export interface MapPosEventData < T = DefaultLatLonKeys > extends EventData {
3864 MapPos : GenericMapPos < T > ;
3965}
4066
41- export interface MapClickInfo < T = DefaultLatLonKeys > {
42- clickType : number ,
43- clickInfo :{
44- duration :number
45- } ,
46- position : GenericMapPos < T > ;
67+ export interface MapMovedEventData extends MapEventData {
68+ data : MapGestureInfo ;
4769}
48- export interface MapInteractionInfo {
49- userAction : boolean ;
50- isAnimationStarted : boolean ;
51- isPanAction : boolean ;
52- isRotateAction : boolean ;
53- isTiltAction : boolean ;
54- isZoomAction : boolean ;
70+
71+ export interface MapStableEventData extends MapEventData {
72+ data : MapGestureInfo ;
73+ }
74+
75+ export interface MapInteractionEventData extends MapEventData {
76+ data : MapInteractionInfo ;
77+ }
78+
79+ export interface MapClickedEventData extends MapEventData {
80+ data : MapClickInfo ;
5581}
5682
5783export class MapOptions {
@@ -177,7 +203,7 @@ export class MapOptions {
177203 setLongClickDuration ( param0 : number ) : void ;
178204 getDoubleClickMaxDuration ( ) : number ;
179205 setDoubleClickMaxDuration ( param0 : number ) : void ;
180- setLayersLabelsProcessedInReverseOrder ( enabled : boolean ) : void ;
206+ setLayersLabelsProcessedInReverseOrder ( enabled : boolean ) : void ;
181207 isLayersLabelsProcessedInReverseOrder ( ) : boolean ;
182208}
183209
@@ -192,6 +218,13 @@ interface CartoMapStyle extends Style {
192218}
193219
194220export class CartoMap < T = DefaultLatLonKeys > extends View {
221+ public static mapReadyEvent = 'mapReady' ;
222+ public static mapStableEvent = 'mapStable' ;
223+ public static mapIdleEvent = 'mapIdle' ;
224+ public static mapMovedEvent = 'mapMoved' ;
225+ public static mapInteractionEvent = 'mapInteraction' ;
226+ public static mapClickedEvent = 'mapClicked' ;
227+
195228 public static setRunOnMainThread ( value : boolean ) ;
196229 public projection : Projection ;
197230 focusPos : GenericMapPos < T > ;
@@ -225,4 +258,10 @@ export class CartoMap<T = DefaultLatLonKeys> extends View {
225258 clearPreloadingCaches ( ) ;
226259 cancelAllTasks ( ) ;
227260 captureRendering ( wait ?: boolean ) : Promise < ImageSource > ;
261+
262+ on ( event : 'mapReady' | 'mapIdle' , callback : ( args : EventData ) => void , thisArg ?: any ) : void ;
263+ on ( event : 'mapStable' , callback : ( args : MapStableEventData ) => void , thisArg ?: any ) : void ;
264+ on ( event : 'mapMoved' , callback : ( args : MapMovedEventData ) => void , thisArg ?: any ) : void ;
265+ on ( event : 'mapInteraction' , callback : ( args : MapInteractionEventData ) => void , thisArg ?: any ) : void ;
266+ on ( event : 'mapClicked' , callback : ( args : MapClickedEventData ) => void , thisArg ?: any ) : void ;
228267}
0 commit comments