From d7384081572666a8449d97bb033dec8fffda27bd Mon Sep 17 00:00:00 2001 From: crimean Date: Wed, 6 Feb 2019 14:51:21 +0300 Subject: [PATCH] Fix #6411 --- .../plus/mapcontextmenu/MapContextMenuFragment.java | 9 +++------ OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index a20212971f..9b1ae5e72f 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -918,17 +918,13 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo if (map.isZooming() && map.hasCustomMapRatio()) { getMapActivity().changeZoom(2, System.currentTimeMillis()); } else { - if (!map.hasCustomMapRatio()) { - //setCustomMapRatio(); - } + setCustomMapRatio(); getMapActivity().changeZoom(1, System.currentTimeMillis()); } } public void doZoomOut() { - if (!map.hasCustomMapRatio()) { - //setCustomMapRatio(); - } + setCustomMapRatio(); getMapActivity().changeZoom(-1, System.currentTimeMillis()); } @@ -1250,6 +1246,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo public void onPause() { if (view != null) { + restoreCustomMapRatio(); ViewParent parent = view.getParent(); if (parent != null && containerLayoutListener != null) { ((View) parent).removeOnLayoutChangeListener(containerLayoutListener); diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java index d28ea4f55b..8dda1d73b3 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java @@ -511,7 +511,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback { ry -= 0.35; } box.setCenterLocation(rx, ry); - LatLon screenCenter = box.getLatLonFromPixel(box.getPixWidth() / 2, box.getPixHeight() / 2); + LatLon screenCenter = box.getLatLonFromPixel(box.getPixWidth() / 2f, box.getPixHeight() / 2f); mapRatioX = 0; mapRatioY = 0; setLatLon(screenCenter.getLatitude(), screenCenter.getLongitude());