@@ -131,7 +131,7 @@ function _getLocation(loc: MGLUserLocation) {
131
131
*/
132
132
export class MapboxView extends MapboxViewBase {
133
133
private nativeMapView : MGLMapView = null ;
134
- private delegate : MGLMapViewDelegate = null ;
134
+ private delegate : MGLMapViewDelegateImpl = null ;
135
135
136
136
private settings : any = null ;
137
137
@@ -328,6 +328,11 @@ export class MapboxView extends MapboxViewBase {
328
328
ios : this . nativeMapView ,
329
329
} ) ;
330
330
} ) ;
331
+ // this.delegate.setStyleLoadedCallback((map, style)=>{
332
+ // this.delegate.setStyleLoadedCallback(null);
333
+
334
+ // });
335
+
331
336
332
337
_setMapboxMapOptions ( this . nativeMapView , this . settings ) ;
333
338
_markers = [ ] ;
@@ -734,8 +739,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
734
739
if ( Trace . isEnabled ( ) ) {
735
740
CLog ( CLogTypes . info , 'Mapbox:checkForClickEvent(): got click event with point:' , point ) ;
736
741
}
737
-
738
- this . eventCallbacks [ 'click' ] . forEach ( ( eventListener ) => {
742
+ this . eventCallbacks [ 'click' ] && this . eventCallbacks [ 'click' ] . forEach ( ( eventListener ) => {
739
743
this . queryRenderedFeatures ( { point, layers : [ eventListener . id ] } , nativeMap ) . then ( ( response ) => {
740
744
if ( response . length > 0 ) {
741
745
eventListener . callback ( response ) ;
@@ -2608,7 +2612,7 @@ class MGLMapViewDelegateImpl extends NSObject implements MGLMapViewDelegate {
2608
2612
}
2609
2613
2610
2614
private mapLoadedCallback : ( mapView : MGLMapView ) => void ;
2611
- private styleLoadedCallback : ( mapView : MGLMapView ) => void ;
2615
+ private styleLoadedCallback : ( mapView : MGLMapView , style : MGLStyle ) => void ;
2612
2616
2613
2617
private mapboxApi : any ;
2614
2618
@@ -2683,7 +2687,7 @@ class MGLMapViewDelegateImpl extends NSObject implements MGLMapViewDelegate {
2683
2687
*
2684
2688
* @see Mapbox:setMapStyle()
2685
2689
*/
2686
- setStyleLoadedCallback ( callback ) {
2690
+ setStyleLoadedCallback ( callback : ( mapView : MGLMapView , style : MGLStyle ) => void ) {
2687
2691
this . styleLoadedCallback = callback ;
2688
2692
}
2689
2693
@@ -2719,13 +2723,13 @@ class MGLMapViewDelegateImpl extends NSObject implements MGLMapViewDelegate {
2719
2723
*
2720
2724
* @link https://mapbox.github.io/mapbox-gl-native/macos/0.3.0/Protocols/MGLMapViewDelegate.html#/c:objc(pl)MGLMapViewDelegate(im)mapView:didFinishLoadingStyle:
2721
2725
*/
2722
- mapViewDidFinishLoadingStyle ( mapView : MGLMapView ) : void {
2726
+ mapViewDidFinishLoadingStyle ( mapView : MGLMapView , style : MGLStyle ) : void {
2723
2727
if ( Trace . isEnabled ( ) ) {
2724
2728
CLog ( CLogTypes . info , 'MGLMapViewDelegateImpl:mapViewDidFinishLoadingStyle(): callback called.' ) ;
2725
2729
}
2726
2730
2727
2731
if ( this . styleLoadedCallback !== undefined ) {
2728
- this . styleLoadedCallback ( mapView ) ;
2732
+ this . styleLoadedCallback ( mapView , style ) ;
2729
2733
2730
2734
// to avoid multiple calls. This is only invoked from setMapStyle().
2731
2735
0 commit comments