I changed my map creation code to this:
if(mapAPI == 'G')
{
point = new GPoint(lon,lat);
map = new GMap(adr[i]);
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.centerAndZoom(point, 0);
}
else
{
point = new YGeoPoint(lat,lon);
map = new YMap(adr[i]);
map.addPanControl();
map.addZoomShort();
map.drawZoomAndCenter(point, 1);
}
addMarkerToMap(map, point, html);
And the marker addition code to this:
if(mapAPI == 'G')
{
var marker = new GMarker(point);
map.addOverlay(marker);
if(html)
{
marker.openInfoWindowHtml(html)
GEvent.addListener(marker, 'click', function() {marker.openInfoWindowHtml(html);});
}
}
else
{
var marker = new YMarker(point);
map.addOverlay(marker);
if(html)
{
html = "<div class='map-marker'>" + html + "</div>";
marker.openSmartWindow(html);
YEvent.Capture(marker, EventsList.MouseClick, function() {marker.openSmartWindow(html);});
}
}
Which creates as close an experience as possible in both maps.
The map provider should be selected at random, but if you'd like to force a particular map, add #G or #Y to the url. They can be found on the california reviews page.
Let me know what you think.
1 comments :
Cool stuff, this.
Post a Comment