mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Fix issue where undoing the second-to-first vertex of a way when drawing would undo to the initial state of the way (close #7772)
This commit is contained in:
@@ -195,23 +195,23 @@ export function behaviorDrawWay(context, wayID, mode, startGraph) {
|
||||
|
||||
var nextMode;
|
||||
|
||||
if (context.graph() === startGraph) { // we've undone back to the beginning
|
||||
if (context.graph() === startGraph) {
|
||||
// We've undone back to the initial state before we started drawing.
|
||||
// Just exit the draw mode without undoing whatever we did before
|
||||
// we entered the draw mode.
|
||||
nextMode = modeSelect(context, [wayID]);
|
||||
} else {
|
||||
context.history()
|
||||
.on('undone.draw', null);
|
||||
// remove whatever segment was drawn previously
|
||||
context.undo();
|
||||
// The `undo` only removed the temporary edit, so here we have to
|
||||
// manually undo to actually remove the last node we added. We can't
|
||||
// use the `undo` function since the initial "add" graph doesn't have
|
||||
// an annotation and so cannot be undone to.
|
||||
context.pop(1);
|
||||
|
||||
if (context.graph() === startGraph) { // we've undone back to the beginning
|
||||
nextMode = modeSelect(context, [wayID]);
|
||||
} else {
|
||||
// continue drawing
|
||||
nextMode = mode;
|
||||
}
|
||||
// continue drawing
|
||||
nextMode = mode;
|
||||
}
|
||||
|
||||
// clear the redo stack by adding and removing an edit
|
||||
// clear the redo stack by adding and removing a blank edit
|
||||
context.perform(actionNoop());
|
||||
context.pop(1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user