Skip to content

Commit

Permalink
HotFix width after initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
yustarandomname committed Oct 4, 2024
1 parent f686ff1 commit 37bca42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/components/Scene.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { activityState } from '$lib/stores/activity.svelte';
import { globalState } from '$lib/stores/globalState.svelte';
import type { Formula } from '$lib/utils/Formulas';
import { onMount, type Snippet, tick } from 'svelte';
import type { Snippet } from 'svelte';
import ActionButtonsAndFormula from './ActionButtonsAndFormula.svelte';
import ActivityPanel from './ActivityPanel.svelte';
import ControllerAndActivityPanel from './ControllerAndActivityPanel.svelte';
Expand All @@ -33,7 +33,7 @@
}: SceneProps = $props();
let height = $state(500);
let width = $state(500);
let width = $state<number>(0);
/**
* Reset camera position, rotation and controls.
Expand Down Expand Up @@ -108,7 +108,7 @@
>
<!-- MARK: THRELTE/D3 SCENE (centre) -->
<div class="flex w-full h-full divide-x-2 divide-slate-400 gap-3 bg-white">
{#if sceneChildren}
{#if sceneChildren && width > 0}
{@render sceneChildren(width, height)}
{:else}
<p class="m-4">Please enter some content using the Canvas2D or Canvas3D components</p>
Expand Down
1 change: 1 addition & 0 deletions src/lib/threlte/Canvas3D.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
{#if confettiState.side === 'left' || confettiState.side === 'center'}
<Confetti isSplit={false} />
{/if}

<Canvas {renderMode} toneMapping={NoToneMapping}>
<Camera3D {cameraPosition} {cameraZoom} {enablePan} />

Expand Down

0 comments on commit 37bca42

Please sign in to comment.