From 579e323d0994c5111ef46aa8343b5cdcbc2db4fa Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 8 Feb 2017 09:53:30 +0000 Subject: [PATCH] Only record a visible object if it exists Fixes #1430 --- app/assets/javascripts/leaflet.map.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/leaflet.map.js b/app/assets/javascripts/leaflet.map.js index 380955c36..4b50cc78c 100644 --- a/app/assets/javascripts/leaflet.map.js +++ b/app/assets/javascripts/leaflet.map.js @@ -211,16 +211,15 @@ L.OSM.Map = L.Map.extend({ clickable: false }; - this._object = object; - - if (this._objectLoader) this._objectLoader.abort(); - if (this._objectLayer) this.removeLayer(this._objectLayer); + this.removeObject(); var map = this; this._objectLoader = $.ajax({ url: OSM.apiUrl(object), dataType: "xml", success: function (xml) { + map._object = object; + map._objectLayer = new L.OSM.DataLayer(null, { styles: { node: objectStyle, -- 2.43.2