我正在使用带有Google Maps API v3的最新版本的MarkerClusterer,我想我发现了一个bug!
我的谷歌地图minZoom设置为1,从级别1缩小到任意级别,然后恢复到1就可以了。当我试图从级别1缩小到级别0时,发现了错误。
当我单击从级别1缩小到级别0时,gMap UI不允许缩放,但我的所有markerClusters都消失了,当我下到缩放级别2并返回到级别1时,它们会重新出现。
我已经在Google Maps API v3的Google Group页面上发布了这篇文章,但到目前为止还没有回应(到今天为止已经超过一周了)。
任何帮助都是非常感谢的!
发布于 2013-02-27 08:49:16
与其说是markerClusterer中的错误,不如说是地图应用编程接口中的错误,但您可以在markerClusterer.js中修复它
我不确定当您(尝试)将缩放设置为0时,您在哪里点击了它(当我使用缩放控件时,问题不会发生),但当我使用map.setZoom(0)设置缩放时,它就会发生
问题:接口报告缩放为0,但这是不正确的,因为缩放将被设置为1( minZoom)。
修复:
替换marcerclusterer.js的这一部分:
// Add the map event listeners
var that = this;
google.maps.event.addListener(this.map_, 'zoom_changed', function() {
var zoom = that.map_.getZoom();
if (that.prevZoom_ != zoom) {
that.prevZoom_ = zoom;
that.resetViewport();
}
});...with表示:
// Add the map event listeners
var that = this;
google.maps.event.addListener(this.map_, 'zoom_changed', function() {
var zoom = that.map_.getZoom(),
minZoom=that.map_.minZoom||0,
maxZoom=Math.min(that.map_.maxZoom||100,
that.map_.mapTypes[that.map_.getMapTypeId()].maxZoom);
zoom=Math.min(Math.max(zoom,minZoom),maxZoom);
if (that.prevZoom_ != zoom) {
that.prevZoom_ = zoom;
that.resetViewport();
}
});https://stackoverflow.com/questions/15098796
复制相似问题