Select to view content in your preferred language

zoom box threshold

1225
4
Jump to solution
10-11-2012 01:55 AM
AdrianMarsden
Honored Contributor
Hi

I'm using the out of box navigaton bar, with a nice zoom box thingy.  I also have a default onclick of the map to fire off the identify task.

Sometimes when I want to ID a feature, after zooming in using the zoom button, the mouse moves fractionally, and this is read as a zoom event (click drag) and map zooms into a tiny area.

Is there any way of setting a threshold for the zoom option, so anything less than X pixels is interpreted as a single click?

Cheers

ACM
0 Kudos
1 Solution

Accepted Solutions
__Rich_
Deactivated User
Thought it might be useful to 'link' these threads - http://forums.arcgis.com/threads/68248-Mouse-pan-triggering-sensitivity

I don't think there's anything out-the-box to either set the zoom tolerance nor to cancel any zoom once it's 'started', you could probably hook up something to bounce the user back to the previous extent if you calculate they've triggered an unintentional zoom but you'd have to be very careful with how that might affect your user's experience!

You could always delve into the API and see if there's any unofficial ways to hook into the zooming mechanism, but I suspect you won't want to go there...

View solution in original post

0 Kudos
4 Replies
__Rich_
Deactivated User
Thought it might be useful to 'link' these threads - http://forums.arcgis.com/threads/68248-Mouse-pan-triggering-sensitivity

I don't think there's anything out-the-box to either set the zoom tolerance nor to cancel any zoom once it's 'started', you could probably hook up something to bounce the user back to the previous extent if you calculate they've triggered an unintentional zoom but you'd have to be very careful with how that might affect your user's experience!

You could always delve into the API and see if there's any unofficial ways to hook into the zooming mechanism, but I suspect you won't want to go there...
0 Kudos
AdrianMarsden
Honored Contributor
Mmm - I think I see your thinking - I could have the ID task fire on a left click event - this will also help me control the switch on/off this task when I am drawing features or using an area measure tool.

Ta
0 Kudos
MarcusBush
Emerging Contributor
You could code your identify tool with a boolean for "active" or not, then disable the zoom navigation while it is active.

Use the .deactivate of the nav toolbar that you declared for when identify is active, and .activate() when it isn't.
0 Kudos
AdrianMarsden
Honored Contributor
Finally got to look at this and did what was suggested -= a bounce back if the zoomextent was a large difference from the original

    dojo.connect(map, "onZoomEnd", catchZoom2);
    dojo.connect(map, "onZoomStart", catchZoom);


Hook the map to some functions in the init function, then

//catch bad zooms//get map extent at the start of the zoom
function catchZoom(extent,zoomFactor) {
    oldExtent = new esri.geometry.Extent();    
    oldExtent = extent;   
}
//if the zoomfactor is too big, assume it is an error and go back to the original
function catchZoom2(extent, zoomFactor) {
    console.debug(zoomFactor)
    if (zoomFactor > 400) {
         map.setExtent(startExtent);
    }


If anyone has a more elegant way it would be nice.
0 Kudos