<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Potential bug with SketchEditor when undoing MoveSelectedVertex in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/potential-bug-with-sketcheditor-when-undoing/m-p/1026901#M9793</link>
    <description>&lt;P&gt;We are using the SketchEditor to draw polylines in our Xamarin application. We are at version 100.10.0 on the Runtime nuget packages.&lt;/P&gt;&lt;P&gt;If I select a vertex and move it manually, using finger or mouse, then call Undo, everything works.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;if (MapView.SketchEditor.IsEnabled)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;MapView.SketchEditor.UndoCommand.Execute(null);&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If I create a MapPoint (we're doing a kind of snapping to the cursor position) and call MoveSelectedVertex:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;var cursorPoint = GetCursorPosition();&lt;BR /&gt;MapView.SketchEditor.MoveSelectedVertex(cursorPoint);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Then call the same Undo command, the previously moved vertex is deleted instead of being restored to it's previous position.&lt;/P&gt;&lt;P&gt;GetCursorPosition:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;private MapPoint GetCursorPosition()&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if (IsSnapping &amp;amp;&amp;amp; SnapGeometry != null)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var point = SnapGeometry.Centroid().Project(MapView.SpatialReference);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return point;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;else&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return MapView.GetExtent().GetCenter();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Sketching:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherPalmer99_0-1613406286414.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6047iB9B48AB4A9CC6AF7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherPalmer99_0-1613406286414.png" alt="ChristopherPalmer99_0-1613406286414.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Drag vertex 2 to M point manually:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherPalmer99_1-1613406341893.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6048i5B05029483F5E283/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherPalmer99_1-1613406341893.png" alt="ChristopherPalmer99_1-1613406341893.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Undo:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherPalmer99_2-1613406364705.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6049iFD991BE7B8628A03/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherPalmer99_2-1613406364705.png" alt="ChristopherPalmer99_2-1613406364705.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Move selected vertex to cursor using MoveSelectedVertex:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherPalmer99_3-1613406403130.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6050i587303CADCFE2722/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherPalmer99_3-1613406403130.png" alt="ChristopherPalmer99_3-1613406403130.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Undo of MoveSelectedVertex (moved vertex gets deleted)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherPalmer99_4-1613406494930.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6052i0B71D1E9CB33D7A3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherPalmer99_4-1613406494930.png" alt="ChristopherPalmer99_4-1613406494930.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If I call Redo, it gets put back where it was:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherPalmer99_5-1613406551628.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6053i37EAF4FA5CF7F068/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherPalmer99_5-1613406551628.png" alt="ChristopherPalmer99_5-1613406551628.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Feb 2021 19:48:12 GMT</pubDate>
    <dc:creator>ChristopherPalmer99</dc:creator>
    <dc:date>2021-02-15T19:48:12Z</dc:date>
    <item>
      <title>Potential bug with SketchEditor when undoing MoveSelectedVertex</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/potential-bug-with-sketcheditor-when-undoing/m-p/1026901#M9793</link>
      <description>&lt;P&gt;We are using the SketchEditor to draw polylines in our Xamarin application. We are at version 100.10.0 on the Runtime nuget packages.&lt;/P&gt;&lt;P&gt;If I select a vertex and move it manually, using finger or mouse, then call Undo, everything works.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;if (MapView.SketchEditor.IsEnabled)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;MapView.SketchEditor.UndoCommand.Execute(null);&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If I create a MapPoint (we're doing a kind of snapping to the cursor position) and call MoveSelectedVertex:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;var cursorPoint = GetCursorPosition();&lt;BR /&gt;MapView.SketchEditor.MoveSelectedVertex(cursorPoint);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Then call the same Undo command, the previously moved vertex is deleted instead of being restored to it's previous position.&lt;/P&gt;&lt;P&gt;GetCursorPosition:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;private MapPoint GetCursorPosition()&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if (IsSnapping &amp;amp;&amp;amp; SnapGeometry != null)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var point = SnapGeometry.Centroid().Project(MapView.SpatialReference);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return point;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;else&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return MapView.GetExtent().GetCenter();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Sketching:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherPalmer99_0-1613406286414.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6047iB9B48AB4A9CC6AF7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherPalmer99_0-1613406286414.png" alt="ChristopherPalmer99_0-1613406286414.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Drag vertex 2 to M point manually:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherPalmer99_1-1613406341893.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6048i5B05029483F5E283/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherPalmer99_1-1613406341893.png" alt="ChristopherPalmer99_1-1613406341893.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Undo:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherPalmer99_2-1613406364705.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6049iFD991BE7B8628A03/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherPalmer99_2-1613406364705.png" alt="ChristopherPalmer99_2-1613406364705.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Move selected vertex to cursor using MoveSelectedVertex:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherPalmer99_3-1613406403130.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6050i587303CADCFE2722/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherPalmer99_3-1613406403130.png" alt="ChristopherPalmer99_3-1613406403130.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Undo of MoveSelectedVertex (moved vertex gets deleted)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherPalmer99_4-1613406494930.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6052i0B71D1E9CB33D7A3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherPalmer99_4-1613406494930.png" alt="ChristopherPalmer99_4-1613406494930.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If I call Redo, it gets put back where it was:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherPalmer99_5-1613406551628.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6053i37EAF4FA5CF7F068/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherPalmer99_5-1613406551628.png" alt="ChristopherPalmer99_5-1613406551628.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 19:48:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/potential-bug-with-sketcheditor-when-undoing/m-p/1026901#M9793</guid>
      <dc:creator>ChristopherPalmer99</dc:creator>
      <dc:date>2021-02-15T19:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Potential bug with SketchEditor when undoing MoveSelectedVertex</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/potential-bug-with-sketcheditor-when-undoing/m-p/1027197#M9797</link>
      <description>&lt;P&gt;Thanks for reporting this bug. I can reproduce that updating vertex by interaction allows undo/redo while updating vertex by code with MoveSelectedVertex, cannot be undone without the vertex being deleted. It also appears that GeometryChanged event does not report this as move vertex but as move geometry.&lt;/P&gt;&lt;P&gt;As a workaround, you may subscribe to SelectedVertexChanged event and use this to track the newly inserted vertex (e.NewVertex.Point will be the unmodified/unsnapped vertex). Whether you interactively add point or call InsertAfterSelectedVertex, this event will fire.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 16:47:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/potential-bug-with-sketcheditor-when-undoing/m-p/1027197#M9797</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-02-16T16:47:06Z</dc:date>
    </item>
  </channel>
</rss>

