Move OverlappingMarkerSpiderfier from player-tracker to core. Implement for bookmarks and draw tools

(Markers added to OMS shouldn't use the "click" event but "spiderfiedclick")
This commit is contained in:
fkloft
2014-06-09 21:08:06 +02:00
parent 7f26f8b6a8
commit d3fca8612c
5 changed files with 66 additions and 23 deletions

25
code/oms.js Normal file
View File

@ -0,0 +1,25 @@
/*
OMS doesn't cancel the original click event, so the topmost marker will get a click event while spiderfying.
Also, OMS only supports a global callback for all managed markers. Therefore, we will use a custom event that gets fired
for each marker.
*/
window.setupOMS = function() {
window.oms = new OverlappingMarkerSpiderfier(map, {
keepSpiderfied: true,
legWeight: 3.5,
legColors: {
usual: '#FFFF00',
highlighted: '#FF0000'
}
});
window.oms.addListener('click', function(marker) {
map.closePopup();
marker.fireEvent('spiderfiedclick', {target: marker});
});
window.oms.addListener('spiderfy', function(markers) {
map.closePopup();
});
}