google maps api v3 + infoBubble in markerClusterer

前端 未结 2 1888
难免孤独
难免孤独 2020-12-16 07:20

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

2条回答
  •  再見小時候
    2020-12-16 07:52

    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

提交回复
热议问题