# HG changeset patch # User Matti Hamalainen # Date 1397411531 -10800 # Node ID e908103cdcd870ade7b7686e49a983ca3116b284 # Parent 649c82460b760e1205ca491bb8f5fc78efdc8321 Change how map initialization arguments are handled. diff -r 649c82460b76 -r e908103cdcd8 map.js --- a/map.js Sun Apr 13 16:38:20 2014 +0300 +++ b/map.js Sun Apr 13 20:52:11 2014 +0300 @@ -93,16 +93,21 @@ pmapCanvas.setMap(pmap); google.maps.event.addListener(pmap, "mousemove", pmapCoordinateListener); - if (args && args.zoom && args.x && args.y) + + if (typeof(args) == "object") { - google.maps.event.addDomListener(pmap, "foobar", function() + if ("zoom" in args && "x" in args && "y" in args) { - pmap.setZoom(args.zoom); - pmap.panTo(pmapMapCoordsToLatLng(new google.maps.Point(args.x, args.y), 6)); - var tgtMarker = pmapGetMarkerIndexByCoords(args.x, args.y); - if (tgtMarker) - pmapMyClick(tgtMarker); - }); + google.maps.event.addDomListener(pmap, "foobar", function() + { + pmap.setZoom(args.zoom); + pmap.panTo(pmapMapCoordsToLatLng(new google.maps.Point(args.x, args.y), 6)); + var tgtMarker = pmapGetMarkerIndexByCoords(args.x, args.y); + if (tgtMarker) + pmapMyClick(tgtMarker); + }); + } + } } pmapInitializeNav();