Skip to content

Commit

Permalink
Relands #31 and #32 (#39)
Browse files Browse the repository at this point in the history
* Add node disconnect shortcuts (#31)

* Fix loop break missing

* Fix logic - cannot reconnect AND disconnect

* Add ctrl + alt + click to disconnect nodes

Adds disconnect feature and very minor bug fixes (in separate commits):
- Ctrl + Alt + Click: Disconnect an input or output
- Ctrl + Alt + Click & Drag: Rewire any input/output to another node with a single click
- Added LiteGraph setting, on by default.

6036: skip_action = true

Not sure why skip_action was set to true, here.  It prevents disconnect and drag to a new output on the same click, so I've included it in the main commit.  Ideally, this should be controlled by a consumer hook, e.g. onDisconnectInput.

* Add output multi-link move using shift-click (#32)

When an output connects to multiple inputs, and you'd like to move all of those links to another node, you are currently required to drag each new link one by one.

This commit adds the ability to move everything at once, using Shift + Click (and drag).

It -does not- currently work with the drop to blank space + search for new node.  It will j ust rewire the first.  This can probably be fixed easily enough.

It -does- function with reroute nodes, however it requires that they are dropped onto the new output directly, not just anywhere on the node.  This is expected, really.

* Update empty-release event protocol

---------

Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
  • Loading branch information
huchenlei and webfiltered authored Jul 30, 2024
1 parent 6126ebc commit 52bcf71
Show file tree
Hide file tree
Showing 2 changed files with 249 additions and 193 deletions.
14 changes: 13 additions & 1 deletion src/litegraph.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,24 @@ export type LinkReleaseContext = {
type_filter_out?: string;
};

export type ConnectingLink = {
node: LGraphNode;
slot: number;
input: INodeInputSlot | null;
output: INodeOutputSlot | null;
pos: Vector2;
};

export type LinkReleaseContextExtended = {
links: ConnectingLink[];
};

export type LiteGraphCanvasEventType = "empty-release" | "empty-double-click";

export type LiteGraphCanvasEvent = CustomEvent<{
subType: string;
originalEvent: Event,
linkReleaseContext?: LinkReleaseContext;
linkReleaseContext?: LinkReleaseContextExtended;
}>;

export const LiteGraph: {
Expand Down
Loading

0 comments on commit 52bcf71

Please sign in to comment.