Skip to content

Add node disconnect shortcuts #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions src/litegraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@

shift_click_do_break_link_from: false, // [false!] prefer false if results too easy to break links - implement with ALT or TODO custom keys
click_do_break_link_to: false, // [false!]prefer false, way too easy to break links
ctrl_alt_click_do_break_link: true, // [true!] who accidentally ctrl-alt-clicks on an in/output? nobody! that's who!

search_hide_on_mouse_leave: true, // [false on mobile] better true if not touch device, TODO add an helper/listener to close if false
search_filter_enabled: false, // [true!] enable filtering slots type in the search widget, !requires auto_load_slot_types or manual set registered_slot_[in/out]_types and slot_types_[in/out]
Expand Down Expand Up @@ -5907,7 +5908,7 @@ LGraphNode.prototype.executeAction = function(action)
//left button mouse / single finger
if (e.which == 1 && !this.pointer_is_double)
{
if (e.ctrlKey)
if (e.ctrlKey && !e.altKey)
{
this.dragging_rectangle = new Float32Array(4);
this.dragging_rectangle[0] = e.canvasX;
Expand All @@ -5918,7 +5919,7 @@ LGraphNode.prototype.executeAction = function(action)
}

// clone node ALT dragging
if (LiteGraph.alt_drag_do_clone_nodes && e.altKey && node && this.allow_interaction && !skip_action && !this.read_only)
if (LiteGraph.alt_drag_do_clone_nodes && e.altKey && !e.ctrlKey && node && this.allow_interaction && !skip_action && !this.read_only)
{
if (cloned = node.clone()){
cloned.pos[0] += 5;
Expand Down Expand Up @@ -5983,6 +5984,10 @@ LGraphNode.prototype.executeAction = function(action)
if (e.shiftKey) {
node.disconnectOutput(i);
}
} else if (LiteGraph.ctrl_alt_click_do_break_link) {
if (e.ctrlKey && e.altKey && !e.shiftKey) {
node.disconnectOutput(i);
}
}

if (is_double_click) {
Expand Down Expand Up @@ -6030,15 +6035,9 @@ LGraphNode.prototype.executeAction = function(action)
var link_info = this.graph.links[
input.link
]; //before disconnecting
if (LiteGraph.click_do_break_link_to){
if (LiteGraph.click_do_break_link_to || (LiteGraph.ctrl_alt_click_do_break_link && e.ctrlKey && e.altKey && !e.shiftKey)){
node.disconnectInput(i);
this.dirty_bgcanvas = true;
skip_action = true;
}else{
// do same action as has not node ?
}

if (
} else if (
this.allow_reconnect_links ||
//this.move_destination_link_without_shift ||
e.shiftKey
Expand All @@ -6058,6 +6057,8 @@ LGraphNode.prototype.executeAction = function(action)

this.dirty_bgcanvas = true;
skip_action = true;
}else{
// do same action as has not node ?
}


Expand All @@ -6076,6 +6077,8 @@ LGraphNode.prototype.executeAction = function(action)
this.dirty_bgcanvas = true;
skip_action = true;
}

break;
}
}
}
Expand Down