Track Appearance: adjust track on map when header clicked
This commit is contained in:
parent
df95dbec7f
commit
6883bf722b
2 changed files with 10 additions and 4 deletions
|
@ -409,15 +409,17 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
RotatedTileBox tb = mapActivity.getMapView().getCurrentRotatedTileBox().copy();
|
||||
int tileBoxWidthPx = 0;
|
||||
int tileBoxHeightPx = 0;
|
||||
int marginLeftPx = 0;
|
||||
|
||||
if (!isPortrait()) {
|
||||
tileBoxWidthPx = tb.getPixWidth() - getWidth();
|
||||
marginLeftPx = getWidth();
|
||||
} else {
|
||||
int fHeight = getViewHeight() - y - AndroidUtils.getStatusBarHeight(mapActivity);
|
||||
tileBoxHeightPx = tb.getPixHeight() - fHeight;
|
||||
}
|
||||
if (r.left != 0 && r.right != 0) {
|
||||
mapActivity.getMapView().fitRectToMap(r.left, r.right, r.top, r.bottom, tileBoxWidthPx, tileBoxHeightPx, 0);
|
||||
mapActivity.getMapView().fitRectToMap(r.left, r.right, r.top, r.bottom, tileBoxWidthPx, tileBoxHeightPx, 0, marginLeftPx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -638,8 +638,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
} else if (mapPosition == OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT) {
|
||||
ratiox = 0.7f;
|
||||
} else {
|
||||
boolean isLayoutRtl = AndroidUtils.isLayoutRtl(application);
|
||||
ratiox = mapPositionX == 0 ? 0.5f : (isLayoutRtl ? 0.25f : 0.75f);
|
||||
ratiox = mapPositionX == 0 ? 0.5f : (isLayoutRtl() ? 0.25f : 0.75f);
|
||||
}
|
||||
final int cy = (int) (ratioy * view.getHeight());
|
||||
final int cx = (int) (ratiox * view.getWidth());
|
||||
|
@ -959,7 +958,8 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
if (tileBoxWidthPx > 0) {
|
||||
tbw = (int) (tileBoxWidthPx * border);
|
||||
if (marginLeftPx > 0) {
|
||||
dx = (tb.getPixWidth() - tileBoxWidthPx) / 2 - marginLeftPx;
|
||||
int offset = (tb.getPixWidth() - tileBoxWidthPx) / 2 - marginLeftPx;
|
||||
dx = isLayoutRtl() ? -offset : offset;
|
||||
}
|
||||
} else if (tileBoxHeightPx > 0) {
|
||||
tbh = (int) (tileBoxHeightPx * border);
|
||||
|
@ -1425,4 +1425,8 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
public Context getContext() {
|
||||
return activity;
|
||||
}
|
||||
|
||||
public boolean isLayoutRtl() {
|
||||
return AndroidUtils.isLayoutRtl(application);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue