views:

50

answers:

2

I have simple WebSite with GoogleMaps. My GoogleMaps have mouseMove-event. All browsers everything is ok, except for IE. When I move the mouse cursor over the map - IE very much uses cpu. mouseMove-event very important for my WebSite, but because of IE it works very slowly. I google it and find same problem (Jun 26, 2006): gmap2 mousemove events using 100% cpu in IE. I tested it in IE6 and IE8. How I can use mouseMove and have normal speed?

I have very simple mouseMove:

        // Script
        GEvent.addListener(map, "mousemove", function(point) {
            mousex = point.x;
            mousey = point.y;
            document.getElementById('LatLng').innerHTML = 
                            'LatLng: ' + mousex + ', ' + mousey;
        } );
        // Body
        <span id="LatLng">LatLng</span>
A: 

Can you share your mouseMove event handler?

@unknown (google), 1) Look to my edit. 2) Your post is not answer. You should ask clarification in cooments to question.
DreamWalker
+1  A: 

I think there is potential to speed it up if you use setTimeout() to ensure you only call the mousemove handler 10 times per second. Something like:

var wait = false;
GEvent.addListener(map, "mousemove", function(point) {
    if (!wait) window.setTimeout("showLatLng('+point+')", 100);
    wait = true;
}
function showLatLng(point) {
        mousex = point.x;
        mousey = point.y;
        document.getElementById('LatLng').innerHTML = 
                        'LatLng: ' + mousex + ', ' + mousey;
        wait = false;
}

Haven't tested it, but it might work. Hope it does :)

Eric Wendelin