mirror of
https://github.com/Freika/dawarich.git
synced 2026-04-22 03:00:29 -04:00
Merge pull request #552 from tabacha/2024-12-16_make_polyline_visible_only_if_it_was
On Map Point delete: Hide Polyline Layer, if it was hidden before
This commit is contained in:
@@ -382,10 +382,14 @@ export default class extends Controller {
|
||||
.then(data => {
|
||||
// Remove the marker and update all layers
|
||||
this.removeMarker(id);
|
||||
|
||||
let wasPolyLayerVisible = false;
|
||||
// Explicitly remove old polylines layer from map
|
||||
if (this.polylinesLayer) {
|
||||
if (this.map.hasLayer(this.polylinesLayer)) {
|
||||
wasPolyLayerVisible = true;
|
||||
}
|
||||
this.map.removeLayer(this.polylinesLayer);
|
||||
|
||||
}
|
||||
|
||||
// Create new polylines layer
|
||||
@@ -397,10 +401,12 @@ export default class extends Controller {
|
||||
this.userSettings,
|
||||
this.distanceUnit
|
||||
);
|
||||
|
||||
// Add new polylines layer to map and to layer control
|
||||
this.polylinesLayer.addTo(this.map);
|
||||
|
||||
if (wasPolyLayerVisible) {
|
||||
// Add new polylines layer to map and to layer control
|
||||
this.polylinesLayer.addTo(this.map);
|
||||
} else {
|
||||
this.map.removeLayer(this.polylinesLayer);
|
||||
}
|
||||
// Update the layer control
|
||||
if (this.layerControl) {
|
||||
this.map.removeControl(this.layerControl);
|
||||
|
||||
Reference in New Issue
Block a user