diff --git a/src/routes/DiscordProfilePicture.svelte b/src/routes/DiscordProfilePicture.svelte index 3781756..d039b38 100755 --- a/src/routes/DiscordProfilePicture.svelte +++ b/src/routes/DiscordProfilePicture.svelte @@ -3,7 +3,7 @@ import { createEventDispatcher, getContext, onDestroy, onMount } from 'svelte' import { spring } from 'svelte/motion' import { contextId as ctxId } from './CommunitySlice.svelte' - import { getIsMobile, lerp } from '$lib/Helper.mjs' + import { lerp } from '$lib/Helper.mjs' import { inview } from 'svelte-inview' /** @type {string} */ @@ -34,8 +34,10 @@ precision: 0.001 }) + /** @type {HTMLImageElement}*/ let imageElement let hasEnteredView = false + let hasImageLoaded = false /** @type {import('interactjs').default} */ let interactionjs @@ -72,11 +74,20 @@ }) } + onMount(() => { + // Nesecarry as the load image load event might not get fired when its already loaded + hasImageLoaded = hasImageLoaded || imageElement.complete + }) + onDestroy(() => interactionjs?.off())