Merge pull request #804 from Freika/fix/deleting-point-after-point

Fix deleting points
This commit is contained in:
Evgenii Burmakin 2025-02-06 20:19:40 +01:00 committed by GitHub
commit 75600325ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 11 deletions

View file

@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
## 0.23.7 - 2025-02-06 # 0.23.7 - 2025-02-06
### Fixed
- After deleting one point from the map, other points can now be deleted as well. #723
### Added ### Added

File diff suppressed because one or more lines are too long

View file

@ -454,6 +454,9 @@ export default class extends Controller {
return response.json(); return response.json();
}) })
.then(data => { .then(data => {
// Show success message
showFlashMessage('notice', 'Point was successfully deleted');
// Remove the marker and update all layers // Remove the marker and update all layers
this.removeMarker(id); this.removeMarker(id);
let wasPolyLayerVisible = false; let wasPolyLayerVisible = false;
@ -463,7 +466,6 @@ export default class extends Controller {
wasPolyLayerVisible = true; wasPolyLayerVisible = true;
} }
this.map.removeLayer(this.polylinesLayer); this.map.removeLayer(this.polylinesLayer);
} }
// Create new polylines layer // Create new polylines layer
@ -485,17 +487,16 @@ export default class extends Controller {
if (this.layerControl) { if (this.layerControl) {
this.map.removeControl(this.layerControl); this.map.removeControl(this.layerControl);
const controlsLayer = { const controlsLayer = {
Points: this.markersLayer, Points: this.markersLayer || L.layerGroup(),
Routes: this.polylinesLayer, Routes: this.polylinesLayer || L.layerGroup(),
Heatmap: this.heatmapLayer, Heatmap: this.heatmapLayer || L.heatLayer([]),
"Fog of War": this.fogOverlay, "Fog of War": new this.fogOverlay(),
"Scratch map": this.scratchLayer, "Scratch map": this.scratchLayer || L.layerGroup(),
Areas: this.areasLayer, Areas: this.areasLayer || L.layerGroup(),
Photos: this.photoMarkers Photos: this.photoMarkers || L.layerGroup()
}; };
this.layerControl = L.control.layers(this.baseMaps(), controlsLayer).addTo(this.map); this.layerControl = L.control.layers(this.baseMaps(), controlsLayer).addTo(this.map);
} }
// Update heatmap // Update heatmap
this.heatmapLayer.setLatLngs(this.markers.map(marker => [marker[0], marker[1], 0.2])); this.heatmapLayer.setLatLngs(this.markers.map(marker => [marker[0], marker[1], 0.2]));