From 66cc162e38a6b5969690ff290876e1aea7e094c5 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 21 Oct 2014 19:36:51 +0100 Subject: [PATCH] draw-tools: create clones of latlng objects - otherwise drawn items end up with copies of thise form portals, which editing can cause the portal merkers to move! --- plugins/draw-tools.user.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/draw-tools.user.js b/plugins/draw-tools.user.js index a8f48f92..b4457e9c 100644 --- a/plugins/draw-tools.user.js +++ b/plugins/draw-tools.user.js @@ -2,7 +2,7 @@ // @id iitc-plugin-draw-tools@breunigs // @name IITC plugin: draw tools // @category Layer -// @version 0.6.5.@@DATETIMEVERSION@@ +// @version 0.6.6.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ @@ -224,7 +224,7 @@ window.plugin.drawTools.getSnapLatLng = function(unsnappedLatLng) { if(candidates.length === 0) return unsnappedLatLng; candidates = candidates.sort(function(a, b) { return a[0]-b[0]; }); - return candidates[0][1]; + return new L.LatLng(candidates[0][1].lat, candidates[0][1].lng); //return a clone of the portal location } @@ -488,7 +488,7 @@ window.plugin.drawTools.snapToPortals = function() { testCount++; var newll = findClosestPortalLatLng(ll); if (!newll.equals(ll)) { - layer.setLatLng(newll); + layer.setLatLng(new L.LatLng(newll.lat,newll.lng)); changedCount++; } } @@ -500,7 +500,7 @@ window.plugin.drawTools.snapToPortals = function() { testCount++; var newll = findClosestPortalLatLng(lls[i]); if (!newll.equals(lls[i])) { - lls[i] = newll; + lls[i] = new L.LatLng(newll.lat,newll.lng); changedCount++; layerChanged = true; }