How to detect a click on a circle border?

66 views
Skip to first unread message

Arnaud Lhopiteau

unread,
Jun 29, 2011, 8:19:21 AM6/29/11
to google-map...@googlegroups.com
Hi!
 I would like to detect when a click event fires from the "fill" or "stroke" part of a circle, any idea?
 
Cheers!

Pil

unread,
Jun 29, 2011, 10:59:49 AM6/29/11
to Google Maps JavaScript API v3
You can draw a polyline around the circle. Then you should be able to
distinguish between a click on the polyline and a click on the circle.

Rossko

unread,
Jun 29, 2011, 2:27:03 PM6/29/11
to Google Maps JavaScript API v3
>  I would like to detect when a click event fires from the "fill" or "stroke"
> part of a circle, any idea?

Or you could do some simple maths. Calculate the distance from click
to circle centre. Bigger than radius? Outside. Approximately equal
to radius (you can choose your own tolerance here)? On the line.
Smaller than radius? Inside.

Arnaud Lhopiteau

unread,
Jun 29, 2011, 2:39:47 PM6/29/11
to Google Maps JavaScript API v3
Sounds like a good idea, I will implement it tomorrow. I will send you
feedback, cheers!
> > Cheers!- Hide quoted text -
>
> - Show quoted text -

Arnaud Lhopiteau

unread,
Jun 29, 2011, 2:41:37 PM6/29/11
to Google Maps JavaScript API v3
Actually this is how I solved this problem with Bing maps since I can
get the click event coordinates in pixels, I posted this question on
this forum because I couldn't figure out how to implement that with
Google maps API. Thanks.

Pil

unread,
Jun 30, 2011, 3:52:32 AM6/30/11
to Google Maps JavaScript API v3
Three things to clarify:

1) You didn't mention that you wanted the return values of the click
events in pixels.

2) I personally do not believe the conjecture that Microsoft's Bing
Maps are easier to handle than Google Maps.

3) I think your reply unveils your social competence. Maybe you should
handle that a bit more carefully in the future.

arnaud lhopiteau

unread,
Jun 30, 2011, 5:04:49 AM6/30/11
to google-map...@googlegroups.com
I am sorry to have upset you Pil, here are my clarifications:

1: the return value in pixel is not important if I know if the click
is on the border or in the filling part, this info is available in
Bing maps and I just use it to solve this problem.
2: I do not believe Bing maps is easier to handle than Google Maps or
Mappy ( I use the three of them actually, they all have their pros and
cons) and I wasn't trying to promote a Google's competitor product,
my goal was to explain how I already solved the problem with a
different API which offers different informations.
3: Again sorry if I upset you with my answer to Rossko, I am not here
to upset people, please accept my apologies.

And thanks again for the solution you submitted Pil.

> --
> 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 google-map...@googlegroups.com.
> To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages