getOptions for polygons and polylines

2,388 views
Skip to first unread message

KB

unread,
Oct 2, 2011, 6:36:13 AM10/2/11
to Google Maps JavaScript API v3
I have polygons with different fillColors and all with black
strokeColor. For visibility-reasons I want to change, at a certain
zoomout-level, the strokeColor to the fillColor, but I cannot get the
fillColor of each polygon. There is setOptions but no getOptions.

geoco...@gmail.com

unread,
Oct 2, 2011, 5:10:01 PM10/2/11
to Google Maps JavaScript API v3
You had to set it at some point. Save it away (preferably associated
with the polygon somehow), and use that (but why do you need it?).

-- Larry

Enoch Lau (Google Employee)

unread,
Oct 3, 2011, 2:19:15 AM10/3/11
to google-map...@googlegroups.com
As Polygons are MVCObjects, you can access the fillColor with:
    polygon.get('fillColor')

Enoch

Pil

unread,
Oct 3, 2011, 3:45:54 AM10/3/11
to Google Maps JavaScript API v3
Why not use the regular Javascript syntax?

polygon['fillColor'] or in dot notation

polygon.fillColor




On Oct 3, 8:19 am, "Enoch Lau (Google Employee)" <enoch...@google.com>
wrote:

Enoch Lau (Google Employee)

unread,
Oct 3, 2011, 4:25:17 AM10/3/11
to google-map...@googlegroups.com
The fact that it's stored like that is an implementation detail. The documented way to get properties out of an MVCObject is to use .get().

Enoch

KB

unread,
Oct 4, 2011, 8:31:06 AM10/4/11
to Google Maps JavaScript API v3
Ah, so easy ;-) get.('fillColor') works fine.
Thanks!

Reply all
Reply to author
Forward
0 new messages