【发布时间】:2013-05-23 11:22:58
【问题描述】:
目前我们正在使用 gmaps 进行传单项目,但我遇到了一个小问题。
添加多个标记(每个标记都有一个弹出窗口)后,我们希望将它们全部打开。
为此,我使用以下代码:
L.Map = L.Map.extend({
openPopup: function(popup) {
// this.closePopup();
this._popup = popup;
return this.addLayer(popup).fire('popupopen', {
popup: this._popup
});
}
});
页面加载时一切正常。
但是失败的场景来了:
在pageload 之后是用户zooms in 和一些标记是用户的out of the “view area”。
几秒钟后,网站加载 new position data(用于标记)using a rest interface。
位置数据传输后,我目前删除所有标记并在传输的位置重新创建它们并打开它们。
这个marker.openPopup() 触发,那个map moves 所以,那个popup fits in the “view area” of the user。
在这种情况下我怎么prevent leaflet to drag the map?
【问题讨论】:
标签: javascript leaflet