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) {
|
if (measurementLayer != null) {
|
||||||
removePoint(measurementLayer, editingCtx.getSelectedPointPosition());
|
removePoint(measurementLayer, editingCtx.getSelectedPointPosition());
|
||||||
}
|
}
|
||||||
clearSelection();
|
editingCtx.recreateSegments();
|
||||||
|
editingCtx.setSelectedPointPosition(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -645,7 +646,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClearSelection() {
|
public void onClearSelection() {
|
||||||
clearSelection();
|
editingCtx.setSelectedPointPosition(-1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -859,12 +860,10 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
int position = editingCtx.getSelectedPointPosition();
|
int position = editingCtx.getSelectedPointPosition();
|
||||||
commandManager.execute(new MovePointCommand(measurementLayer, oldPoint, newPoint, position));
|
commandManager.execute(new MovePointCommand(measurementLayer, oldPoint, newPoint, position));
|
||||||
editingCtx.getPoints().add(position, newPoint);
|
editingCtx.getPoints().add(position, newPoint);
|
||||||
editingCtx.recreateSegments();
|
|
||||||
doAddOrMovePointCommonStuff();
|
doAddOrMovePointCommonStuff();
|
||||||
measurementLayer.exitMovePointMode(false);
|
measurementLayer.exitMovePointMode(false);
|
||||||
measurementLayer.refreshMap();
|
measurementLayer.refreshMap();
|
||||||
}
|
}
|
||||||
clearSelection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelMovePointMode() {
|
private void cancelMovePointMode() {
|
||||||
|
@ -874,8 +873,6 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
measurementToolLayer.exitMovePointMode(true);
|
measurementToolLayer.exitMovePointMode(true);
|
||||||
measurementToolLayer.refreshMap();
|
measurementToolLayer.refreshMap();
|
||||||
}
|
}
|
||||||
clearSelection();
|
|
||||||
editingCtx.recreateSegments();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPointAfter() {
|
private void addPointAfter() {
|
||||||
|
@ -891,24 +888,24 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
|
|
||||||
private void applyAddPointAfterMode() {
|
private void applyAddPointAfterMode() {
|
||||||
switchAddPointAfterMode(false);
|
switchAddPointAfterMode(false);
|
||||||
|
editingCtx.setSelectedPointPosition(-1);
|
||||||
|
editingCtx.recreateSegments();
|
||||||
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
measurementLayer.exitAddPointAfterMode();
|
measurementLayer.exitAddPointAfterMode();
|
||||||
measurementLayer.refreshMap();
|
measurementLayer.refreshMap();
|
||||||
}
|
}
|
||||||
clearSelection();
|
|
||||||
editingCtx.recreateSegments();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelAddPointAfterMode() {
|
private void cancelAddPointAfterMode() {
|
||||||
switchAddPointAfterMode(false);
|
switchAddPointAfterMode(false);
|
||||||
|
editingCtx.setSelectedPointPosition(-1);
|
||||||
|
editingCtx.recreateSegments();
|
||||||
MeasurementToolLayer measurementToolLayer = getMeasurementLayer();
|
MeasurementToolLayer measurementToolLayer = getMeasurementLayer();
|
||||||
if (measurementToolLayer != null) {
|
if (measurementToolLayer != null) {
|
||||||
measurementToolLayer.exitAddPointAfterMode();
|
measurementToolLayer.exitAddPointAfterMode();
|
||||||
measurementToolLayer.refreshMap();
|
measurementToolLayer.refreshMap();
|
||||||
}
|
}
|
||||||
clearSelection();
|
|
||||||
editingCtx.recreateSegments();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPointBefore() {
|
private void addPointBefore() {
|
||||||
|
@ -923,31 +920,24 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
|
|
||||||
private void applyAddPointBeforeMode() {
|
private void applyAddPointBeforeMode() {
|
||||||
switchAddPointBeforeMode(false);
|
switchAddPointBeforeMode(false);
|
||||||
|
editingCtx.setSelectedPointPosition(-1);
|
||||||
|
editingCtx.recreateSegments();
|
||||||
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
measurementLayer.exitAddPointBeforeMode();
|
measurementLayer.exitAddPointBeforeMode();
|
||||||
measurementLayer.refreshMap();
|
measurementLayer.refreshMap();
|
||||||
}
|
}
|
||||||
clearSelection();
|
|
||||||
editingCtx.recreateSegments();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelAddPointBeforeMode() {
|
private void cancelAddPointBeforeMode() {
|
||||||
switchAddPointBeforeMode(false);
|
switchAddPointBeforeMode(false);
|
||||||
|
editingCtx.setSelectedPointPosition(-1);
|
||||||
|
editingCtx.recreateSegments();
|
||||||
MeasurementToolLayer measurementToolLayer = getMeasurementLayer();
|
MeasurementToolLayer measurementToolLayer = getMeasurementLayer();
|
||||||
if (measurementToolLayer != null) {
|
if (measurementToolLayer != null) {
|
||||||
measurementToolLayer.exitAddPointBeforeMode();
|
measurementToolLayer.exitAddPointBeforeMode();
|
||||||
measurementToolLayer.refreshMap();
|
measurementToolLayer.refreshMap();
|
||||||
}
|
}
|
||||||
clearSelection();
|
|
||||||
editingCtx.recreateSegments();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clearSelection() {
|
|
||||||
MeasurementToolLayer measurementToolLayer = getMeasurementLayer();
|
|
||||||
if (measurementToolLayer != null) {
|
|
||||||
measurementToolLayer.clearSelection();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void switchMovePointMode(boolean enable) {
|
private void switchMovePointMode(boolean enable) {
|
||||||
|
|
|
@ -129,10 +129,6 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearSelection() {
|
|
||||||
editingCtx.setSelectedPointPosition(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongPressEvent(PointF point, RotatedTileBox tileBox) {
|
public boolean onLongPressEvent(PointF point, RotatedTileBox tileBox) {
|
||||||
if (inMeasurementMode) {
|
if (inMeasurementMode) {
|
||||||
|
@ -323,7 +319,9 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
WptPt pt = editingCtx.getOriginalPointToMove();
|
WptPt pt = editingCtx.getOriginalPointToMove();
|
||||||
editingCtx.getPoints().add(editingCtx.getSelectedPointPosition(), pt);
|
editingCtx.getPoints().add(editingCtx.getSelectedPointPosition(), pt);
|
||||||
}
|
}
|
||||||
|
editingCtx.recreateSegments();
|
||||||
editingCtx.setOriginalPointToMove(null);
|
editingCtx.setOriginalPointToMove(null);
|
||||||
|
editingCtx.setSelectedPointPosition(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exitAddPointAfterMode() {
|
void exitAddPointAfterMode() {
|
||||||
|
|
Loading…
Reference in a new issue