fix: automatically update graph background on theme swtich
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { appSettings } from '$lib/settings/app-settings.svelte';
|
import { appSettings } from '$lib/settings/app-settings.svelte';
|
||||||
import { T } from '@threlte/core';
|
import { T, useThrelte } from '@threlte/core';
|
||||||
import { colors } from '../graph/colors.svelte';
|
import { colors } from '../graph/colors.svelte';
|
||||||
import BackgroundFrag from './Background.frag';
|
import BackgroundFrag from './Background.frag';
|
||||||
import BackgroundVert from './Background.vert';
|
import BackgroundVert from './Background.vert';
|
||||||
|
|
||||||
|
const { invalidate } = useThrelte();
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
minZoom?: number;
|
minZoom?: number;
|
||||||
maxZoom?: number;
|
maxZoom?: number;
|
||||||
@@ -33,9 +35,16 @@
|
|||||||
|
|
||||||
let bw = $derived(width / cameraPosition[2]);
|
let bw = $derived(width / cameraPosition[2]);
|
||||||
let bh = $derived(height / cameraPosition[2]);
|
let bh = $derived(height / cameraPosition[2]);
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (appSettings.value.theme) {
|
||||||
|
setTimeout(() => invalidate(), 10);
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<T.Group
|
<T.Group
|
||||||
|
visible={!appSettings.value.theme.includes('contrast')}
|
||||||
position.x={cameraPosition[0]}
|
position.x={cameraPosition[0]}
|
||||||
position.z={cameraPosition[1]}
|
position.z={cameraPosition[1]}
|
||||||
position.y={-1.0}
|
position.y={-1.0}
|
||||||
|
|||||||
Reference in New Issue
Block a user