demos working

This commit is contained in:
MinamiFunakoshiTR 2025-03-26 12:01:46 -07:00
parent 1e4e5792e6
commit b9bd642cbf
Failed to extract signature

View file

@ -107,8 +107,8 @@
// For intersection observer // For intersection observer
let intersecting = $state(false); let intersecting = $state(false);
let element: HTMLElement = $state(new HTMLElement()); // ; | null let element: HTMLElement | undefined = $state(undefined); // ; | null
let videoElement: HTMLVideoElement = $state(new HTMLVideoElement()); let videoElement: HTMLVideoElement | undefined = $state(undefined);
// For video with sound, check if there has been an interaction with the DOM // For video with sound, check if there has been an interaction with the DOM
let interactedWithDom = false; let interactedWithDom = false;
@ -118,6 +118,7 @@
let interactiveControlsOpacity = $state(controlsOpacity); let interactiveControlsOpacity = $state(controlsOpacity);
/** Control play/pause */
$effect(() => { $effect(() => {
// Play the video (with no sound) if it's intersecting; pause when it's no longer intersecting // Play the video (with no sound) if it's intersecting; pause when it's no longer intersecting
if (playVideoWhenInView && intersecting && muteVideo) paused = false; if (playVideoWhenInView && intersecting && muteVideo) paused = false;
@ -141,7 +142,7 @@
}); });
// To get the pause state passed up from the Controls // To get the pause state passed up from the Controls
const pausePlayEvent = (e) => { const pausePlayEvent = (e: CustomEvent) => {
const fwdPaused = e.detail.paused; const fwdPaused = e.detail.paused;
const fwdClickedOnPauseBtn = e.detail.clickedOnPauseBtn; const fwdClickedOnPauseBtn = e.detail.clickedOnPauseBtn;
paused = fwdPaused; paused = fwdPaused;
@ -317,8 +318,8 @@
{/if} {/if}
{/if} {/if}
</div> </div>
{#if notes} {#if notes && typeof notes !== 'string'}
<!-- Custom notes and source slot --> <!-- Custom notes and source slot -->
<slot name="notes" /> {@render notes()}
{/if} {/if}
</GraphicBlock> </GraphicBlock>