New SVG Symbols

165 views
Skip to first unread message

Pil

unread,
Nov 3, 2012, 3:20:01 PM11/3/12
to Google Maps JavaScript API v3
The new SVG symbols are really cool. I'm trying to replace all markers
with these symbols. So I'm looking for a possibility to determine the
paths.

Another question: Have you forgotten to make it possible to hide and
unhide the symbols - for example on a polyline? Just found out that
setting the offset property to 101% makes it to disappear. But that
seems not very elegant.

Enoch Lau (Google Employee)

unread,
Nov 3, 2012, 7:50:50 PM11/3/12
to google-map...@googlegroups.com
To hide the symbols on a polyline, set the 'icons' property to null; to reshow, set the 'icons' property to an array of symbols again.

If the offset is 101%, then symbol is off the end of the polyline, which is why it disappears.

Pil

unread,
Nov 4, 2012, 1:28:53 AM11/4/12
to Google Maps JavaScript API v3
Thanks Enoch.

Hmm, there may be a problem arising with this if I understand you
right.
When I do this

To show:

var icons = poly.get('icons');
icons[0].offset = somepercent +'%';
poly.set('icons', icons);

To hide:

var icons = poly.get('icons');
icons[0].offset = '101%';
poly.set('icons', icons);

This is working pefectly in all browsers. But when I do this

To show:

poly.setOptions({ icons: [{ icon: mysymbol, offset: somepercent
+'%' }] });

To hide:

poly.set('icons', null);

This is only working in 'normal' browsers. (You know which browser I
mean with 'abnormal').
What exactly do mean with "an array of symbols"?



On Nov 4, 12:50 am, "Enoch Lau (Google Employee)"

Enoch Lau (Google Employee)

unread,
Nov 4, 2012, 9:35:37 AM11/4/12
to google-map...@googlegroups.com
I can't reproduce the problem with poly.set('icons', null) - it causes the symbol to disappear in IE for me... would you be able to provide a link to a demo that shows it not working please? (Also, which browser version/OS?)

Enoch

Enoch Lau (Google Employee)

unread,
Nov 4, 2012, 9:39:57 AM11/4/12
to google-map...@googlegroups.com
Oh wait, I think I see it. Do you mean the following doesn't work in IE?

var icons = poly.get('icons');
poly.set('icons', null);
poly.set('icons', icons);  // Doesn't re-show the icons in IE.

Enoch

Pil

unread,
Nov 4, 2012, 10:52:05 AM11/4/12
to Google Maps JavaScript API v3
I mean when the SVG icons property is set to null then IE is not able
to set it in again using the setOptions method. It seems that IE is
only able to handle this sort of symbols when it is defined directly
as polyline property. No chance using setOptions to manipulate it
afterwards.

This was tested in IE 8 because newer IEs aren't available for XP.



On Nov 4, 3:39 pm, "Enoch Lau (Google Employee)" <enoch...@google.com>

Enoch Lau (Google Employee)

unread,
Nov 4, 2012, 6:09:50 PM11/4/12
to google-map...@googlegroups.com
OK, thanks for finding this. Please report a bug on http://code.google.com/p/gmaps-api-issues/issues/list so that you can follow progress on the bug.
Reply all
Reply to author
Forward
0 new messages