polygon mouseover

2,489 views
Skip to first unread message

Jason Sanford

unread,
Apr 6, 2010, 2:23:07 PM4/6/10
to google-map...@googlegroups.com
I know there is no 'mouseover' event for a Polygon but has anyone successfully implemented their own solution? I want to highlight a polygon (change fillColor property) when I mouseover a polygon and open an infoWindow when I click a polygon (I've already got this).

Thanks

bratliff

unread,
Apr 8, 2010, 10:40:32 AM4/8/10
to Google Maps JavaScript API v3

It is difficult to do with tiled polys. Each tile may contain
multiple polys. Each poly may be partially resident in multiple
tiles. For CANVAS, it means completely rebuilding every tile
containing a piece of the poly. For SVG & VML, individual polys can
have color changes applied but it still involves multiple tiles.

It can be done by inserting / removing extra shapes for the "rollover"
element in the existing tile structure. Unfortunately, CANVAS uses a
different coloring algorithm than SVG & VML.

Erwin Quinto

unread,
Apr 11, 2010, 10:32:16 AM4/11/10
to Google Maps JavaScript API v3

Jason Sanford

unread,
Apr 12, 2010, 9:04:59 AM4/12/10
to google-map...@googlegroups.com
After a quick look at your code. It looks like you essentially wrapped a polygon with a bigger transparent polygon and you hide the tooltip when the 'mousemove' event fires on the big transparent polygon.  Unfortunately, I don't think this will help with my application as I have multiple polygons that most likely share a boundary edge, so it would be hard to wrap each one with a larger polygon.

It is, however, a very creative solution that I can probably use on a few other projects.  Thanks for the tip.

--
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.


Richard

unread,
Apr 25, 2010, 5:09:40 PM4/25/10
to Google Maps JavaScript API v3
Any updates on this?
I'm looking for something similar myself with the fillcolor.


[quote]
I don't think this will help with my application as I have multiple
polygons that most likely share a boundary edge, so it would be hard
to wrap each one with a larger polygon.
[/quote]

This shouldn't be a big problem? As the bigger polygon lies behind the
others. You could add several listeners for all your polygons? Or
would this result in multiple tooltips (in the example)? I assume the
tooltip text would just change..

Luke Mahé

unread,
Apr 26, 2010, 6:20:01 PM4/26/10
to google-map...@googlegroups.com
Hi Richard,

Polygon's now support mouse events, please read the reference (http://code.google.com/apis/maps/documentation/v3/reference.html#Polygon) for more information.

- Luke

Jason Sanford

unread,
Apr 26, 2010, 6:35:18 PM4/26/10
to google-map...@googlegroups.com

This is huge. Thanks Luke

On Apr 26, 2010 6:20 PM, "Luke Mahé" <lu...@google.com> wrote:

Hi Richard,

Polygon's now support mouse events, please read the reference (http://code.google.com/apis/maps/documentation/v3/reference.html#Polygon) for more information.

- Luke



On Sun, Apr 25, 2010 at 2:09 PM, Richard <ric...@korebrits.nl> wrote:
>
> Any updates on this?

> ...

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScrip...

Erwin Quinto

unread,
Apr 27, 2010, 7:53:08 AM4/27/10
to Google Maps JavaScript API v3
It's about time they realize that its an essential feature to have.
Thanks for the info Luke.

On Apr 27, 6:20 am, Luke Mahé <lu...@google.com> wrote:
> Hi Richard,
>
> Polygon's now support mouse events, please read the reference (http://code.google.com/apis/maps/documentation/v3/reference.html#Polygon)
> for more information.
>
> - Luke
>
>
>
> On Sun, Apr 25, 2010 at 2:09 PM, Richard <rich...@korebrits.nl> wrote:
> > Any updates on this?
> > I'm looking for something similar myself with the fillcolor.
>
> > [quote]
> > I don't think this will help with my application as I have multiple
> > polygons that most likely share a boundary edge, so it would be hard
> > to wrap each one with a larger polygon.
> > [/quote]
>
> > This shouldn't be a big problem? As the bigger polygon lies behind the
> > others. You could add several listeners for all your polygons? Or
> > would this result in multiple tooltips (in the example)? I assume the
> > tooltip text would just change..
>
> > --
> > 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<google-maps-js-api-v3%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
> --
> 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 athttp://groups.google.com/group/google-maps-js-api-v3?hl=en.
Reply all
Reply to author
Forward
0 new messages