mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-08-31 23:53:25 +00:00
fix map loaded twice
This commit is contained in:
@@ -148,16 +148,15 @@
|
||||
</script>
|
||||
|
||||
<div {...$$restProps}>
|
||||
{#if webgl2Supported}
|
||||
<div id="map" class="h-full"></div>
|
||||
{:else}
|
||||
<div class="flex flex-col items-center justify-center gap-3 h-full">
|
||||
<p>{$_('webgl2_required')}</p>
|
||||
<Button href="https://get.webgl.org/webgl2/" target="_blank">
|
||||
{$_('enable_webgl2')}
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
<div id="map" class="h-full {webgl2Supported ? '' : 'hidden'}"></div>
|
||||
<div
|
||||
class="flex flex-col items-center justify-center gap-3 h-full {webgl2Supported ? 'hidden' : ''}"
|
||||
>
|
||||
<p>{$_('webgl2_required')}</p>
|
||||
<Button href="https://get.webgl.org/webgl2/" target="_blank">
|
||||
{$_('enable_webgl2')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="postcss">
|
||||
|
@@ -4,13 +4,16 @@
|
||||
|
||||
export let position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' = 'top-right';
|
||||
|
||||
let container: HTMLDivElement | null = null;
|
||||
let container: HTMLDivElement;
|
||||
let control: CustomControl | undefined = undefined;
|
||||
|
||||
$: if ($map && container) {
|
||||
if (position.includes('right')) container.classList.add('float-right');
|
||||
else container.classList.add('float-left');
|
||||
container.classList.remove('hidden');
|
||||
let control = new CustomControl(container);
|
||||
if (control === undefined) {
|
||||
control = new CustomControl(container);
|
||||
}
|
||||
$map.addControl(control, position);
|
||||
}
|
||||
</script>
|
||||
|
@@ -13,19 +13,21 @@
|
||||
}
|
||||
|
||||
const appRoutes = ['/[...language]/app', '/[...language]/embed'];
|
||||
|
||||
$: showNavAndFooter = $page.route.id === null || !appRoutes.includes($page.route.id);
|
||||
</script>
|
||||
|
||||
<Head />
|
||||
<ModeWatcher />
|
||||
|
||||
{#if !$isLoading}
|
||||
{#if $page.route.id !== null && appRoutes.includes($page.route.id)}
|
||||
<slot />
|
||||
{:else}
|
||||
{#if showNavAndFooter}
|
||||
<Nav />
|
||||
<main>
|
||||
<slot />
|
||||
</main>
|
||||
{/if}
|
||||
<main>
|
||||
<slot />
|
||||
</main>
|
||||
{#if showNavAndFooter}
|
||||
<Footer />
|
||||
{/if}
|
||||
{/if}
|
||||
|
Reference in New Issue
Block a user