cordova-plugin-googlemaps icon indicating copy to clipboard operation
cordova-plugin-googlemaps copied to clipboard

Set Marker on Top

Open vscholz opened this issue 12 years ago • 1 comments

I know that Google Maps officially does not support Z-Index, but I've found a workaround to achieve the same result. You might want to consider this.

Whilst not the perfect solution! I have figured out how to show a selected (tapped) marker over all other markers by consuming the onMarkerClick event. Returning TRUE will consume this event, so we have to do the showInfoWindow and zoom to center

  @Override
       public boolean onMarkerClick(Marker marker) {
       //Manually open the window
       marker.showInfoWindow();

       //Animate to center

       sMapFrag_v2.getMap().animateCamera(CameraUpdateFactory.newLatLng(marker.getPosition());

       //Consume the method
       return true;
  }

Answer from: http://stackoverflow.com/questions/14771569/google-maps-v2-marker-zordering-set-to-top/14771740#answer-14773367

In Reference: https://github.com/wf9a5m75/phonegap-googlemaps-plugin/issues/172

vscholz avatar Nov 11 '14 16:11 vscholz

Plugin runs the same code when you set disableAutoPan = true for the marker (However it shows the infoWindow also). https://github.com/wf9a5m75/phonegap-googlemaps-plugin/wiki/Marker#disable-auto-pan

https://github.com/wf9a5m75/phonegap-googlemaps-plugin/blob/master/src/android/plugin/google/maps/GoogleMaps.java#L1090

wf9a5m75 avatar Nov 11 '14 17:11 wf9a5m75