We are using the SketchEditor to draw polylines in our Xamarin application. We are at version 100.10.0 on the Runtime nuget packages.
If I select a vertex and move it manually, using finger or mouse, then call Undo, everything works.
if (MapView.SketchEditor.IsEnabled)
{
MapView.SketchEditor.UndoCommand.Execute(null);
}
If I create a MapPoint (we're doing a kind of snapping to the cursor position) and call MoveSelectedVertex:
var cursorPoint = GetCursorPosition();
MapView.SketchEditor.MoveSelectedVertex(cursorPoint);
Then call the same Undo command, the previously moved vertex is deleted instead of being restored to it's previous position.
GetCursorPosition:
private MapPoint GetCursorPosition()
{
if (IsSnapping && SnapGeometry != null)
{
var point = SnapGeometry.Centroid().Project(MapView.SpatialReference);
return point;
}
else
{
return MapView.GetExtent().GetCenter();
}
}
Sketching:
Drag vertex 2 to M point manually:
Undo:
Move selected vertex to cursor using MoveSelectedVertex:
Undo of MoveSelectedVertex (moved vertex gets deleted)
If I call Redo, it gets put back where it was: