File tree Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -707,7 +707,9 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
707707 if ( this . selectedMarker && ! this . isMarkerSelected ( marker ) ) {
708708 this . deselectMarker ( this . selectedMarker ) ;
709709 }
710- await this . showCalloutForMarkerById ( marker . id + '' ) ;
710+ if ( marker . title || marker . subtitle ) {
711+ await this . showCalloutForMarkerById ( marker . id + '' ) ;
712+ }
711713 resolve ( ) ;
712714 } catch ( ex ) {
713715 if ( Trace . isEnabled ( ) ) {
@@ -1435,7 +1437,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
14351437
14361438 toggleCalloutForMarkerById ( markerId : string ) : void {
14371439 const m = this . _markers . find ( ( x ) => `${ x . id } ` === markerId ) ;
1438- if ( ! m || ! m . id ) return ;
1440+ if ( ! m || ! m . id || ( ! m . title && ! m . subtitle ) ) return ;
14391441 const exists = this . bridgeInstance . hasViewAnnotationForMarker ( markerId ) ;
14401442 if ( exists ) this . hideCalloutForMarkerById ( markerId ) ;
14411443 else this . showCalloutForMarkerById ( markerId ) ;
Original file line number Diff line number Diff line change @@ -18,9 +18,6 @@ export class AndroidMarker {
1818 layerId : string ;
1919
2020 constructor ( opts : { id : string | number ; position : com . mapbox . geojson . Point ; icon : android . graphics . Bitmap ; title ?: string ; snippet ?: string } ) {
21- if ( ! opts . title && ! opts . snippet ) {
22- throw new Error ( 'Marker should have either title or snippet!' ) ;
23- }
2421
2522 this . position = opts . position ;
2623 this . id = opts . id ;
Original file line number Diff line number Diff line change @@ -228,13 +228,14 @@ export class MarkerManager {
228228 this . deselectMarker ( this . selectedMarker ) ;
229229 }
230230 this . selectedMarker = marker ;
231-
232- this . prepareViewAnnotation ( marker , ( e ) => {
233- // info Window tapped.
234- if ( ! this . onInfoWindowTapped ( marker ) ) {
235- this . deselectMarker ( marker ) ;
236- }
237- } ) ;
231+ if ( marker . title || marker . snippet ) {
232+ this . prepareViewAnnotation ( marker , ( e ) => {
233+ // info Window tapped.
234+ if ( ! this . onInfoWindowTapped ( marker ) ) {
235+ this . deselectMarker ( marker ) ;
236+ }
237+ } ) ;
238+ }
238239 }
239240
240241 deselectMarker ( marker : AndroidMarker ) {
You can’t perform that action at this time.
0 commit comments