Select to view content in your preferred language

Disable pan/zoom while editing

3621
7
06-13-2011 05:12 PM
PatrickKing
Emerging Contributor
Hello,

I'm looking for a way to reversibly turn off map panning and zooming while using a Draw object with editing enabled, since these functions are being activated accidentally while using touch devices to edit. I have tried setting zoom and pan durations to zero, but this didn't seem to have any effect. I have also tried setting IsEnabled, IsManipulationEnabled, and IsHitTestVisible on the map object, but these end up blocking both pan and edit inputs from reaching the map. Is there anything I've missed?

Thanks!
0 Kudos
7 Replies
JenniferNery
Esri Regular Contributor
When Draw or Editor is active, map navigation (pan/zoom) already gets disabled. Because mouse and touch events are being handled by Draw and Editor. Are you saying this does not work?
What version of the API are you using? Can you give us steps to reproduce the issue? Maybe try the following samples with your touch-enabled device: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#DrawGraphics and http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsAutoSave
0 Kudos
PatrickKing
Emerging Contributor
Hi,

I tried the samples you suggested, and both of them work in the same way as my application. When clicking and editing, no drag and scroll is possible, but when using touches it is possible to scroll with some of the tools. The point, line segment, and polygon tools add a new point on touch, and scroll the map on touch and drag. The rectangle region, freehand line and freehand polygon tools do not scroll on touch and drag, they draw the feature as normal.

I think I read elsewhere on the forum this is the expected behaviour for the draw object, since being able to scroll while adding features can be useful. Or am I mistaken?

We have several touch devices, some with better precision than others, and on the lower precision devices it's proving difficult to enter points without triggering the scroll behaviour. The device I do development on is a Dell ST2220T touch monitor, but all of the devices show the same behaviour, so I assume it has to do with ArcGIS. The WPF API version is 2.1.0.446.

Thanks!
Patrick
0 Kudos
JenniferNery
Esri Regular Contributor
Ah yes. That is correct, drawing and editing using touch does not completely disable map navigation. This is especially useful for WindowsPhone7 apps. Are you seeing a problem with this design?
0 Kudos
PatrickKing
Emerging Contributor
Truth be told it is causing some trouble. I'm working with a tabletop that registers touches very frequently, so that tap is often read as two or more touches close together, triggering a map scroll or map zoom.

It's a problem with the hardware, but since I can't correct that, I was hoping I could compensate by switching off scroll and zoom while any of the edit controls are enabled.
0 Kudos
JenniferNery
Esri Regular Contributor
If it's just zooming you want to avoid, I think you can susbscribe to Map.MapGesture event and mark it handled. Touch events get translated to mouse events so panning cannot be turned off this way, unless you mark MouseLeftButtonDown to handled as well.
private void MyMap_MapGesture(object sender, Map.MapGestureEventArgs e)
{
 e.Handled = true;
}
0 Kudos
PatrickKing
Emerging Contributor
Hello,

private void MyMap_MapGesture(object sender, Map.MapGestureEventArgs e)
{
 e.Handled = true;
}


I had a chance to look into this issue again. The code suggested has the effect of stopping all input to the map, panning, zooming and editing, while using touch input. Because manipulation needs to be enabled in order for the map to register touch events properly, they are marked handled and touches are not promoted to clicks. The project is moving on, it looks like I will have to leave this issue alone for now...
0 Kudos
Hwee_KiangSim
Emerging Contributor
Hi,
I have the exact same problem as you! so did you managed to solve it or left it as it is?
Hope you will share your solution if you find one in the future. Thanks!
0 Kudos