nodes/frontend/src/routes/+page.svelte

74 lines
1.6 KiB
Svelte
Raw Normal View History

2024-03-06 14:01:07 +01:00
<script lang="ts">
import { invoke } from "@tauri-apps/api/core";
import { onMount } from "svelte";
import { PerfMonitor } from "@threlte/extras";
2024-03-06 18:31:06 +01:00
import { Canvas } from "@threlte/core";
import { GraphManager } from "$lib/graph-manager";
2024-03-11 19:37:58 +01:00
import Graph from "$lib/components/graph/Graph.svelte";
2024-03-13 14:30:30 +01:00
import Details from "$lib/elements/Details.svelte";
import { JsonView } from "@zerodevx/svelte-json-view";
2024-03-06 18:31:06 +01:00
2024-03-11 22:00:16 +01:00
const graph = GraphManager.createEmptyGraph({ width: 12, height: 12 });
2024-03-06 18:31:06 +01:00
graph.load();
2024-03-13 14:30:30 +01:00
let debug: undefined;
// onMount(async () => {
// try {
// const res = await invoke("greet", { name: "Dude" });
// console.log({ res });
// } catch (error) {
// console.log(error);
// }
//
// try {
// const res2 = await invoke("run_nodes", {});
// console.log({ res2 });
// } catch (error) {
// console.log(error);
// }
// });
2024-03-06 14:01:07 +01:00
</script>
2024-03-13 14:30:30 +01:00
<div class="wrapper">
<Details>
<JsonView json={debug} />
</Details>
</div>
<div class="canvas-wrapper">
2024-03-14 16:28:38 +01:00
<Canvas shadows={false} renderMode="on-demand" colorManagementEnabled={false}>
<!-- <PerfMonitor /> -->
2024-03-13 14:30:30 +01:00
<Graph {graph} bind:debug />
2024-03-06 18:31:06 +01:00
</Canvas>
2024-03-06 14:01:07 +01:00
</div>
<style>
2024-03-13 14:30:30 +01:00
.wrapper {
position: absolute;
z-index: 100;
top: 10px;
left: 10px;
}
.canvas-wrapper {
2024-03-06 14:01:07 +01:00
height: 100vh;
}
:global(html) {
background: rgb(13, 19, 32);
background: linear-gradient(
180deg,
rgba(13, 19, 32, 1) 0%,
rgba(8, 12, 21, 1) 100%
);
}
:global(body) {
margin: 0;
position: relative;
width: 100vw;
height: 100vh;
}
</style>