#894 - Initial port of iOS method for aligning infowindows over markers
This commit is contained in:
committed by
Justin R. Miller
parent
1644f51873
commit
c094ae46ac
@@ -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);
|
||||
|
||||
@@ -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
|
||||
//
|
||||
|
||||
|
||||
Reference in New Issue
Block a user