From 5609092cc00087328795019e36fd74b630cd29c1 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 21 Jun 2024 11:39:39 +0200 Subject: [PATCH] chore: do not set overlay=null as default FormBuilder will break when reimporting an exported map with this default value (at the casting to object was only made on the init, so reimporting will override this to null again). --- umap/static/umap/js/umap.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index f91f2461..9bed8f8f 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -1,5 +1,5 @@ L.Map.mergeOptions({ - overlay: null, + overlay: {}, datalayers: [], hash: true, maxZoomLimit: 24, @@ -205,12 +205,6 @@ U.Map = L.Map.extend({ this.editTools = new U.Editable(this) this.renderEditToolbar() } - if (!U.Utils.isObject(this.options.overlay)) { - this.options.overlay = {} - } - if (!U.Utils.isObject(this.options.tilelayer)) { - this.options.tilelayer = {} - } this.initShortcuts() this.onceDataLoaded(function () { @@ -1296,6 +1290,9 @@ U.Map = L.Map.extend({ }, _editTilelayer: function (container) { + if (!U.Utils.isObject(this.options.tilelayer)) { + this.options.tilelayer = {} + } const tilelayerFields = [ [ 'options.tilelayer.name', @@ -1343,6 +1340,9 @@ U.Map = L.Map.extend({ }, _editOverlay: function (container) { + if (!U.Utils.isObject(this.options.overlay)) { + this.options.overlay = {} + } const overlayFields = [ [ 'options.overlay.url_template',