Revert moveMapToPoint and fix moving
This commit is contained in:
parent
74f3da881b
commit
2e1875373a
2 changed files with 13 additions and 22 deletions
|
@ -606,8 +606,8 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void addPointAfterOnClick() {
|
public void addPointAfterOnClick() {
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
|
measurementLayer.moveMapToPoint(editingCtx.getSelectedPointPosition());
|
||||||
editingCtx.splitSegments(editingCtx.getSelectedPointPosition() + 1);
|
editingCtx.splitSegments(editingCtx.getSelectedPointPosition() + 1);
|
||||||
measurementLayer.moveMapToPoint(editingCtx.getSelectedPointPosition());
|
|
||||||
}
|
}
|
||||||
((TextView) mainView.findViewById(R.id.add_point_before_after_text)).setText(mainView.getResources().getString(R.string.add_point_after));
|
((TextView) mainView.findViewById(R.id.add_point_before_after_text)).setText(mainView.getResources().getString(R.string.add_point_after));
|
||||||
mainIcon.setImageDrawable(getActiveIcon(R.drawable.ic_action_addpoint_above));
|
mainIcon.setImageDrawable(getActiveIcon(R.drawable.ic_action_addpoint_above));
|
||||||
|
@ -617,8 +617,8 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void addPointBeforeOnClick() {
|
public void addPointBeforeOnClick() {
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
|
measurementLayer.moveMapToPoint(editingCtx.getSelectedPointPosition());
|
||||||
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
|
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
|
||||||
measurementLayer.moveMapToPoint(editingCtx.getSelectedPointPosition());
|
|
||||||
}
|
}
|
||||||
((TextView) mainView.findViewById(R.id.add_point_before_after_text)).setText(mainView.getResources().getString(R.string.add_point_before));
|
((TextView) mainView.findViewById(R.id.add_point_before_after_text)).setText(mainView.getResources().getString(R.string.add_point_before));
|
||||||
mainIcon.setImageDrawable(getActiveIcon(R.drawable.ic_action_addpoint_below));
|
mainIcon.setImageDrawable(getActiveIcon(R.drawable.ic_action_addpoint_below));
|
||||||
|
|
|
@ -367,26 +367,17 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
view.getAnimatedDraggingThread().startMoving(lat, lon, view.getZoom(), true);
|
view.getAnimatedDraggingThread().startMoving(lat, lon, view.getZoom(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void moveMapToPoint(int pos) {
|
public void moveMapToPoint(int pos) {
|
||||||
if (editingCtx.getBeforePoints().size() > 0 || editingCtx.getAfterPoints().size() > 0) {
|
if (editingCtx.getPointsCount() > 0) {
|
||||||
WptPt pt = null;
|
if (pos >= editingCtx.getPointsCount()) {
|
||||||
if (pos >= editingCtx.getPointsCount()) {
|
pos = editingCtx.getPointsCount() - 1;
|
||||||
if (editingCtx.getAfterPoints().size() >= pos - editingCtx.getPointsCount()) {
|
} else if (pos < 0) {
|
||||||
pt = editingCtx.getAfterPoints().get(pos - editingCtx.getPointsCount());
|
pos = 0;
|
||||||
} else {
|
}
|
||||||
pos = editingCtx.getPointsCount() - 1;
|
WptPt pt = editingCtx.getPoints().get(pos);
|
||||||
pt = editingCtx.getPoints().get(pos);
|
moveMapToLatLon(pt.getLatitude(), pt.getLongitude());
|
||||||
}
|
}
|
||||||
} else if (pos < 0) {
|
}
|
||||||
pos = 0;
|
|
||||||
pt = editingCtx.getPoints().get(pos);
|
|
||||||
}
|
|
||||||
if (pt == null) {
|
|
||||||
pt = editingCtx.getPoints().get(pos);
|
|
||||||
}
|
|
||||||
moveMapToLatLon(pt.getLatitude(), pt.getLongitude());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void refreshMap() {
|
public void refreshMap() {
|
||||||
view.refreshMap();
|
view.refreshMap();
|
||||||
|
|
Loading…
Reference in a new issue