mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-29 14:38:11 +08:00
Add support for adding/removing a graph's primary imports/exports separately from the secondary (#3089)
* Primary Import/Export * Primary Import/Export * Complete import exports * Final changes * Improve line width * Code review --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
ce1cd1706b
commit
f1a1275601
@@ -1,7 +1,6 @@
|
||||
import { writable } from "svelte/store";
|
||||
|
||||
import { type Editor } from "@graphite/editor";
|
||||
import type { FrontendGraphOutput, FrontendGraphInput } from "@graphite/messages";
|
||||
import {
|
||||
type Box,
|
||||
type FrontendClickTargets,
|
||||
@@ -37,10 +36,7 @@ export function createNodeGraphState(editor: Editor) {
|
||||
layerWidths: new Map<bigint, number>(),
|
||||
chainWidths: new Map<bigint, number>(),
|
||||
hasLeftInputWire: new Map<bigint, boolean>(),
|
||||
imports: [] as { outputMetadata: FrontendGraphOutput; position: { x: number; y: number } }[],
|
||||
exports: [] as { inputMetadata: FrontendGraphInput; position: { x: number; y: number } }[],
|
||||
addImport: undefined as { x: number; y: number } | undefined,
|
||||
addExport: undefined as { x: number; y: number } | undefined,
|
||||
updateImportsExports: undefined as UpdateImportsExports | undefined,
|
||||
nodes: new Map<bigint, FrontendNode>(),
|
||||
visibleNodes: new Set<bigint>(),
|
||||
/// The index is the exposed input index. The exports have a first key value of u32::MAX.
|
||||
@@ -96,10 +92,7 @@ export function createNodeGraphState(editor: Editor) {
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(UpdateImportsExports, (updateImportsExports) => {
|
||||
update((state) => {
|
||||
state.imports = updateImportsExports.imports;
|
||||
state.exports = updateImportsExports.exports;
|
||||
state.addImport = updateImportsExports.addImport;
|
||||
state.addExport = updateImportsExports.addExport;
|
||||
state.updateImportsExports = updateImportsExports;
|
||||
return state;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user