@@ -259,7 +259,7 @@ export class MapboxView extends MapboxViewBase {
259259 }
260260
261261 if ( ! this . nativeMapView && ( ( this . config && this . config . accessToken ) || ( this . settings && this . settings . accessToken ) ) ) {
262- this . mapbox = new Mapbox ( ) ;
262+ this . mapbox = new Mapbox ( this ) ;
263263 // the NativeScript contentview class extends from Observable to provide the notify method
264264 // which is the glue that joins this code with whatever callbacks are set in the Mapbox XML
265265 // tag describing the map.
@@ -429,8 +429,8 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
429429
430430 _markerIconDownloadCache = [ ] ;
431431
432- constructor ( ) {
433- super ( ) ;
432+ constructor ( view ) {
433+ super ( view ) ;
434434
435435 if ( Trace . isEnabled ( ) ) {
436436 CLog ( CLogTypes . info , 'constructor(): building new Mapbox object.' ) ;
@@ -448,11 +448,6 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
448448 */
449449 setMapboxViewInstance ( mapboxViewInstance : any ) : void { }
450450
451- /**
452- * not used
453- */
454- setMapboxMapInstance ( mapboxMapInstance : any ) : void { }
455-
456451 /**
457452 * show the map programmatically.
458453 *
@@ -981,13 +976,15 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
981976 CLog ( CLogTypes . info , 'Mapbox:checkForClickEvent(): got click event with point:' , JSON . stringify ( point ) ) ;
982977 }
983978
984- this . eventCallbacks [ 'click' ] . forEach ( ( eventListener ) => {
985- this . queryRenderedFeatures ( { point, layers : [ eventListener . id ] } ) . then ( ( response ) => {
986- if ( response . length > 0 ) {
987- eventListener . callback ( response ) ;
988- }
979+ this . eventCallbacks [ 'click' ] &&
980+ this . eventCallbacks [ 'click' ] . forEach ( ( eventListener ) => {
981+ this . queryRenderedFeatures ( { point, layers : [ eventListener . id ] } ) . then ( ( response ) => {
982+ if ( response . length > 0 ) {
983+ eventListener . callback ( response ) ;
984+ }
985+ } ) ;
989986 } ) ;
990- } ) ;
987+ this . view && this . view . notify ( { eventName : 'mapClick' , object : this . view , point } ) ;
991988
992989 return false ;
993990 }
0 commit comments