Can't move a rectangle just created

1574
13
05-31-2017 07:14 PM
xiaoguangyan
New Contributor III

I happen to meet a strange problem, I use the "SketchEditor" to draw some geometry then use geometry to create feature and save them in different types of featurecollectiontables, WHEN I create " rectangle feature", I move it and save, the feature position remain unchange,all other like circle,polygon etc don't have this issue! so strange!

Tags (1)
13 Replies
AndyWright
Occasional Contributor

I am seeing the exact same behavior as Xiaoguang.  I was pretty stoked when I saw the new RequireSelectionBeforeDrag property, but it doesn't seem to work as advertised.  The selecting the border to move stuff is driving our customers nuts.  It's not necessarily a problem to select the outline, but they just don't know that they have to do that to initiate a move.  It's not a good user experience, so being able to do it the old way would be a big win for us.  

Not sure if I'm doing something wrong, but here are the EditConfiguration properties I set up before any edits:

MainMapView.SketchEditor.EditConfiguration.AllowMove = true;
MainMapView.SketchEditor.EditConfiguration.AllowRotate = true;
MainMapView.SketchEditor.EditConfiguration.AllowVertexEditing = true;
MainMapView.SketchEditor.EditConfiguration.ResizeMode = SketchResizeMode.None;
MainMapView.SketchEditor.EditConfiguration.RequireSelectionBeforeDrag = false;

Even after setting those properties when I click on a graphic and drag the map pans.  I still need to tap the line or polygon boundary to select it.  Then I can click and drag the object.  Setting the RequireSelectionBeforeDrag property does not seem to have any effect.

After I set those properties RequireSelectionBeforeDrag is false as it should be.  The next thing I do is start an edit session with the selected graphic like this:

graphic.Geometry = await ApplicationManager.MainMapView.SketchEditor.StartAsync(editGeom, sketchCreationMode);

Immediately after my edit is done the RequireSelectionBeforeDrag property is true for some reason.  Head scratcher there as I never explicitly set it to true.  I would expect it to remain false until I tell it otherwise.  I wonder if this is part of the reason it's not working as we expect it to.

Reply
0 Kudos
JenniferNery
Esri Regular Contributor

Thank you, Andy. We have an open design issue for allowing drag from fill.

As for the EditConfiguration not taking effect next time - is because it's not a global setting.

StartAsync has an optional parameter that accepts SketchEditConfiguration. If this is not supplied, we determine based on the type of geometry whether to enable scale/rotate/vertex editing, etc. The default setting for RequireSelectionBeforeDrag is true. To set it to false, you can either, pass the parameter or set it after StartAsync or set to false in a two-way binding.

MyMapView.SketchEditor.StartAsync(
    SketchCreationMode.Polygon,
    new SketchEditConfiguration() { RequireSelectionBeforeDrag = false } // as parameter
    );

// or set after StartAsync
MyMapView.SketchEditor.EditConfiguration.RequireSelectionBeforeDrag = false; ‍‍‍‍‍‍‍

If you used two-way binding, you would notice that next call to StartAsync will reset this back to true(checked).

<CheckBox Content="Select" IsChecked="{Binding ElementName=MyMapView, Path=SketchEditor.EditConfiguration.RequireSelectionBeforeDrag, Mode=TwoWay}"/>‍‍
Reply
0 Kudos
AndyWright
Occasional Contributor

Boom!  I knew I must have been missing something.  It works a lot better now, but we do still have to click on the poly boundary to move it.  Will be very nice to be able to drag from fill.  Thanks for your help Jennifer!

Reply
0 Kudos
MarkCollins
Occasional Contributor

I agree that the requirement of selecting the outline to move a shape is an extremely confusing and difficult to use UX. I really hope this can be changed to work from the fill in a future update.  

I wasted 3 hours today trying to figure out why I was not able to move my polygons and then happened to stumble upon this post.  At the very least it would be nice to see the API/docs or samples updated with some information about the expected UI workflow for moving geometries. 

Reply
0 Kudos