点击缩放时的markerClusterer [英] markerClusterer on click zoom

查看:89
本文介绍了点击缩放时的markerClusterer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚添加了一个MarkerClusterer到我的谷歌地图。它工作得很好。



我只是想知道是否有任何方式来调整点击群集时的放大行为。如果可能,我想改变缩放级别。



有什么办法可以达到这个目的吗?

解决方案

我按照建议修改了clusterclick事件:

  / ** 
*如果设置了该选项,则触发clusterclick事件和缩放。
* /
ClusterIcon.prototype.triggerClusterClick = function(){
var markerClusterer = this.cluster_.getMarkerClusterer();

//触发clusterclick事件。
google.maps.event.trigger(markerClusterer,'clusterclick',this.cluster_);

if(markerClusterer.isZoomOnClick()){
//放大集群。
// this.map_.fitBounds(this.cluster_.getBounds());

//修改放大功能
this.map_.setZoom(markerClusterer.getMaxZoom()+ 1);

}
};

效果很好!非常感谢


I just added a MarkerClusterer to my google map. It works perfectly fine.

I am just wondering if there is any way of adjusting the zoom-in behaviour when the cluster is clicked. I would like to change the zoom level if possible.

Is there any way of achieving this?

Thanks

解决方案

I modified the clusterclick event as suggested:

/**
* Triggers the clusterclick event and zoom's if the option is set.
*/
ClusterIcon.prototype.triggerClusterClick = function() {
var markerClusterer = this.cluster_.getMarkerClusterer();

// Trigger the clusterclick event.
google.maps.event.trigger(markerClusterer, 'clusterclick', this.cluster_);

if (markerClusterer.isZoomOnClick()) {
// Zoom into the cluster.
// this.map_.fitBounds(this.cluster_.getBounds());

// modified zoom in function
this.map_.setZoom(markerClusterer.getMaxZoom()+1);

 }
};

It works great! Thanks a lot

这篇关于点击缩放时的markerClusterer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆