SketchEditor.GeometryChanged not firing consistently when moving a point by dragging it

807
3
08-23-2018 01:47 PM
AndyWright
Occasional Contributor

I'm writing a tool that allows my users to click on a point in the map and then drag it and drop it on a new location.  This works perfectly in the WPF API, but in the Xamarin API there are times where the sketch editor does not appear to know that a geometry edit has occurred.  I've tried to force a complete on the sketch editor as well and in the same fashion CompleteCommand.CanExecute is false at times right after I complete the drag and drop.  If I don't drag and I simply select the point then tap on the new location it seems to work fine.

Here is a snippet of my code:

SketchEditConfiguration sec = new SketchEditConfiguration();
sec.AllowMove = true;
sec.AllowRotate = false;
sec.AllowVertexEditing = false;
sec.RequireSelectionBeforeDrag = false;

SketchCreationMode sketchCreationMode = SketchCreationMode.Point;
Geometry editGeom = null;

ApplicationManager.MainMapView.SketchEditor.GeometryChanged += async (s, e) =>
{
moveFeature.Geometry = e.NewGeometry;
await moveFeature.FeatureTable.UpdateFeatureAsync(moveFeature);
};

editGeom = moveFeature.Geometry;
sketchCreationMode = (SketchCreationMode)Enum.Parse(typeof(SketchCreationMode), moveFeature.Geometry.GeometryType.ToString());

await ApplicationManager.MainMapView.SketchEditor.StartAsync(editGeom, sketchCreationMode, sec);

0 Kudos
3 Replies
AndyWright
Occasional Contributor

I just noticed that if I drag the point to a new location and pause for a second or two everything works fine.  If I drag to the new location and immediately lift my finger off the screen it hardly ever works.

0 Kudos
JenniferNery
Esri Regular Contributor

Thank you for reporting this, it's been logged and fixed in our current builds to address this user feedback. You may want to use PropertyChanged for Geometry meanwhile.

However, do you mean to update feature's geometry before sketch has completed? You can use set SketchEditor.Style Fill/Line/Marker/Selected symbols if you just need the temporary graphic of SketchEditor to match your feature's symbology.

0 Kudos
AndyWright
Occasional Contributor

Ok that's good to know Jennifer.  So I assume this will be fixed in 100.4 then?

No I am not trying to update the geometry before it has been completed.  The scenario I described is where the completed "event" doesn't occur consistently unless I pause before I lift my finger off the screen on a drag and drop.

0 Kudos