From 1af56db0304975e1028a5084e17ed00c0c815a8e Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Fri, 23 Dec 2011 14:10:02 +0800 Subject: [PATCH] Fix minzoom handling for area markers --- web/js/markers.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/js/markers.js b/web/js/markers.js index cc03f5e7..cc765e8c 100644 --- a/web/js/markers.js +++ b/web/js/markers.js @@ -139,8 +139,9 @@ componentconstructors['markers'] = function(dynmap, configuration) { } area.our_area.bindPopup(popup, {}); } - if((set.minzoom < 1) || (dynmap.map.getZoom() >= set.minzoom)) + if((set.minzoom < 1) || (dynmap.map.getZoom() >= set.minzoom)) { set.layergroup.addLayer(area.our_area); + } } // Helper functions @@ -304,7 +305,7 @@ componentconstructors['markers'] = function(dynmap, configuration) { $(dynmap).bind('mapchanged', function(event) { var zoom = dynmap.map.getZoom(); $.each(dynmapmarkersets, function(setname, set) { - if((set.minzoomout < 1) || (zoom >= set.minzoom)) { + if((set.minzoom < 1) || (zoom >= set.minzoom)) { $.each(set.markers, function(mname, marker) { var marker = set.markers[mname]; var markerPosition = getPosition(marker); @@ -331,6 +332,8 @@ componentconstructors['markers'] = function(dynmap, configuration) { set.layergroup.addLayer(marker.our_marker); }); $.each(set.areas, function(aname, area) { + if(dynmap.map.hasLayer(area.our_area)) + set.layergroup.removeLayer(area.our_area); createArea(set, area, area.timestamp); }); }