Map onDblClick event

2541
3
Jump to solution
06-09-2011 12:26 PM
JeremyAdams
New Contributor
I am working on a project where the map will give users the option click and recieve an infoWindow containg quereied Parcel data.  I also want to use the measureing widgit.  The problem is that if I click the measure widgit and then click the map, it not only starts measureing, but it also displayes the infoWindow.

My work around i think should be to have the infoWindow display when a user double clicks.  So i changed my listener from 'onClick' event to  'onDblClick' even.

function init() {
..
dojo.connect(map, "onDblClick", myClickHandler);
..
}

But that doesnt fire off myClickHandler fucntion, instead it simply center and zooms the map.  I have tried to disable double click and zoom:

function init() {
..
        map = new esri.Map("map", {infoWindow: Popup, logo: false});
         dojo.place(Popup.domNode,map.root);
         dojo.addClass(map.infoWindow.domNode, "myTheme");
         map.disableDoubleClickZoom();
...
        dojo.connect(map, "onDblClick", myClickHandler);
...
}

But the map still zooms when double clicked, and the function myClickHandler is not fired.  It works just fine if I use "onClick" instead of "onDblClick".

Any help is appreciated.
0 Kudos
1 Solution

Accepted Solutions
StephenLead
Regular Contributor III
My work around i think should be to have the infoWindow display when a user double clicks.


FWIW, I think this could cause problems with user expectations, as it's a "standard" feature to zoom the map in on double-click.

The problem is that if I click the measure widgit and then click the map, it not only starts measureing, but it also displayes the infoWindow.


You could disable the infoWindow listener when the user clicks the measure widget, and re-enable it when the measure widget is closed. One option is to do something like this:

var clickListener = dojo.connect(map, "onClick", myClickHandler); 
dojo.disconnect(clickListener);

Good luck,
Steve

View solution in original post

0 Kudos
3 Replies
JaclynGorman
New Contributor
ESRI has the zoom built in the the api so you need to disable it within the function that calls the map variable and the extent (usually function init() or something similar).

The disable code line is as follows:

dojo.connect(map, "onLoad", function() {
     map.disableDoubleClickZoom();
});


Hope this helps

Jaclyn
0 Kudos
StephenLead
Regular Contributor III
My work around i think should be to have the infoWindow display when a user double clicks.


FWIW, I think this could cause problems with user expectations, as it's a "standard" feature to zoom the map in on double-click.

The problem is that if I click the measure widgit and then click the map, it not only starts measureing, but it also displayes the infoWindow.


You could disable the infoWindow listener when the user clicks the measure widget, and re-enable it when the measure widget is closed. One option is to do something like this:

var clickListener = dojo.connect(map, "onClick", myClickHandler); 
dojo.disconnect(clickListener);

Good luck,
Steve
0 Kudos
JeremyAdams
New Contributor
That works great.  Thanks so much!
0 Kudos