Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
bagage committed May 24, 2021
2 parents ed4d65b + b34f885 commit 019fb15
Show file tree
Hide file tree
Showing 7 changed files with 300 additions and 250 deletions.
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,6 @@ <h4 class="modal-title" data-i18n="loadNogos.title">Load no-go areas</h4>
</button>
</div>
<div class="modal-body">
<p id="nogoError" class="invalid-feedback" style="display: none"></p>
<form name="loadNogosForm" id="loadNogosForm">
<fieldset>
<legend data-i18n="loadNogos.source">Source</legend>
Expand Down Expand Up @@ -797,6 +796,8 @@ <h4 class="modal-title" data-i18n="loadNogos.title">Load no-go areas</h4>
</form>
</div>
<div class="modal-footer">
<p id="nogoError" class="invalid-feedback" style="display: none"></p>

<button type="button" class="btn btn-secondary" data-i18n="modal.close" data-dismiss="modal">
Close
</button>
Expand Down
20 changes: 14 additions & 6 deletions js/plugin/NogoAreas.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,15 @@ BR.NogoAreas = L.Control.extend({
e.layer.toggleEdit();
});

var editTools = (this.editTools = map.editTools = new BR.Editable(map, {
circleEditorClass: BR.DeletableCircleEditor,
// FeatureGroup instead of LayerGroup to propagate events to members
editLayer: new L.FeatureGroup().addTo(map),
featuresLayer: this.drawnItems,
}));
var editTools =
(this.editTools =
map.editTools =
new BR.Editable(map, {
circleEditorClass: BR.DeletableCircleEditor,
// FeatureGroup instead of LayerGroup to propagate events to members
editLayer: new L.FeatureGroup().addTo(map),
featuresLayer: this.drawnItems,
}));

this.startDrawing = function (control) {
// initial radius of 0 to detect click, see DeletableCircleEditor.onDrawingMouseUp
Expand Down Expand Up @@ -290,6 +293,11 @@ BR.NogoAreas = L.Control.extend({
} else {
self.displayUploadError(i18next.t('loadNogos.error.loading-file-unexpected'));
}
// fire a fake empty nogos before removing layers from map
// because it will automatically refresh the URL, and that will
// fail if we do not empty nogos first
self.fire('update', { options: { nogos: [], polygons: [], polylines: [] } });
self._clear();
}
});
return false;
Expand Down
20 changes: 17 additions & 3 deletions js/plugin/POIMarkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,37 @@ BR.PoiMarkers = L.Control.extend({
markerColor: BR.conf.markerColors.poi,
});

var content = '<p>' + BR.Util.sanitizeHTMLContent(name) + '</p>';
content += "<button id='remove-poi-marker' class='btn btn-secondary'><i class='fa fa-trash'></i></button>";
var content = BR.Util.sanitizeHTMLContent(name);
var contentWithAction =
'<p>' +
content +
'</p>' +
'<p><button id="remove-poi-marker" class="btn btn-secondary"><i class="fa fa-trash"></i></button></p>';

var self = this;
var marker = L.marker(latlng, { icon: icon, draggable: true, name: name })
.bindPopup(content)
.bindPopup(contentWithAction)
.on('dragend', function () {
self.fire('update');
})
.on('popupopen', function () {
this.unbindTooltip();
$('#remove-poi-marker').on('click', function (e) {
self.markersLayer.removeLayer(marker);
e.preventDefault();
self.fire('update');
});
})
.on('popupclose', function () {
if (false === BR.Browser.touch) {
this.bindTooltip(content);
}
})
.addTo(this.markersLayer);

if (false === BR.Browser.touch) {
marker.bindTooltip(content);
}
},

clear: function () {
Expand Down
1 change: 1 addition & 0 deletions layers/config/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ BR.confLayers.tree = {
'health_food',
'ice_cream_shop',
'organic',
'supermarket',
]
},
'tourism': [
Expand Down
12 changes: 12 additions & 0 deletions layers/overpass/shop/food/supermarket.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"geometry": null,
"properties": {
"name": "Supermarket",
"id": "supermarket",
"overlay": true,
"dataSource": "OverpassAPI",
"icon": "fas-shopping-cart",
"query": "nwr[shop=supermarket];"
},
"type": "Feature"
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"bootstrap": "4.3.1",
"bootstrap-select": "1.13.18",
"bootstrap-slider": "^9.8.1",
"codemirror": "^5.35.0",
"codemirror": "^5.61.0",
"core-js-bundle": "^3.8.3",
"datatables": "~1.10.18",
"font-awesome": "^4.7.0",
Expand Down Expand Up @@ -351,6 +351,7 @@
"@fortawesome/fontawesome-free": {
"main": [
"svgs/solid/shopping-basket.svg",
"svgs/solid/shopping-cart.svg",
"svgs/solid/ice-cream.svg",
"svgs/solid/carrot.svg",
"svgs/solid/cheese.svg",
Expand Down
Loading

0 comments on commit 019fb15

Please sign in to comment.