I have been working on a site to plot and display driving direction to
multiple locations using user input addresses. It is working well. I
am having one problem with it though. When I move the mouse over the
map the crosshair show up like it should (then left clicking allow you
to move the map). This works sometimes, but more often than not the
site freezes. Below is the function I am using, any help with this
freezing problem would be greatly appreciated.

My test location site is;  http://www.idlespuralpacas.com/routeNinja/

Code:

function load() {
        doLoad();
}

//.....///

function doLoad() {
        if (GBrowserIsCompatible()) {
                container = document.getElementById("mapDiv");
                resizePage();
                map = new GMap2(container, {draggableCursor:"crosshair"});

                map.addMapType(G_PHYSICAL_MAP)
                TerrainLayer.getOpacity = function () {return opacity;};
                var layers = [NormalLayer,TerrainLayer];
                addCustomMapType("Terrain N",layers,17,0);

                directionsInfoDiv = document.getElementById("directions_info");
                dirObj = new GDirections();

                var mapState = getMapState();
                if (typeof(mapState) != 'undefined') {
                        if (mapState['lat'] && mapState['lon']) {
                                centerPoint = new 
GLatLng(parseFloat(mapState['lat']),
parseFloat(mapState['lon']));
                        }
                        if (mapState['z']) {
                                zoom = parseInt(mapState['z']);
                        }
                        if (mapState['mType']) {
                                mType = parseInt(mapState['mType']);

                                if (mType == 4) {
                                        opacity = 0.4;
                                }
                        }

                        if (mapState['driveFrom']) {
                                var oDriveFrom = 
document.getElementById('driveFrom').value =
mapState['driveFrom'];
                        }
                        if (mapState['driveTo']) {
                                var oDriveFrom = 
document.getElementById('driveTo').value =
mapState['driveTo'];
                        }
                        if (mapState['driveVia']) {
                                var oDriveFrom = 
document.getElementById('driveVia').value =
mapState['driveVia'];
                        }
                        if (mapState['locale']) {
                                var oDriveFrom = 
document.getElementById('locale').value =
mapState['locale'];
                        }
                }

                map.setCenter(centerPoint, zoom, map.getMapTypes()[mType]);

                map.addControl(new GScaleControl());
                map.addControl(new GLargeMapControl());
                map.addControl(new GMapTypeControl());
//map.addControl(new DragZoomControl(),new
GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(-10,10)));

//              map.enableDoubleClickZoom();
                map.enableContinuousZoom();
                map.enableScrollWheelZoom();

                GEvent.addListener(map, 'mousemove', mouseMove);
/*
                GEvent.addListener(map, "moveend", moveEnd);
                GEvent.addListener(map, "zoomend", zoomEnd);
                GEvent.addListener(map, "maptypechanged", mapTypeChenged);
*/
                GEvent.addListener(map, 'click', mapClick);

                GEvent.addListener(dirObj, "load", onDirectionsLoad);
                GEvent.addListener(dirObj, "error", onDirectionsError);

                var ovcontrol = new GOverviewMapControl(new GSize(165,165));
                map.addControl(ovcontrol);
                var ov_map = ovcontrol.getOverviewMap();
                GEvent.addListener(map, 'maptypechanged', function(){
//                      ov_map.setMapType(G_NORMAL_MAP);
                });

                if (mapState['driveFrom'] && mapState['driveTo']) {
                        getDirections();
                }

        }
}

//.....///

function addCustomMapType(mName,layers,maxRes,minRes) {
        var TerrainN = new GMapType(layers, normalProj, mName,
{maxResolution:maxRes, minResolution:minRes, errorMessage:'Boom!'});
        map.addMapType(TerrainN);
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to