Not changing markers position anymore.
This commit is contained in:
parent
501ec5c341
commit
a31c40e349
1 changed files with 9 additions and 4 deletions
|
@ -60,6 +60,9 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
private final MoveMarkerBottomSheetHelper mMoveMarkerBottomSheetHelper;
|
private final MoveMarkerBottomSheetHelper mMoveMarkerBottomSheetHelper;
|
||||||
private boolean mInChangeMarkerPositionMode;
|
private boolean mInChangeMarkerPositionMode;
|
||||||
|
|
||||||
|
private int previousMarkerX;
|
||||||
|
private int previousMarkerY;
|
||||||
|
|
||||||
public ContextMenuLayer(MapActivity activity) {
|
public ContextMenuLayer(MapActivity activity) {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
menu = activity.getContextMenu();
|
menu = activity.getContextMenu();
|
||||||
|
@ -108,14 +111,16 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mInChangeMarkerPositionMode) {
|
if (mInChangeMarkerPositionMode) {
|
||||||
int x = box.getCenterPixelX();
|
int x = previousMarkerX;
|
||||||
int y = box.getCenterPixelY();
|
int y = previousMarkerY;
|
||||||
canvas.translate(x - contextMarker.getWidth() / 2, y - contextMarker.getHeight());
|
canvas.translate(x - contextMarker.getWidth() / 2, y - contextMarker.getHeight());
|
||||||
contextMarker.draw(canvas);
|
contextMarker.draw(canvas);
|
||||||
} else if (menu.isActive()) {
|
} else if (menu.isActive()) {
|
||||||
LatLon latLon = menu.getLatLon();
|
LatLon latLon = menu.getLatLon();
|
||||||
int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||||
int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||||
|
previousMarkerX = x;
|
||||||
|
previousMarkerY = y;
|
||||||
canvas.translate(x - contextMarker.getWidth() / 2, y - contextMarker.getHeight());
|
canvas.translate(x - contextMarker.getWidth() / 2, y - contextMarker.getHeight());
|
||||||
contextMarker.draw(canvas);
|
contextMarker.draw(canvas);
|
||||||
}
|
}
|
||||||
|
@ -172,8 +177,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
mInChangeMarkerPositionMode = false;
|
mInChangeMarkerPositionMode = false;
|
||||||
RotatedTileBox tileBox = activity.getMapView().getCurrentRotatedTileBox();
|
RotatedTileBox tileBox = activity.getMapView().getCurrentRotatedTileBox();
|
||||||
int newMarkerX = tileBox.getCenterPixelX();
|
int newMarkerX = previousMarkerX;
|
||||||
int newMarkerY = tileBox.getCenterPixelY();
|
int newMarkerY = previousMarkerY;
|
||||||
PointF newMarkerPosition = new PointF(newMarkerX, newMarkerY);
|
PointF newMarkerPosition = new PointF(newMarkerX, newMarkerY);
|
||||||
showContextMenu(newMarkerPosition, tileBox, true);
|
showContextMenu(newMarkerPosition, tileBox, true);
|
||||||
view.refreshMap();
|
view.refreshMap();
|
||||||
|
|
Loading…
Reference in a new issue