Skip to content

Commit 3edd733

Browse files
committed
controls only show fullscreen button on mobile marker popup view
1 parent 64a41fe commit 3edd733

File tree

1 file changed

+33
-29
lines changed

1 file changed

+33
-29
lines changed

src/svelte/components/Controls.svelte

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
const micrio = $state(<HTMLMicrioElement>getContext('micrio'));
4343
/** Destructure needed stores and properties from the micrio instance. */
4444
const { current, state: micrioState, isMuted, _lang } = micrio;
45-
/** Reference to the active tour store. */
46-
const tour = micrioState.tour;
45+
/** Reference to the active tour and popup store. */
46+
const { tour, popup } = micrioState;
4747
/** Destructure UI state stores. */
4848
const { controls, zoom, hidden } = micrio.state.ui;
4949
@@ -162,45 +162,49 @@
162162
const hasFullscreen = $derived(showFullscreen && !isActiveSerialTour);
163163
/** Determine if the entire controls container should be shown. */
164164
const hasControls = $derived($controls && !$hidden && (showMute || hasCultures || hasSocial || $zoom || hasFullscreen));
165+
/** Show only fullscreen button when having popup on mobile screen */
166+
const onlyFullscreen = $derived($popup && micrio.canvas.$isMobile);
165167
166168
</script>
167169

168170
<!-- Render the controls container only if `hasControls` is true -->
169171
{#if hasControls}
170172
<aside>
171-
<!-- Mute Button -->
172-
{#if showMute}
173-
<Button
174-
type={$isMuted ? 'volume-off' : 'volume-up'}
175-
title={$isMuted ? $i18n.audioUnmute : $i18n.audioMute}
176-
onclick={() => isMuted.set(!$isMuted)}
177-
/>
178-
{/if}
173+
{#if !onlyFullscreen}
174+
<!-- Mute Button -->
175+
{#if showMute}
176+
<Button
177+
type={$isMuted ? 'volume-off' : 'volume-up'}
178+
title={$isMuted ? $i18n.audioUnmute : $i18n.audioMute}
179+
onclick={() => isMuted.set(!$isMuted)}
180+
/>
181+
{/if}
179182

180-
<!-- Language Switch Menu -->
181-
{#if hasCultures}
182-
<menu class="popout">
183-
<Button title={$i18n.switchLanguage} type="a11y" /><!-- Accessibility icon -->
184-
{#each cultures as l}
185-
<Button
186-
onclick={() => micrio.lang = l}
187-
title={languageNames?.of(l) ?? l}
188-
active={l==$_lang}
189-
>
190-
{l.toUpperCase()}
191-
</Button>
192-
{/each}
193-
</menu>
194-
{/if}
183+
<!-- Language Switch Menu -->
184+
{#if hasCultures}
185+
<menu class="popout">
186+
<Button title={$i18n.switchLanguage} type="a11y" /><!-- Accessibility icon -->
187+
{#each cultures as l}
188+
<Button
189+
onclick={() => micrio.lang = l}
190+
title={languageNames?.of(l) ?? l}
191+
active={l==$_lang}
192+
>
193+
{l.toUpperCase()}
194+
</Button>
195+
{/each}
196+
</menu>
197+
{/if}
195198

196-
<!-- Share Button -->
197-
{#if hasSocial}
198-
<Button type="share" title={$i18n.share} onclick={share} />
199+
<!-- Share Button -->
200+
{#if hasSocial}
201+
<Button type="share" title={$i18n.share} onclick={share} />
202+
{/if}
199203
{/if}
200204

201205
<!-- Zoom and Fullscreen Buttons -->
202206
<ButtonGroup>
203-
{#if $zoom}
207+
{#if $zoom && !onlyFullscreen}
204208
<!-- Render secondary zoom controls if active, otherwise primary -->
205209
{#if secondaryControls}
206210
<ZoomButtons image={secondaryControls} />

0 commit comments

Comments
 (0)