Export to GitHub

google-maps-utility-library-v3 - issue #325

MarkerWithLabel V3, cannot hide marker labels in V 1.1.0


Posted on Sep 10, 2014 by Massive Ox

(Sorry for double post. This issue is a copy of my comment in https://code.google.com/p/google-maps-utility-library-v3/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Priority%20Fixed%20Owner%20Summary%20Stars&groupby=&sort=&id=60 since I just realized that issue 60 was already closed when I commented in it).

Anyway, I'm on:

Windows7 Enterprise SP1 Chrome Version 37.0.2062.120 m @name MarkerWithLabel for V3 @version 1.1.10 [April 8, 2014]

and I feel so stupid, because I don't see what I'm doing wrong. This code alerts all labels, but does not hide them. Why?

function hideLabels() {

for (i = 0; i < markers.length; i++) {
    alert(markers[i].labelContent);
    markers[i].set("labelVisible", false)
}

}

Comment #1

Posted on Sep 11, 2014 by Massive Ox

Comment deleted

Comment #2

Posted on Sep 11, 2014 by Massive Ox

In fact, the labels actually gets hidden after the function runs, but a refresh was needed. I found this:

markers[i].label.draw();

which worked for me. So - problem solved.

Status: New