circleMarker点击未被调用 - OverlappingMarkerSpiderfier-Leaflet

时间:2015-05-28 16:56:46

标签: leaflet

我发现点击事件并没有为circleMarker调用,但会调用普通标记。有帮助吗? https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet/issues/19

http://jsfiddle.net/abarik/crk3jrhp/2/

HTML

#map {
    height: 440px;
}

CSS

map = L.map('map', {
    center: [7.2, 40.9],
    zoom: 2
});

L.tileLayer('http://{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
    attribution: "Map: Tiles Courtesy of MapQuest (OpenStreetMap, CC-BY-SA)",
    subdomains: ["otile1", "otile2", "otile3", "otile4"],
    maxZoom: 12,
    minZoom: 2
}).addTo(map);

var oms = new OverlappingMarkerSpiderfier(map);
var popup = new L.Popup();
oms.addListener('click', function(marker) {
  popup.setContent(marker.__name);
  popup.setLatLng(marker.getLatLng());
  map.openPopup(popup);
});

var marker1 = new L.Marker([1, 1]);
marker1.__name = 'marker1'
map.addLayer(marker1);
oms.addMarker(marker1);

var marker2 = new L.Marker([1, 1]);
marker2.__name = 'marker2'
map.addLayer(marker2);
oms.addMarker(marker2);

var marker1 = new L.circleMarker([20, 20]);
marker1.__name = 'cirmarker1'
map.addLayer(marker1);
oms.addMarker(marker1);

var marker2 = new L.circleMarker([20, 20]);
marker2.__name = 'cirmarker2'
map.addLayer(marker2);
oms.addMarker(marker2);

的javascript

override def onRouteRequest(request: RequestHeader): Option[Handler] = {
  if (request.path.equals("/assets/images/logo.jpg")) {
    // return 404 respond
  }
  super.onRouteRequest(request)
}

0 个答案:

没有答案