On Jul 15, 12:26 pm, Kio <[email protected]> wrote:
>
> The problem occurs when clicking inside the shape (if i put 5 points
> that define a shape and the sixth inside the shape) the shape
> dissapears and firebug shows me this error: a is undefined
Have you looked at the code to see what happens when you click? It's
this bit:
function mapClick(marker, clickedPoint) {
polygonMode = true;
// Push onto polypoints of existing polygon
polyPoints.push(clickedPoint);
drawCoordinates();
}
When you click on an overlay (like the polygon, or a marker), the
"marker" parameter contains a reference to the overlay and
"clickedPoint" is null. The function then pushes the null on to the
array and tries to deal with it.
There is in fact a third parameter available with a click, which is
present when an overlay is clicked. You can use that to get the
location of the click. Change your function to this:
function mapClick(marker, clickedPoint, ovPoint) {
if (ovPoint) { clickedPoint = ovPoint }
polygonMode = true;
// Push onto polypoints of existing polygon
polyPoints.push(clickedPoint);
drawCoordinates();
}
In this new function, if there is an ovPoint it means that an overlay
has been clicked, and ovPoint contains the location of the click. So
assign that value to clickedPoint and then carry on as before.
If you can't get it to work, do post back but you will need to provide
a link to your page, not a code listing.
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" 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-api?hl=en.