Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I was trying to add an infoBubble to a markerCluster in the 'clusterclick' event but the infoBubble.Open method ask for a 'marker' parameter to bind with. The problem is that a markerCluster is not a google.maps.Point so it's not posible to bind the infoBubble to it.

I assigned the possition of the markerCluster to the infoBubble but the infoBubble redraws in the new position moving the marker from its possition.

Has anyone had the same problem? Is there a solution without modifing the original infoBubble code?

http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
856 views
Welcome To Ask or Share your Answers For Others

1 Answer

Solution problem 1: The marker parameter was optional If I just simply never assign it, the problem is solved.

Use:

infoBubble.setPossition(latLng);
infoBubble.open(map);

Not:

infoBubble.open(map, marker);

Problem 2: But now the infoBubble appears over the market, is there a way to move it up??

Solution problem 2:

I modified the InfoBubble sourceCode to contain a offsetParameter and then add the pixels in the draw function:

InfoBubble.prototype.PIXEL_OFFSET = 0
...
var top = pos.y - (height + arrowSize); if (anchorHeight) { top -= anchorHeight; } top -= this.PIXEL_OFFSET

Just in case someone had the same problem


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...