Sticky move tolerance for ArcGIS JavaScript

1217
9
05-03-2013 02:58 AM
SigurjonJonsson
New Contributor
Hi everyone.

We are trying to add sticky move tolerance to our project which we are creating. We have not found anything regarding that issue for the JavaScript part.

Does anyone know anything about that?

Sjonni, Iceland
0 Kudos
9 Replies
JianHuang
Occasional Contributor III
Do you mean snapping when drawing or editing geometries?
Here is the doc:
http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/snappingmanager.html
Some samples:
Snapping with measurement tools:
http://developers.arcgis.com/en/javascript/samples/widget_measurement/
Snapping with editor widget:
http://developers.arcgis.com/en/javascript/samples/ed_editing_widget/
0 Kudos
SigurjonJonsson
New Contributor
Thanks for the answer.

No, I am not talking about snapping manager.

We are creating a JavaScript project were we have a lot of features and we want to prevent users to accidentally move features. It would basically be the same feature as in ArcGIS desktop: http://forums.arcgis.com/threads/21692-default-sticky-move-setting but for JavaScript.

Is this maybe not possible?
0 Kudos
SigurjonJonsson
New Contributor
Hello again.

Here is a sample that might explain this better for you: http://developers.arcgis.com/en/javascript/samples/ed_simpletoolbar/
In this project you can so easily move the features and we don´t want people to accidentally do that.

Can someone help please?
0 Kudos
JianHuang
Occasional Contributor III
My understanding is that you still want the editing functionality, but don't want the features to be moved accidentally. So you want to set a safe zone. If moving within that area, it's considered as unwanted editing. Is it right?
You may want to look at featureLayer.onBeforeApplyEdits(adds, updates, deletes) event, which fires before posting the editing to the server. At that point, you can compare the updates and existing geometries.
0 Kudos
JianHuang
Occasional Contributor III
Sigurjon,

I explored this a little bit further. Because there is no way to cancel an edit request even you decide that this is an accident in the onBeforeApplyEdits event, it seems manipulating editToolbar would be a more elegant solution.
Please see the document:
http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/edit.html
Pay attention to onGraphicMoveStop(graphic, transform) and onVertexMoveStop(graphic, vertexInfo, transform). The transform gives the information about how far the graphic/vertex has been moved. If it's not far enough, you can move the graphic/vertex back to its original location.
If you are using editor widget, you can get reference to editToolbar by editor._editToolbar
0 Kudos
SigurjonJonsson
New Contributor
Thanks.

I am looking into this and I will let you know.

Sincerey
Sjonni, Iceland
0 Kudos
NajyaBatool
New Contributor III
Hi Sjonni,

Were you able to find a fix for this issue?  I'd like to do the same, but in Flex.  It's so easy to accidentally pick up features and move them.  Very frustrating!

Thanks,
Najya
0 Kudos
SigurjonJonsson
New Contributor
Hi Najya.

No, I gave up. Yes it is very frustrating accidentally picking up features and move them, not what we want.
Sorry about that. Hope you find some good solutions.

Sjonni
0 Kudos
NajyaBatool
New Contributor III
That's a shame.  Okay.  Thanks for getting back to me so quickly.  If I can figure out a work around, I'll definitely let you know. 

Najya
0 Kudos