Skip to content

Commit 177e133

Browse files
committed
fix: Added support for adding event listeners from XML
1 parent edd0c17 commit 177e133

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<projectDescription>
3-
<name>nativescript-carto</name>
3+
<name>ui-carto</name>
44
<comment>Project nativescript-carto created by Buildship.</comment>
55
<projects>
66
</projects>

src/ui-carto/ui/index.common.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ export abstract class Layers<T = any> extends BaseNative<T, {}> {
9595

9696
@CSSType('CartoMap')
9797
export abstract class CartoViewBase extends ContentView {
98+
public static mapReadyEvent = MapReadyEvent;
99+
public static mapStableEvent = MapStableEvent;
100+
public static mapIdleEvent = MapIdleEvent;
101+
public static mapMovedEvent = MapMovedEvent;
102+
public static mapInteractionEvent = MapInteractionEvent;
103+
public static mapClickedEvent = MapClickedEvent;
104+
98105
public mapReady = false;
99106
nativeProjection: any;
100107
@mapProperty({

src/ui-carto/ui/index.d.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ export interface MapPosEventData<T = DefaultLatLonKeys> extends EventData {
3939
}
4040

4141
export interface MapClickInfo<T = DefaultLatLonKeys> {
42-
clickType: number,
43-
clickInfo:{
44-
duration:number
45-
},
42+
clickType: number;
43+
clickInfo: {
44+
duration: number;
45+
};
4646
position: GenericMapPos<T>;
4747
}
4848
export interface MapInteractionInfo {
@@ -177,7 +177,7 @@ export class MapOptions {
177177
setLongClickDuration(param0: number): void;
178178
getDoubleClickMaxDuration(): number;
179179
setDoubleClickMaxDuration(param0: number): void;
180-
setLayersLabelsProcessedInReverseOrder(enabled: boolean): void;
180+
setLayersLabelsProcessedInReverseOrder(enabled: boolean): void;
181181
isLayersLabelsProcessedInReverseOrder(): boolean;
182182
}
183183

@@ -192,6 +192,13 @@ interface CartoMapStyle extends Style {
192192
}
193193

194194
export class CartoMap<T = DefaultLatLonKeys> extends View {
195+
public static mapReadyEvent = 'mapReady';
196+
public static mapStableEvent = 'mapStable';
197+
public static mapIdleEvent = 'mapIdle';
198+
public static mapMovedEvent = 'mapMoved';
199+
public static mapInteractionEvent = 'mapInteraction';
200+
public static mapClickedEvent = 'mapClicked';
201+
195202
public static setRunOnMainThread(value: boolean);
196203
public projection: Projection;
197204
focusPos: GenericMapPos<T>;

src/ui-carto/ui/index.ios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class AKMapEventListenerImpl extends NSObject implements AKMapEventListener {
134134
get clickInfo() {
135135
return {
136136
get duration() {
137-
return (mapClickInfo as any).getClickInfo().getDuration();
137+
return mapClickInfo.getClickInfo().getDuration();
138138
}
139139
};
140140
},

0 commit comments

Comments
 (0)