Add loading indicator
This commit is contained in:
parent
1b60d9af73
commit
45b8b40ce8
4 changed files with 41 additions and 15 deletions
|
|
@ -224,11 +224,14 @@ input#trackname:focus:invalid {
|
|||
/* map click/drag selects text in controls in Firefox because of display flex */
|
||||
-moz-user-select: none;
|
||||
}
|
||||
.leaflet-control-container,
|
||||
#message .alert {
|
||||
.leaflet-control-container {
|
||||
-moz-user-select: text;
|
||||
}
|
||||
#message {
|
||||
#notification_jar .alert {
|
||||
-moz-user-select: text;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
#notification_jar {
|
||||
position: absolute;
|
||||
margin: 10px 46px; /* 10 + 26 + 10 */
|
||||
z-index: 3001;
|
||||
|
|
|
|||
|
|
@ -847,7 +847,10 @@
|
|||
|
||||
<div class="leaflet-sidebar-flex-row flexgrow">
|
||||
<div id="map" class="leaflet-sidebar-map">
|
||||
<div id="notification_jar">
|
||||
<div id="message"></div>
|
||||
<div id="overpass_loading_indicator"></div>
|
||||
</div>
|
||||
<div id="preview" hidden data-i18n="map.preview">Preview</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ BR.LayersConfig = L.Class.extend({
|
|||
|
||||
initialize: function (map) {
|
||||
this._map = map;
|
||||
this._overpassLoadingIndicator = new BR.Message('overpass_loading_indicator', { alert: false });
|
||||
this._overpassActiveRequestCount = 0;
|
||||
|
||||
this._addLeafletProvidersLayers();
|
||||
this._customizeLayers();
|
||||
|
|
@ -172,8 +174,20 @@ BR.LayersConfig = L.Class.extend({
|
|||
return result;
|
||||
},
|
||||
|
||||
_showOverpassLoadingIndicator: function () {
|
||||
this._overpassActiveRequestCount++;
|
||||
this._overpassLoadingIndicator.showInfo(i18next.t('layers.overpass-loading-indicator'));
|
||||
},
|
||||
|
||||
_hideOverpassLoadingIndicator: function () {
|
||||
if (--this._overpassActiveRequestCount === 0) {
|
||||
this._overpassLoadingIndicator.hide();
|
||||
}
|
||||
},
|
||||
|
||||
createOverpassLayer: function (query) {
|
||||
return new OverpassLayer({
|
||||
return Object.assign(
|
||||
new OverpassLayer({
|
||||
overpassFrontend: this.overpassFrontend,
|
||||
query: query,
|
||||
minZoom: 12,
|
||||
|
|
@ -183,7 +197,12 @@ BR.LayersConfig = L.Class.extend({
|
|||
'<table class="overpass-tags">{% for k, v in tags %}{% if k[:5] != "addr:" %}<tr><th>{{ k }}</th><td>{% if k matches "/email/" %}<a href="mailto:{{ v }}">{{ v }}</a>{% elseif v matches "/^http/" %}<a href="{{ v }}">{{ v }}</a>{% elseif v matches "/^www/" %}<a href="http://{{ v }}">{{ v }}</a>{% else %}{{ v }}{% endif %}</td></tr>{% endif %}{% endfor %}</table>',
|
||||
markerSymbol: null,
|
||||
},
|
||||
});
|
||||
}),
|
||||
{
|
||||
onLoadStart: this._showOverpassLoadingIndicator.bind(this),
|
||||
onLoadEnd: this._hideOverpassLoadingIndicator.bind(this),
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
createLayer: function (layerData) {
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@
|
|||
"custom-layer-url-label": "Custom layer URL/Query",
|
||||
"customize": "Customize layers",
|
||||
"opacity-slider": "Opacity slider",
|
||||
"overpass-loading-indicator": "Running Overpass API query ...",
|
||||
"remove-selection": "Remove selection"
|
||||
},
|
||||
"loadNogos": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue