i am trying to add tooltip on polygon on mouseover event
but it cannot getting coordinate of polygon on mouse over
here is code to create polygon and added mouse over event in the end of function (attachPolygonInfoWindow())...........
function editShape() {
var hdncolor;
var color;
color = "#0000FF";
var points = [];
var _Polygons = [];
_Polygons = document.getElementById("PointsBox").value.split('?');
for (var j = 0; j <= _Polygons.length - 1; j++) {
debugger;
var inputPolygon = _Polygons[j];
pointsLines = inputPolygon.split(/ |\n/);
var poly = new GPolygon([], color, 2, 0.7, color, 0.2);
for (var i = 0, len = pointsLines.length; i < len; ++i) {
if (pointsLines[i].search(/,|\t/) != -1) {
pointsCoords = pointsLines[i].split(/,|\t/);
if (parseFloat(pointsCoords[0]) != 0 && parseFloat(pointsCoords[1]) != 0) {
poly.insertVertex(0, new GLatLng(parseFloat(pointsCoords[0]), parseFloat(pointsCoords[1])));
}
}
}
map.addOverlay(poly);
var name = "Polygon " + (++shapeCounter_);
var cells = addFeatureEntry(name, color);
poly.disableEditing({ onEvent: "mouseout" });
poly.disableEditing({ onEvent: "mouseover" });
poly.Nametag = name;
currpoly = poly;
logCoordinates(poly);
cells.desc.innerHTML = " (" + poly.getVertexCount() + " points)";
GEvent.bind(poly, "lineupdated", cells.desc, function () {
logCoordinates(poly);
var cell = this;
cell.innerHTML = " (" + poly.getVertexCount() + " points)";
});
GEvent.addListener(poly, "click", function (latlng, index) {
currpoly = poly;
if (typeof index == "number") {
poly.deleteVertex(index);
} else {
poly.setStrokeStyle({ weight: 2 });
cells.desc.innerHTML = " (" + poly.getVertexCount() + " points)";
}
});
debugger
attachPolygonInfoWindow(poly , '<strong>Info about this area</strong>');
}
}
function attachPolygonInfoWindow(poly, html) {
debugger;
poly.infoWindow = new google.maps.InfoWindow({
content: html
});
GEvent.addListener(poly, 'mouseover', function (e) {
debugger;
var latLng = e.latLng;
poly.infoWindow.setPosition(latLng);
poly.infoWindow.open(map);
});
}
it is not working because it not getting latlog on mouseover
plz help....