mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-11 02:15:17 +00:00
Add support for multiselect
This commit is contained in:
parent
26dc8e3056
commit
04234152c1
@ -28,7 +28,10 @@ app.registerExtension({
|
||||
const r = onNodeMoved?.apply(this, arguments);
|
||||
|
||||
if (app.shiftDown) {
|
||||
node.alignToGrid();
|
||||
// Ensure all selected nodes are realigned
|
||||
for (const id in this.selected_nodes) {
|
||||
this.selected_nodes[id].alignToGrid();
|
||||
}
|
||||
}
|
||||
|
||||
return r;
|
||||
@ -39,7 +42,7 @@ app.registerExtension({
|
||||
app.graph.onNodeAdded = function (node) {
|
||||
const onResize = node.onResize;
|
||||
node.onResize = function () {
|
||||
if(app.shiftDown) {
|
||||
if (app.shiftDown) {
|
||||
const w = LiteGraph.CANVAS_GRID_SIZE * Math.round(node.size[0] / LiteGraph.CANVAS_GRID_SIZE);
|
||||
const h = LiteGraph.CANVAS_GRID_SIZE * Math.round(node.size[1] / LiteGraph.CANVAS_GRID_SIZE);
|
||||
node.size[0] = w;
|
||||
@ -50,10 +53,10 @@ app.registerExtension({
|
||||
return onNodeAdded?.apply(this, arguments);
|
||||
};
|
||||
|
||||
// Draw a preview of where the node will go if holding shift
|
||||
// Draw a preview of where the node will go if holding shift and the node is selected
|
||||
const origDrawNode = LGraphCanvas.prototype.drawNode;
|
||||
LGraphCanvas.prototype.drawNode = function (node, ctx) {
|
||||
if (app.shiftDown && node === this.node_dragged) {
|
||||
if (app.shiftDown && this.node_dragged && node.id in this.selected_nodes) {
|
||||
const x = LiteGraph.CANVAS_GRID_SIZE * Math.round(node.pos[0] / LiteGraph.CANVAS_GRID_SIZE);
|
||||
const y = LiteGraph.CANVAS_GRID_SIZE * Math.round(node.pos[1] / LiteGraph.CANVAS_GRID_SIZE);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user