mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-11-04 13:31:13 +00:00
fix layer control
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
import { map } from '$lib/components/map/map';
|
import { map } from '$lib/components/map/map';
|
||||||
import { customBasemapUpdate, getLayers } from './utils';
|
import { customBasemapUpdate, getLayers } from './utils';
|
||||||
import type { ImportSpecification, StyleSpecification } from 'mapbox-gl';
|
import type { ImportSpecification, StyleSpecification } from 'mapbox-gl';
|
||||||
|
import { untrack } from 'svelte';
|
||||||
|
|
||||||
let container: HTMLDivElement;
|
let container: HTMLDivElement;
|
||||||
let overpassLayer: OverpassLayer;
|
let overpassLayer: OverpassLayer;
|
||||||
@@ -50,7 +51,7 @@
|
|||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if ($map && ($currentBasemap || $customBasemapUpdate)) {
|
if ($map && ($currentBasemap || $customBasemapUpdate)) {
|
||||||
setStyle();
|
untrack(() => setStyle());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -127,7 +128,7 @@
|
|||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if ($map && $currentOverlays && $opacities) {
|
if ($map && $currentOverlays && $opacities) {
|
||||||
updateOverlays();
|
untrack(() => updateOverlays());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -137,7 +138,12 @@
|
|||||||
}
|
}
|
||||||
overpassLayer = new OverpassLayer(_map);
|
overpassLayer = new OverpassLayer(_map);
|
||||||
overpassLayer.add();
|
overpassLayer.add();
|
||||||
_map.on('style.import.load', updateOverlays);
|
let first = true;
|
||||||
|
_map.on('style.import.load', () => {
|
||||||
|
if (!first) return;
|
||||||
|
first = false;
|
||||||
|
updateOverlays();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
let open = $state(false);
|
let open = $state(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user