feat: better handle node position updates
This commit is contained in:
@@ -42,8 +42,8 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<T.Mesh
|
<T.Mesh
|
||||||
position.x={node.position[0] + 10}
|
position.x={(node.state.x ?? node.position[0]) + 10}
|
||||||
position.z={node.position[1] + height / 2}
|
position.z={(node.state.y ?? node.position[1]) + height / 2}
|
||||||
position.y={0.8}
|
position.y={0.8}
|
||||||
rotation.x={-Math.PI / 2}
|
rotation.x={-Math.PI / 2}
|
||||||
bind:ref={meshRef}
|
bind:ref={meshRef}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Select } from "@nodarium/ui";
|
import { Select } from "@nodarium/ui";
|
||||||
import type { Writable } from "svelte/store";
|
|
||||||
|
|
||||||
let activeStore = 0;
|
let activeStore = $state(0);
|
||||||
export let activeId: Writable<string>;
|
let { activeId }: { activeId: string } = $props();
|
||||||
$: [activeUser, activeCollection, activeNode] = $activeId.split(`/`);
|
const [activeUser, activeCollection, activeNode] = $derived(
|
||||||
|
activeId.split(`/`),
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="breadcrumbs">
|
<div class="breadcrumbs">
|
||||||
@@ -12,16 +13,16 @@
|
|||||||
<Select id="root" options={["root"]} bind:value={activeStore}></Select>
|
<Select id="root" options={["root"]} bind:value={activeStore}></Select>
|
||||||
{#if activeCollection}
|
{#if activeCollection}
|
||||||
<button
|
<button
|
||||||
on:click={() => {
|
onclick={() => {
|
||||||
$activeId = activeUser;
|
activeId = activeUser;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{activeUser}
|
{activeUser}
|
||||||
</button>
|
</button>
|
||||||
{#if activeNode}
|
{#if activeNode}
|
||||||
<button
|
<button
|
||||||
on:click={() => {
|
onclick={() => {
|
||||||
$activeId = `${activeUser}/${activeCollection}`;
|
activeId = `${activeUser}/${activeCollection}`;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{activeCollection}
|
{activeCollection}
|
||||||
|
|||||||
@@ -1,19 +1,16 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { writable } from "svelte/store";
|
|
||||||
import BreadCrumbs from "./BreadCrumbs.svelte";
|
import BreadCrumbs from "./BreadCrumbs.svelte";
|
||||||
import DraggableNode from "./DraggableNode.svelte";
|
import DraggableNode from "./DraggableNode.svelte";
|
||||||
import type { RemoteNodeRegistry } from "@nodarium/registry";
|
import type { RemoteNodeRegistry } from "@nodarium/registry";
|
||||||
|
|
||||||
export let registry: RemoteNodeRegistry;
|
const { registry }: { registry: RemoteNodeRegistry } = $props();
|
||||||
|
|
||||||
const activeId = writable("max/plantarium");
|
let activeId = $state("max/plantarium");
|
||||||
let showBreadCrumbs = false;
|
let showBreadCrumbs = false;
|
||||||
|
|
||||||
// const activeId = localStore<
|
const [activeUser, activeCollection, activeNode] = $derived(
|
||||||
// `${string}` | `${string}/${string}` | `${string}/${string}/${string}`
|
activeId.split(`/`),
|
||||||
// >("nodes.store.activeId", "");
|
);
|
||||||
|
|
||||||
$: [activeUser, activeCollection, activeNode] = $activeId.split(`/`);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if showBreadCrumbs}
|
{#if showBreadCrumbs}
|
||||||
@@ -27,8 +24,8 @@
|
|||||||
{:then users}
|
{:then users}
|
||||||
{#each users as user}
|
{#each users as user}
|
||||||
<button
|
<button
|
||||||
on:click={() => {
|
onclick={() => {
|
||||||
$activeId = user.id;
|
activeId = user.id;
|
||||||
}}>{user.id}</button
|
}}>{user.id}</button
|
||||||
>
|
>
|
||||||
{/each}
|
{/each}
|
||||||
@@ -41,8 +38,8 @@
|
|||||||
{:then user}
|
{:then user}
|
||||||
{#each user.collections as collection}
|
{#each user.collections as collection}
|
||||||
<button
|
<button
|
||||||
on:click={() => {
|
onclick={() => {
|
||||||
$activeId = collection.id;
|
activeId = collection.id;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{collection.id.split(`/`)[1]}
|
{collection.id.split(`/`)[1]}
|
||||||
|
|||||||
Reference in New Issue
Block a user