Fix map not loading due to invalid tile layer name

This commit is contained in:
Eugene Burmakin 2024-09-16 20:52:51 +02:00
parent caa77be67f
commit 548d0b0e7a
6 changed files with 13 additions and 13 deletions

View file

@ -1 +1 @@
0.14.0
0.14.1

View file

@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.14.1] — 2024-09-16
### Fixed
- Fixed a bug where the map was not loading due to invalid tile layer name
## [0.14.0] — 2024-09-15
### Added

File diff suppressed because one or more lines are too long

View file

@ -12,10 +12,8 @@ export default class extends Controller {
toggleChildren() {
if (this.parentTarget.checked) {
this.childTargets.map(x => x.checked = true)
console.log('toggleChildrenChecked')
} else {
this.childTargets.map(x => x.checked = false)
console.log('toggleChildrenUNChecked')
}
}

View file

@ -137,7 +137,7 @@ export default class extends Controller {
baseMaps() {
let selectedLayerName = this.userSettings.preferred_map_layer || "OpenStreetMap";
console.log(selectedLayerName);
return {
OpenStreetMap: osmMapLayer(this.map, selectedLayerName),
"OpenStreetMap.HOT": osmHotMapLayer(this.map, selectedLayerName),
@ -250,9 +250,6 @@ export default class extends Controller {
return response.json();
})
.then(data => {
console.log('Point deleted:', data);
// Remove the marker from the map
this.removeMarker(id);
})
.catch(error => {
@ -348,7 +345,7 @@ export default class extends Controller {
<b>Duration:</b> ${timeOnRoute}<br>
<b>Total Distance:</b> ${formatDistance(totalDistance, this.distanceUnit)}<br>
`;
console.log(this.distanceUnit);
if (isDebugMode) {
const prevPoint = polylineCoordinates[0];
const nextPoint = polylineCoordinates[polylineCoordinates.length - 1];
@ -578,7 +575,6 @@ console.log(this.distanceUnit);
return response.json();
})
.then(data => {
console.log('Area deleted:', data);
this.areasLayer.removeLayer(layer); // Remove the layer from the areas layer group
})
.catch(error => {
@ -638,7 +634,6 @@ console.log(this.distanceUnit);
addSettingsButton() {
if (this.settingsButtonAdded) return;
console.log('Adding settings button');
// Define the custom control
const SettingsControl = L.Control.extend({
onAdd: (map) => {

View file

@ -1,7 +1,7 @@
// Yeah I know it should be DRY but this is me doing a KISS at 21:00 on a Sunday night
export function osmMapLayer(map, selectedLayerName) {
let layerName = 'osm';
let layerName = 'OpenStreetMap';
let layer = L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
maxZoom: 19,
@ -16,7 +16,7 @@ export function osmMapLayer(map, selectedLayerName) {
}
export function osmHotMapLayer(map, selectedLayerName) {
let layerName = 'osmHot';
let layerName = "OpenStreetMap.HOT";
let layer = L.tileLayer("https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png", {
maxZoom: 19,
attribution: "© OpenStreetMap contributors, Tiles style by Humanitarian OpenStreetMap Team hosted by OpenStreetMap France",