google maps api v3 + infoBubble in markerClusterer [英] google maps api v3 + infoBubble in markerClusterer
问题描述
我试图在'clusterclick'事件中为infoCluster添加一个infoBubble,但是infoBubble.Open方法要求绑定一个'marker'参数。问题是markerCluster不是google.maps.Point,因此将infoBubble绑定到它是不可能的。
我将markerCluster的位置分配给infoBubble但是infoBubble会重新绘制新位置,将标记从其位置移开。
有没有人遇到同样的问题?有没有修改原始infoBubble代码的解决方案?
http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/
标记参数是可选的如果我只是从不分配它,问题就解决了。解决方案问题1: p>
使用:
infoBubble.setPossition(latLng);
infoBubble.open(map);
不是:
infoBubble.open(map,marker);
问题2:现在infoBubble出现在市场上,有没有办法让它上涨?解决问题2
:我修改了InfoBubble sourceCode以包含offsetParameter,然后在draw函数中添加像素:
InfoBubble.prototype.PIXEL_OFFSET = 0
...
var top = pos.y - (height + arrowSize);如果(anchorHeight){top - = anchorHeight; } top - = this.PIXEL_OFFSET
以防万一有人遇到同样的问题
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/
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
这篇关于google maps api v3 + infoBubble in markerClusterer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!