我正在使用asp.net来构建我的网站,并在我的ASPX页面中包含以下内容:
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<link rel="stylesheet" href="localhost/leaflet.label.css" />
<link rel="stylesheet" href="localhost/MarkerClusters/dist/MarkerCluster.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script src="localhost/MarkerClusters/dist/leaflet.markercluster-src.js"></script>
<script type="text/javascript">
var map = L.map('map',
{
crs: L.CRS.EPSG4326,
maxBounds: new L.LatLngBounds([-312, -180], [180, 312])
}).setView([0, 0], 0);
var myIcon = L.icon({
iconUrl: 'http://localhost/CustomIcons/Blue.png',
iconSize: [20, 20],
shadowSize: [50, 64],
iconAnchor: [10, 10],
shadowAnchor: [4, 62],
popupAnchor: [0, 0] });这就是我不能理解的部分:
var myMarkerCluster = L.markerClusterGroup({maxClusterRadius: 120});
//try to add markers
var testmarker1 = L.marker(new L.LatLng(0, 0), { icon: myIcon, draggable: false });
var testmarker2 = L.marker(new L.LatLng(10, 10), { icon: myIcon, draggable: false });
myMarkerCluster.addLayer(testmarker1);
myMarkerCluster.addLayer(testmarker2);
map.addLayer(myMarkerCluster);现在,我注意到的奇怪的事情是,在我为集群添加代码之前,我能够在地图上右击,并得到一个带有lat,lon的传单弹出。我没有在代码中删除该功能,但现在,随着集群代码的添加,如果我右键单击,就会得到一个常规的浏览器上下文菜单。我不知道发生了什么,我想知道我正在努力完成的标记聚类中缺少了什么。敬请指教...
发布于 2014-03-15 09:44:05
不认为有默认的,你需要添加上下文菜单到传单,试试这个
http://leafletjs.com/plugins.html
https://stackoverflow.com/questions/20065574
复制相似问题