Fix clear selections
This commit is contained in:
parent
4b23255899
commit
99b3d099a2
2 changed files with 13 additions and 25 deletions
|
@ -616,7 +616,8 @@ public class MeasurementToolFragment extends Fragment {
|
|||
if (measurementLayer != null) {
|
||||
removePoint(measurementLayer, editingCtx.getSelectedPointPosition());
|
||||
}
|
||||
clearSelection();
|
||||
editingCtx.recreateSegments();
|
||||
editingCtx.setSelectedPointPosition(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -645,7 +646,7 @@ public class MeasurementToolFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
public void onClearSelection() {
|
||||
clearSelection();
|
||||
editingCtx.setSelectedPointPosition(-1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -859,12 +860,10 @@ public class MeasurementToolFragment extends Fragment {
|
|||
int position = editingCtx.getSelectedPointPosition();
|
||||
commandManager.execute(new MovePointCommand(measurementLayer, oldPoint, newPoint, position));
|
||||
editingCtx.getPoints().add(position, newPoint);
|
||||
editingCtx.recreateSegments();
|
||||
doAddOrMovePointCommonStuff();
|
||||
measurementLayer.exitMovePointMode(false);
|
||||
measurementLayer.refreshMap();
|
||||
}
|
||||
clearSelection();
|
||||
}
|
||||
|
||||
private void cancelMovePointMode() {
|
||||
|
@ -874,8 +873,6 @@ public class MeasurementToolFragment extends Fragment {
|
|||
measurementToolLayer.exitMovePointMode(true);
|
||||
measurementToolLayer.refreshMap();
|
||||
}
|
||||
clearSelection();
|
||||
editingCtx.recreateSegments();
|
||||
}
|
||||
|
||||
private void addPointAfter() {
|
||||
|
@ -891,24 +888,24 @@ public class MeasurementToolFragment extends Fragment {
|
|||
|
||||
private void applyAddPointAfterMode() {
|
||||
switchAddPointAfterMode(false);
|
||||
editingCtx.setSelectedPointPosition(-1);
|
||||
editingCtx.recreateSegments();
|
||||
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
||||
if (measurementLayer != null) {
|
||||
measurementLayer.exitAddPointAfterMode();
|
||||
measurementLayer.refreshMap();
|
||||
}
|
||||
clearSelection();
|
||||
editingCtx.recreateSegments();
|
||||
}
|
||||
|
||||
private void cancelAddPointAfterMode() {
|
||||
switchAddPointAfterMode(false);
|
||||
editingCtx.setSelectedPointPosition(-1);
|
||||
editingCtx.recreateSegments();
|
||||
MeasurementToolLayer measurementToolLayer = getMeasurementLayer();
|
||||
if (measurementToolLayer != null) {
|
||||
measurementToolLayer.exitAddPointAfterMode();
|
||||
measurementToolLayer.refreshMap();
|
||||
}
|
||||
clearSelection();
|
||||
editingCtx.recreateSegments();
|
||||
}
|
||||
|
||||
private void addPointBefore() {
|
||||
|
@ -923,31 +920,24 @@ public class MeasurementToolFragment extends Fragment {
|
|||
|
||||
private void applyAddPointBeforeMode() {
|
||||
switchAddPointBeforeMode(false);
|
||||
editingCtx.setSelectedPointPosition(-1);
|
||||
editingCtx.recreateSegments();
|
||||
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
||||
if (measurementLayer != null) {
|
||||
measurementLayer.exitAddPointBeforeMode();
|
||||
measurementLayer.refreshMap();
|
||||
}
|
||||
clearSelection();
|
||||
editingCtx.recreateSegments();
|
||||
}
|
||||
|
||||
private void cancelAddPointBeforeMode() {
|
||||
switchAddPointBeforeMode(false);
|
||||
editingCtx.setSelectedPointPosition(-1);
|
||||
editingCtx.recreateSegments();
|
||||
MeasurementToolLayer measurementToolLayer = getMeasurementLayer();
|
||||
if (measurementToolLayer != null) {
|
||||
measurementToolLayer.exitAddPointBeforeMode();
|
||||
measurementToolLayer.refreshMap();
|
||||
}
|
||||
clearSelection();
|
||||
editingCtx.recreateSegments();
|
||||
}
|
||||
|
||||
private void clearSelection() {
|
||||
MeasurementToolLayer measurementToolLayer = getMeasurementLayer();
|
||||
if (measurementToolLayer != null) {
|
||||
measurementToolLayer.clearSelection();
|
||||
}
|
||||
}
|
||||
|
||||
private void switchMovePointMode(boolean enable) {
|
||||
|
|
|
@ -129,10 +129,6 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
|||
return false;
|
||||
}
|
||||
|
||||
void clearSelection() {
|
||||
editingCtx.setSelectedPointPosition(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongPressEvent(PointF point, RotatedTileBox tileBox) {
|
||||
if (inMeasurementMode) {
|
||||
|
@ -323,7 +319,9 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
|||
WptPt pt = editingCtx.getOriginalPointToMove();
|
||||
editingCtx.getPoints().add(editingCtx.getSelectedPointPosition(), pt);
|
||||
}
|
||||
editingCtx.recreateSegments();
|
||||
editingCtx.setOriginalPointToMove(null);
|
||||
editingCtx.setSelectedPointPosition(-1);
|
||||
}
|
||||
|
||||
void exitAddPointAfterMode() {
|
||||
|
|
Loading…
Reference in a new issue