From 9d5ff35636afb2924b1798853398952f15eb2687 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 26 Oct 2023 17:21:45 +0200 Subject: [PATCH 1/2] Keep only non graphic props in default properties, to prevent useless redraw --- umap/static/umap/js/umap.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index b923e2b3..33c48e4f 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -1293,6 +1293,8 @@ L.U.Map.include({ 'options.fill', 'options.fillColor', 'options.fillOpacity', + 'options.smoothFactor', + 'options.dashArray', ] builder = new L.U.FormBuilder(this, shapeOptions, { @@ -1311,8 +1313,6 @@ L.U.Map.include({ _editDefaultProperties: function (container) { const optionsFields = [ - 'options.smoothFactor', - 'options.dashArray', 'options.zoomTo', ['options.easing', { handler: 'Switch', label: L._('Animated transitions') }], 'options.labelKey', @@ -1359,10 +1359,9 @@ L.U.Map.include({ builder = new L.U.FormBuilder(this, optionsFields, { callback: function (e) { this.initCaptionBar() - this.eachDataLayer((datalayer) => { - if (e.helper.field === 'options.sortKey') datalayer.reindex() - datalayer.redraw() - }) + if (e.helper.field === 'options.sortKey') { + this.eachDataLayer((datalayer) => datalayer.reindex()) + } }, }) const defaultProperties = L.DomUtil.createFieldset( From 986e70637a54ca7786de857a22f03150ba7d6ff3 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 26 Oct 2023 23:07:02 +0200 Subject: [PATCH 2/2] Prevent more useless redraw when editing global settings --- umap/static/umap/js/umap.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 33c48e4f..0365198a 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -1299,7 +1299,7 @@ L.U.Map.include({ builder = new L.U.FormBuilder(this, shapeOptions, { callback: function (e) { - this.eachDataLayer((datalayer) => { + this.eachVisibleDataLayer((datalayer) => { datalayer.redraw() }) }, @@ -1386,10 +1386,11 @@ L.U.Map.include({ if ( e.helper.field === 'options.popupTemplate' || e.helper.field === 'options.popupContentTemplate' || - e.helper.field === 'options.popupShape' + e.helper.field === 'options.popupShape' || + e.helper.field === 'options.outlinkTarget' ) return - this.eachDataLayer((datalayer) => { + this.eachVisibleDataLayer((datalayer) => { datalayer.redraw() }) },