refactor: how the keymap gets to the viewer
This commit is contained in:
@@ -79,7 +79,6 @@
|
||||
|
||||
$: if ($colors.outline) {
|
||||
lineColor.copyLinearToSRGB($colors.outline);
|
||||
console.log("lineColor", lineColor);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@@ -2,9 +2,10 @@
|
||||
import type { Graph, NodeRegistry } from "@nodes/types";
|
||||
import GraphEl from "./Graph.svelte";
|
||||
import { GraphManager } from "../graph-manager.js";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import { createEventDispatcher, setContext } from "svelte";
|
||||
import type { Writable } from "svelte/store";
|
||||
import { debounce } from "$lib/helpers";
|
||||
import { createKeyMap } from "$lib/helpers/createKeyMap";
|
||||
|
||||
export let registry: NodeRegistry;
|
||||
export let graph: Graph;
|
||||
@@ -14,6 +15,9 @@
|
||||
|
||||
export const status = manager.status;
|
||||
|
||||
export const keymap = createKeyMap([]);
|
||||
setContext("keymap", keymap);
|
||||
|
||||
const updateSettings = debounce((s) => {
|
||||
manager.setSettings(s);
|
||||
}, 200);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import type { createKeyMap } from "$lib/helpers/createKeyMap";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
const { keys } = getContext<ReturnType<typeof createKeyMap>>("keymap");
|
||||
export let keymap: ReturnType<typeof createKeyMap>;
|
||||
const keys = keymap.keys;
|
||||
</script>
|
||||
|
||||
<div class="wrapper">
|
||||
|
0
app/src/lib/settings/NodeStore.svelte
Normal file
0
app/src/lib/settings/NodeStore.svelte
Normal file
@@ -21,7 +21,9 @@
|
||||
false,
|
||||
);
|
||||
$: keys = panels
|
||||
? (Object.keys(panels) as unknown as (keyof typeof panels)[])
|
||||
? (Object.keys(panels) as unknown as (keyof typeof panels)[]).filter(
|
||||
(key) => !!panels[key]?.id,
|
||||
)
|
||||
: [];
|
||||
|
||||
function setActivePanel(panel: keyof typeof panels | false) {
|
||||
@@ -83,7 +85,7 @@
|
||||
{#if panels[$activePanel]?.component}
|
||||
<svelte:component
|
||||
this={panels[$activePanel].component}
|
||||
{...panels[$activePanel]}
|
||||
{...panels[$activePanel]?.props}
|
||||
/>
|
||||
{:else}
|
||||
<div class="flex flex-col">
|
||||
|
Reference in New Issue
Block a user