mirror of
				https://github.com/gpxstudio/gpx.studio.git
				synced 2025-11-04 05:21:09 +00:00 
			
		
		
		
	temporary fix for #129
This commit is contained in:
		@@ -1,11 +1,11 @@
 | 
			
		||||
import { TramFront, Utensils, ShoppingBasket, Droplet, ShowerHead, Fuel, CircleParking, Fence, FerrisWheel, Bed, Mountain, Pickaxe, Store, TrainFront, Bus, Ship, Croissant, House, Tent, Wrench, Binoculars } from 'lucide-static';
 | 
			
		||||
import { type Style } from 'mapbox-gl';
 | 
			
		||||
import { type StyleSpecification } from 'mapbox-gl';
 | 
			
		||||
import ignFrTopo from './custom/ign-fr-topo.json';
 | 
			
		||||
import ignFrPlan from './custom/ign-fr-plan.json';
 | 
			
		||||
import ignFrSatellite from './custom/ign-fr-satellite.json';
 | 
			
		||||
import bikerouterGravel from './custom/bikerouter-gravel.json';
 | 
			
		||||
 | 
			
		||||
export const basemaps: { [key: string]: string | Style; } = {
 | 
			
		||||
export const basemaps: { [key: string]: string | StyleSpecification; } = {
 | 
			
		||||
    mapboxOutdoors: 'mapbox://styles/mapbox/outdoors-v12',
 | 
			
		||||
    mapboxSatellite: 'mapbox://styles/mapbox/satellite-streets-v12',
 | 
			
		||||
    openStreetMap: {
 | 
			
		||||
@@ -286,7 +286,7 @@ export const basemaps: { [key: string]: string | Style; } = {
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const overlays: { [key: string]: string | Style; } = {
 | 
			
		||||
export const overlays: { [key: string]: string | StyleSpecification; } = {
 | 
			
		||||
    cyclOSMlite: {
 | 
			
		||||
        version: 8,
 | 
			
		||||
        sources: {
 | 
			
		||||
 
 | 
			
		||||
@@ -50,6 +50,20 @@
 | 
			
		||||
			language = 'en';
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		const loadJson = mapboxgl.Style.prototype._load;
 | 
			
		||||
		mapboxgl.Style.prototype._load = function (json, validate) {
 | 
			
		||||
			if (
 | 
			
		||||
				json['sources'] &&
 | 
			
		||||
				json['sources']['mapbox-satellite'] &&
 | 
			
		||||
				json['sources']['mapbox-satellite']['data'] &&
 | 
			
		||||
				json['sources']['mapbox-satellite']['data']['data']
 | 
			
		||||
			) {
 | 
			
		||||
				// Temporary fix for https://github.com/gpxstudio/gpx.studio/issues/129
 | 
			
		||||
				delete json['sources']['mapbox-satellite']['data']['data'];
 | 
			
		||||
			}
 | 
			
		||||
			loadJson.call(this, json, validate);
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		let newMap = new mapboxgl.Map({
 | 
			
		||||
			container: 'map',
 | 
			
		||||
			style: {
 | 
			
		||||
 
 | 
			
		||||
@@ -130,7 +130,9 @@
 | 
			
		||||
	});
 | 
			
		||||
	currentBasemap.subscribe((value) => {
 | 
			
		||||
		// Updates coming from the database, or from the user swapping basemaps
 | 
			
		||||
		selectedBasemap.set(value);
 | 
			
		||||
		if (value !== get(selectedBasemap)) {
 | 
			
		||||
			selectedBasemap.set(value);
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	let open = false;
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,6 @@ import { updateAnchorPoints } from '$lib/components/toolbar/tools/routing/Simpli
 | 
			
		||||
import { SplitType } from '$lib/components/toolbar/tools/scissors/Scissors.svelte';
 | 
			
		||||
import { getClosestLinePoint, getElevation } from '$lib/utils';
 | 
			
		||||
import { browser } from '$app/environment';
 | 
			
		||||
import type mapboxgl from 'mapbox-gl';
 | 
			
		||||
 | 
			
		||||
enableMapSet();
 | 
			
		||||
enablePatches();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user