From e91ff4fdc02bc624956d06a63ab1a098491401c5 Mon Sep 17 00:00:00 2001 From: PON Date: Thu, 27 Jul 2023 16:08:55 +0200 Subject: [PATCH 1/2] Fix attribution mark issue --- .../mapentity/leaflet.informationcontrol.js | 35 ------------------- mapentity/static/mapentity/mapentity.forms.js | 28 --------------- mapentity/static/mapentity/mapentity.map.js | 3 -- mapentity/static/mapentity/style.css | 4 --- 4 files changed, 70 deletions(-) delete mode 100644 mapentity/static/mapentity/leaflet.informationcontrol.js diff --git a/mapentity/static/mapentity/leaflet.informationcontrol.js b/mapentity/static/mapentity/leaflet.informationcontrol.js deleted file mode 100644 index 9e708d69c..000000000 --- a/mapentity/static/mapentity/leaflet.informationcontrol.js +++ /dev/null @@ -1,35 +0,0 @@ -L.Control.Information = L.Control.extend({ - options: { - position: 'bottomright', - }, - - onAdd: function (map) { - this._container = L.DomUtil.create('div', 'leaflet-control-information leaflet-control-attribution'); - L.DomEvent.disableClickPropagation(this._container); - - map.on('layeradd', this._onLayerAdd, this) - .on('layerremove', this._onLayerRemove, this); - - return this._container; - }, - - onRemove: function (map) { - map.off('layeradd', this._onLayerAdd) - .off('layerremove', this._onLayerRemove); - - }, - - _onLayerAdd: function (e) { - if (e.layer && e.layer.on) { - e.layer.on('info', L.Util.bind(function (ei) { - this._container.innerHTML = ei.info; - }, this)); - } - }, - - _onLayerRemove: function (e) { - if (e.layer && e.layer.off) { - e.layer.off('info'); - } - } -}); diff --git a/mapentity/static/mapentity/mapentity.forms.js b/mapentity/static/mapentity/mapentity.forms.js index a1eb7437b..489877f35 100644 --- a/mapentity/static/mapentity/mapentity.forms.js +++ b/mapentity/static/mapentity/mapentity.forms.js @@ -37,34 +37,6 @@ MapEntity.GeometryField = L.GeometryField.extend({ this._addExtraLayers(map); }, - _addExtraControls: function (map) { - if (map.attributionControl._map) { - map.removeControl(map.attributionControl); - } - map.addControl(new L.Control.ResetView(this._getResetBounds.bind(this))); - - /* - * Allow to load files locally. - */ - var pointToLayer = function (feature, latlng) { - return L.circleMarker(latlng, {style: window.SETTINGS.map.styles.filelayer}) - .setRadius(window.SETTINGS.map.styles.filelayer.radius); - }, - onEachFeature = function (feature, layer) { - if (feature.properties.name) { - layer.bindLabel(feature.properties.name); - } - }, - filecontrol = L.Control.fileLayerLoad({ - fitBounds: true, - layerOptions: {style: window.SETTINGS.map.styles.filelayer, - pointToLayer: pointToLayer, - onEachFeature: onEachFeature} - }); - map.filecontrol = filecontrol; - map.addControl(filecontrol); - }, - _addExtraLayers: function (map) { // Layer with objects of same type var objectsLayer = this.buildObjectsLayer(); diff --git a/mapentity/static/mapentity/mapentity.map.js b/mapentity/static/mapentity/mapentity.map.js index 5ca27822b..dc71836f7 100644 --- a/mapentity/static/mapentity/mapentity.map.js +++ b/mapentity/static/mapentity/mapentity.map.js @@ -123,8 +123,6 @@ $(window).on('entity:map', function (e, data) { map.boxZoom.disable(); } - map.attributionControl.setPrefix(''); - var mapBounds = $container.data('mapextent'); if (mapBounds) { map.fitBounds(mapBounds); @@ -231,7 +229,6 @@ $(window).on('entity:map:list', function (e, data) { var map = data.map, bounds = L.latLngBounds(data.options.extent); - map.removeControl(map.attributionControl); map.doubleClickZoom.disable(); map.addControl(new L.Control.Information()); diff --git a/mapentity/static/mapentity/style.css b/mapentity/static/mapentity/style.css index 4bbf89b9d..2483e5a74 100644 --- a/mapentity/static/mapentity/style.css +++ b/mapentity/static/mapentity/style.css @@ -650,10 +650,6 @@ span.filter-info { background-color: rgba(240, 240, 240, 0.5); } -.map-panel .leaflet-control-attribution { - display: none; -} - .map-panel .leaflet-control-information { display: block; } From 93ab4022c3888b21bb8f5f3671b95cf930efef5a Mon Sep 17 00:00:00 2001 From: PON Date: Mon, 31 Jul 2023 10:23:12 +0200 Subject: [PATCH 2/2] Add changelog entry --- CHANGES.md | 2 +- mapentity/templates/mapentity/base.html | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index be9aabd16..d20b48ee3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,7 +4,7 @@ CHANGELOG 8.5.4+dev (20XX-XX-XX) ---------------------------- -- +- Fix hidden base layer attributions (#271) 8.5.4 (2023-07-03) ----------------------- diff --git a/mapentity/templates/mapentity/base.html b/mapentity/templates/mapentity/base.html index 845cf0e28..040b397f7 100644 --- a/mapentity/templates/mapentity/base.html +++ b/mapentity/templates/mapentity/base.html @@ -165,7 +165,6 @@ -