#894 - Initial port of iOS method for aligning infowindows over markers

This commit is contained in:
Brad Leege
2015-09-03 13:55:49 -05:00
committed by Justin R. Miller
parent 1644f51873
commit c094ae46ac
2 changed files with 9 additions and 3 deletions

View File

@@ -85,10 +85,12 @@ public class InfoWindow {
MapView.LayoutParams lp = new MapView.LayoutParams(MapView.LayoutParams.WRAP_CONTENT, MapView.LayoutParams.WRAP_CONTENT);
PointF coords = mMapView.toScreenLocation(position);
double y = mMapView.getTopOffsetPixelsForAnnotationSymbol(object.sprite);
// Flip y coordinate as Android view origin is upper left corner
coords.y = mMapView.getHeight() - coords.y;
lp.leftMargin = (int) coords.x;
lp.topMargin = (int) coords.y;
lp.leftMargin = (int) coords.x - 1;
lp.topMargin = (int) coords.y + (int) y;
close(); //if it was already opened
mMapView.addView(mView, lp);

View File

@@ -728,7 +728,11 @@ public class MapView extends FrameLayout implements LocationListener {
return new PointF(point.x * mScreenDensity, point.y * mScreenDensity);
}
//
public double getTopOffsetPixelsForAnnotationSymbol(@NonNull String symbolName) {
return mNativeMapView.getTopOffsetPixelsForAnnotationSymbol(symbolName);
}
//
// Lifecycle events
//