layers tree I
This commit is contained in:
@@ -3,6 +3,7 @@ import { defaultGraph, graphContext, type EdgeModel, type NodeContext } from "./
|
||||
import { useContext } from "react";
|
||||
import { cloneDeep } from "lodash";
|
||||
import { useGraphsStore } from "../stores/GraphsStore";
|
||||
import { useGraphLayersTreeStore } from "../stores/TreeStore";
|
||||
|
||||
const items: MenuProps['items'] = [
|
||||
{
|
||||
@@ -39,6 +40,7 @@ export default function NodeContextMenu({
|
||||
|
||||
const graphContextValue = useContext(graphContext)!;
|
||||
const graphsById = useGraphsStore((s) => s.graphsById);
|
||||
const addTreeNode = useGraphLayersTreeStore(store => store.add);
|
||||
|
||||
function contextMenuOpenChange(open: boolean) {
|
||||
if (!open) {
|
||||
@@ -64,9 +66,10 @@ export default function NodeContextMenu({
|
||||
if (!selectedGraph) {
|
||||
selectedGraph = defaultGraph();
|
||||
graphsById.set(nodeContext.nodeId, selectedGraph);
|
||||
const parenNodeId = graphContextValue.graphId === 'main' ? undefined : graphContextValue.graphId;
|
||||
addTreeNode(nodeContext, parenNodeId);
|
||||
}
|
||||
|
||||
console.info(graphsById)
|
||||
|
||||
graphContextValue.setGraph(selectedGraph);
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user