views:

8

answers:

0

So, I've run into a problem implementing a double click event in Google Maps. The code here works perfectly in Firefox, but in Internet Explorer the double click event rarely fires. I think that the problem is the one listed here: http://webbugtrack.blogspot.com/2008/01/bug-263-beware-of-doubleclick-in-ie.html basically that instead of firing 2 click events, Internet Explorer fires a click and then a double-click, so for my code, you would have to have clicked 3 times before the timeout (click-doubleclick-click) to register the doubleclick, and Google maps doesn't have a doubleclick event. I'm trying to figure out how I can make this work in IE since apparently some people use it. Any suggestions would be appreciated. Oh, and that is just my best theory about what is going on, I'm not at all sure. I would provide a link but my application is only running locally right now.

Thanks!
Katie

(global) var timeout;

GEvent.addListener(marker, 'click', function(latlng) {
                if (timeout) {
        window.clearTimeout(timeout);
        timeout = null;
        doubleClick(marker, latlng);
                }
                else {
        timeout = window.setTimeout(function() {singleClick(marker);}, 400);
                }
    });



function doubleClick(marker) {
    notifyListeners(_markerDoubleClickListeners, 'dblclick', marker);
};

function singleClick(marker) {
    window.clearTimeout(timeout);
    timeout = null;
    notifyListeners(_markerClickListeners, 'click', marker);
};