diff --git a/umap/static/umap/js/umap.browser.js b/umap/static/umap/js/umap.browser.js index 9212ada7..77c3049d 100644 --- a/umap/static/umap/js/umap.browser.js +++ b/umap/static/umap/js/umap.browser.js @@ -62,6 +62,8 @@ L.U.Browser = L.Class.extend({ container.id = `browse_data_datalayer_${datalayer.umap_id}` datalayer.renderToolbox(headline) L.DomUtil.add('span', '', headline, datalayer.options.name) + const counter = L.DomUtil.add('span', 'datalayer-counter', headline, datalayer.count()) + counter.title = L._('{count} features in this layer', {count: datalayer.count()}) const ul = L.DomUtil.create('ul', '', container) L.DomUtil.classIf(container, 'off', !datalayer.isVisible()) diff --git a/umap/static/umap/js/umap.layer.js b/umap/static/umap/js/umap.layer.js index 0f47df7b..b30241e9 100644 --- a/umap/static/umap/js/umap.layer.js +++ b/umap/static/umap/js/umap.layer.js @@ -1482,6 +1482,10 @@ L.U.DataLayer = L.Evented.extend({ return !!this.options.browsable && this.canBrowse() && this.isVisible() }, + count: function () { + return this._index.length + }, + hasData: function () { return !!this._index.length }, diff --git a/umap/static/umap/map.css b/umap/static/umap/map.css index 17fa57d6..e34e1751 100644 --- a/umap/static/umap/map.css +++ b/umap/static/umap/map.css @@ -1086,11 +1086,14 @@ a.add-datalayer:hover, .umap-edit-enabled .show-on-edit.block { display: block!important; } - .umap-browse-description { font-size: 0.9em; margin-bottom: 14px; } +.datalayer-counter { + float: right; + margin-right: 5px; +} /* ********************************* */