Merge pull request #329 from mohsen-karami/master

Add the ability to select multi nodes/blocks without pressing extra keys (shift/Ctrl)
This commit is contained in:
Javi Agenjo
2023-03-02 11:52:17 +01:00
committed by GitHub
2 changed files with 6 additions and 4 deletions

2
src/litegraph.d.ts vendored
View File

@@ -1142,6 +1142,8 @@ export declare class LGraphCanvas {
allow_interaction: boolean;
/** allows to change a connection with having to redo it again */
allow_reconnect_links: boolean;
/** allow selecting multi nodes without pressing extra keys */
multi_select: boolean;
/** No effect */
allow_searchbox: boolean;
always_render_background: boolean;

View File

@@ -5211,6 +5211,7 @@ LGraphNode.prototype.executeAction = function(action)
this.allow_dragcanvas = true;
this.allow_dragnodes = true;
this.allow_interaction = true; //allow to control widgets, buttons, collapse, etc
this.multi_select = false; //allow selecting multi nodes without pressing extra keys
this.allow_searchbox = true;
this.allow_reconnect_links = true; //allows to change a connection with having to redo it again
this.align_to_grid = false; //snap to grid
@@ -6061,9 +6062,7 @@ LGraphNode.prototype.executeAction = function(action)
this.graph.beforeChange();
this.node_dragged = node;
}
if (!this.selected_nodes[node.id]) {
this.processNodeSelected(node, e);
}
this.processNodeSelected(node, e);
}
this.dirty_canvas = true;
@@ -7288,7 +7287,7 @@ LGraphNode.prototype.executeAction = function(action)
};
LGraphCanvas.prototype.processNodeSelected = function(node, e) {
this.selectNode(node, e && (e.shiftKey||e.ctrlKey));
this.selectNode(node, e && (e.shiftKey || e.ctrlKey || this.multi_select));
if (this.onNodeSelected) {
this.onNodeSelected(node);
}
@@ -7324,6 +7323,7 @@ LGraphNode.prototype.executeAction = function(action)
for (var i in nodes) {
var node = nodes[i];
if (node.is_selected) {
this.deselectNode(node);
continue;
}