From 1a5fcef757d2c999580fbc7e3babd8094054c253 Mon Sep 17 00:00:00 2001 From: Sudev Kiyada Date: Fri, 5 Dec 2025 16:56:17 +0530 Subject: [PATCH] expose width and height --- src/components/Lottie/Lottie.svelte | 18 ++++++++++++++++-- .../Lottie/demo/withScrollerBase.svelte | 13 +++++++++++++ src/components/Lottie/ts/types.ts | 2 ++ src/components/Lottie/ts/utils.ts | 16 ++++++++++++++++ 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/components/Lottie/Lottie.svelte b/src/components/Lottie/Lottie.svelte index a49c870f..c3c1856a 100644 --- a/src/components/Lottie/Lottie.svelte +++ b/src/components/Lottie/Lottie.svelte @@ -11,6 +11,7 @@ isReverseMode, createRenderConfig, isNullish, + isContainerWidth, } from './ts/utils'; import { Tween } from 'svelte/motion'; @@ -49,7 +50,8 @@ layout = { fit: 'contain', align: [0.5, 0.5] }, animationId = '', lottiePlayer = $bindable(undefined), - height = '100lvh', + width = 'fluid', + height = 'auto', showDebugInfo = false, lottieState = createLottieState(), progress = $bindable(0), @@ -396,7 +398,12 @@ }); -
+
{#if showDebugInfo && lottiePlayer} {/if} @@ -420,11 +427,18 @@ :global(.lottie-block) { position: relative; height: 100%; + width: 100%; + margin: 0 auto; + // to remove + border: 2px solid green; .lottie-container { width: 100%; height: 100%; + // to remove + border: 2px solid red; } + canvas { width: 100%; height: 100%; diff --git a/src/components/Lottie/demo/withScrollerBase.svelte b/src/components/Lottie/demo/withScrollerBase.svelte index c878921a..5b792e89 100644 --- a/src/components/Lottie/demo/withScrollerBase.svelte +++ b/src/components/Lottie/demo/withScrollerBase.svelte @@ -1,4 +1,5 @@ + + + +