Google maps 谷歌地图api v3+;markerClusterer中的信息气泡

Google maps 谷歌地图api v3+;markerClusterer中的信息气泡,google-maps,google-maps-api-3,markerclusterer,Google Maps,Google Maps Api 3,Markerclusterer,我试图在'clusterclick'事件中将infoBubble添加到markerCluster,但infoBubble.Open方法要求使用'marker'参数绑定。问题是markerCluster不是google.maps.Point,因此无法将infoBubble绑定到它 我将markerCluster的位置指定给infoBubble,但infoBubble会在新位置重新绘制,将标记从其位置移出 有人有过同样的问题吗?有没有不修改原始infoBubble代码的解决方案 解决问题1: mar

我试图在'clusterclick'事件中将infoBubble添加到markerCluster,但infoBubble.Open方法要求使用'marker'参数绑定。问题是markerCluster不是google.maps.Point,因此无法将infoBubble绑定到它

我将markerCluster的位置指定给infoBubble,但infoBubble会在新位置重新绘制,将标记从其位置移出

有人有过同样的问题吗?有没有不修改原始infoBubble代码的解决方案


解决问题1: marker参数是可选的,如果我只是不分配它,问题就解决了

使用:

不是:

问题2:但是现在市场上出现了信息泡沫,有没有办法让它上升

解决问题2

我修改了InfoBubble源代码以包含offsetParameter,然后在draw函数中添加像素:

InfoBubble.prototype.PIXEL_OFFSET = 0
...
var top = pos.y - (height + arrowSize); if (anchorHeight) { top -= anchorHeight; } top -= this.PIXEL_OFFSET
以防有人有同样的问题

将此添加到第93行(在其他选项字段下方)

在第182行附近,添加以下内容

InfoBubble.prototype.PIXEL_OFFSET_ = [0.0];
在第908行周围添加以下内容:

top -= this.get('pixelOffset')[1];  // Add offset Y.
left -= this.get('pixelOffset')[0]; // Add offset X.
上述线条应置于以下位置之上:

this.bubble_.style['top'] = this.px(top);
this.bubble_.style['left'] = this.px(left);

现在在你的建设中,你可以做的选择

var popupWindowOptions = {
    backgroundColor: '#2B2B2B',
    arrowStyle: 0,
    pixelOffset: [0,16]
 };

 this.popupWindow = new InfoBubble(popupWindowOptions);

将其更改为top+=和left+=在这里更有意义。[-10,-10]将向左移动。[10,10]将向右移。否则,这是一个很好的解决方案。
top -= this.get('pixelOffset')[1];  // Add offset Y.
left -= this.get('pixelOffset')[0]; // Add offset X.
this.bubble_.style['top'] = this.px(top);
this.bubble_.style['left'] = this.px(left);
var popupWindowOptions = {
    backgroundColor: '#2B2B2B',
    arrowStyle: 0,
    pixelOffset: [0,16]
 };

 this.popupWindow = new InfoBubble(popupWindowOptions);