selected filter thing

This commit is contained in:
Sam Lavigne 2023-08-30 13:43:52 -04:00
parent fc58740401
commit 6d4d5c32b0
2 changed files with 13 additions and 4 deletions

View File

@ -52,10 +52,13 @@
panOnDrag={!$auto} panOnDrag={!$auto}
edgesUpdatable={!$auto} edgesUpdatable={!$auto}
connectOnClick={true} connectOnClick={true}
nodesFocusable={!$auto} nodesFocusable={false}
edgesFocusable={!$auto} edgesFocusable={false}
elementsSelectable={false}
nodesSelectable={!$auto}
zoomOnScroll={!$auto} zoomOnScroll={!$auto}
deleteKey={0} deleteKey={0}
multiSelectionKeyCode={null}
on:nodeclick={onClick} on:nodeclick={onClick}
{nodeTypes} {nodeTypes}
{edgeTypes} {edgeTypes}

View File

@ -1,10 +1,12 @@
<script lang="ts"> <script lang="ts">
import { Handle, Position } from "@xyflow/svelte"; import { Handle, Position } from "@xyflow/svelte";
import { removeNode, nodes, INPUTNAMES, OUTPUTNAMES } from "./stores.js"; import { removeNode, nodes, INPUTNAMES, OUTPUTNAMES, selectedFilter } from "./stores.js";
export let data = { ext: "", nodeType: "", name: "", inputs: [], outputs: [] }; export let data = { ext: "", nodeType: "", name: "", inputs: [], outputs: [] };
export let id; export let id;
$: isSelected = $selectedFilter && $nodes[$selectedFilter] && $nodes[$selectedFilter].id === id;
function remove() { function remove() {
removeNode(id); removeNode(id);
} }
@ -22,7 +24,7 @@
} }
</script> </script>
<div class="node {data.nodeType}"> <div class="node {data.nodeType} {isSelected ? 'selected' : ''}">
<div class="head"> <div class="head">
<div class="node-type">{data.nodeType}</div> <div class="node-type">{data.nodeType}</div>
{#if data.nodeType != "output"} {#if data.nodeType != "output"}
@ -96,6 +98,10 @@
.node { .node {
padding: 5px; padding: 5px;
} }
.selected {
outline: 2px solid var(--b1);
background-color: var(--b2);
}
.head { .head {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;