From f8d2ecdd32196d3ccc402548cb42dfa7701ffea8 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Wed, 29 Nov 2023 16:15:33 +0100 Subject: [PATCH] Use map style options to style minimap bbox rectangle Ref: https://forum.openstreetmap.fr/t/option-dexport-mini-carte/19223/6 --- umap/static/umap/js/umap.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 48944b51..58233552 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -368,9 +368,17 @@ L.U.Map.include({ if (this.options.miniMap && !this.options.noControl) { this.whenReady(function () { if (this.selected_tilelayer) { - this._controls.miniMap = new L.Control.MiniMap(this.selected_tilelayer).addTo( - this - ) + this._controls.miniMap = new L.Control.MiniMap(this.selected_tilelayer, { + aimingRectOptions: { + color: this.getOption('color'), + fillColor: this.getOption('fillColor'), + stroke: this.getOption('stroke'), + fill: this.getOption('fill'), + weight: this.getOption('weight'), + opacity: this.getOption('opacity'), + fillOpacity: this.getOption('fillOpacity'), + }, + }).addTo(this) this._controls.miniMap._miniMap.invalidateSize() } }) @@ -1304,6 +1312,7 @@ L.U.Map.include({ builder = new L.U.FormBuilder(this, shapeOptions, { callback: function (e) { + if (this._controls.miniMap) this.renderControls() this.eachVisibleDataLayer((datalayer) => { datalayer.redraw() })