-1

I have got a strange issue when using the symbol manager. When I allow icons overlapping, the click listener of the symbol manager is triggered multiple times. This doesn't occur when I don't set Allow Icon Overlap to true. But I need to show all of the symbols on the map, and each one must open a dialog on click.

Is it a known issue or am I doing something wrong ?

Thanks for your help !

Sarthak Dhami
  • 330
  • 1
  • 5
  • 14
  • Is the click listener triggered multiple times when you click on a symbol which is overlapping with other symbols, or when you click on a symbol that is nowhere near overlapping with any others? Could you share a minimal reproducible example which demonstrates the issue? – Adriana Babakanian May 27 '20 at 17:30

1 Answers1

1

I too had the same problem. I used the symbolManager.addClickListener within the forloop which triggered the click multiple times.

I resolved it by using the symbolManager.addClickListener inside onMapReady method.

public void onMapReady(@NonNull MapboxMap mapboxMap) {
    map = mapboxMap;
    map.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() {
        @Override
        public void onStyleLoaded(@NonNull Style style) {
            symbolManager = new SymbolManager(mapView, mapboxMap, style);
//          symbolManager.setIconAllowOverlap(true);
            symbolManager.addClickListener(new OnSymbolClickListener() {
                @Override
                public void onAnnotationClick(Symbol symbol) {

                }
            });
        }
    });
}
Danilo Bargen
  • 18,626
  • 15
  • 91
  • 127