We are developing an application based on ArcGIS Runtime .NET 100.3, .Net Framework 4.7.1 , Windows 10 64bit
For polygon feature edit operations we use the the sketch editor using different modes:
We trigger the <command>.Execute in the code (for selected workflows)
(MyMapView.SketchEditor.AddCommand.Execute(insertPoint); MyMapView.SketchEditor.MoveSelectedVertex(newPosition); ... MyMapView.SketchEditor.UndoCommand.Execute(...););
Additionally, the user is allowed to edit the geometry interactively on the mapview
(AllowVertexEditing = true,
SketchVertexEditMode VertexEditMode = InteractionEdit;
RequireSelectionBeforeDrag = false; ... )
Our question is: What does the UndoCommand exactly "undo"?
Our expectation is, that the last operation is rollbacked, but we observed following behaviour (check the attached videos):
Move - Undo
- In case of moving an arbitrary vertex interactively, the undo command does not reset the original position, but DELETES the moved point.
- same behaviour when using MyMapView.SketchEditor.MoveSelectedVertex(newPosition);
Delete - Undo
- In case of deleting an arbitrary selected vertex, the undo command does not recreate the deleted point, but deletes the vertex subsequent to the deleted point ???
Is this behaviour "as designed" ?
Is there a detailled description in the APIreference documentation?
Thanks in advance,
Solved! Go to Solution.
Thank you for your feedback. This appears to be a regression between v100.2.1 and v100.3 that dragging vertex or geometry is not part of the undo stack. I have logged an issue for this so we can fix in future releases of the API. Meanwhile, you may use GeometryChanged event to track the old geometry to be restored on Undo.
UndoCommand is meant to bring back the previous state of geometry. When a new vertex was added, the new vertex will be removed. When a vertex is deleted, the deleted vertex is added back. When a vertex is moved, the moved vertex is moved back to its previous location. When the geometry is scaled, rotated or resized, its previous shape and location is restored.
MyMapView.SketchEditor.GeometryChanged += (s, e) =>
private readonly Stack<Geometry> undoStack = new Stack<Geometry>();
private void OnUndo(object sender, RoutedEventArgs e)
Thank you for your workaround, it temporary helps us.
I just want to point out that the wrong behaviour occurs at deleted vertices too (not only in case of dragging them).
Is there an esri bug number or issue ticket or similar?
Thanks for the follow-up. Undo from move or delete are both addressed in the same issue. I don't have a reference number I can share but fix is on its way for next release.
I'm seeing the problem in 100.10 when calling MoveSelectedVertex, followed by executing the UndoCommand. The vertex that was moved is deleted on the Undo.