diff --git a/public/js/route.js b/public/js/route.js index 161830f..d77e85e 100644 --- a/public/js/route.js +++ b/public/js/route.js @@ -27,8 +27,10 @@ function buildRoute(fit) wayPoints.push({latLng: {lat: lat, lng: lng}}); costomPointName = 'c_'+lat+'_'+lng; - points[costomPointName] = L.marker([lat, lng], {icon: categories.simplepoint, title: 'Произвольная точка'}); - points[costomPointName].addTo(myMap); + if (typeof points[costomPointName] == 'undefined') { + points[costomPointName] = L.marker([lat, lng], {icon: categories.simplepoint, title: 'Произвольная точка'}); + markers.addLayer(points[costomPointName]); + } } if (i == 0) @@ -172,7 +174,8 @@ function addToRoute(id, build) e = (id[1]>=0) ? 'E'+id[1] : 'W'+Math.abs(id[1]); coordsName = n.substring(0,10)+'° '+e.substring(0,10)+'°'; - $('#wayPoints').append('
× '+coordsName+'
'); + costomPointName = 'c_'+id[0]+'_'+id[1]; + $('#wayPoints').append('
× '+coordsName+'
'); closePopup(); openBox('Route', true);