Snap to grid

This commit is contained in:
pythongosssss
2023-04-02 15:33:34 +01:00
parent 5aefd6cdf3
commit d027ff121c
2 changed files with 93 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ class ComfyApp {
this.ui = new ComfyUI(this);
this.extensions = [];
this.nodeOutputs = {};
this.shiftDown = false;
}
/**
@@ -538,7 +539,7 @@ class ComfyApp {
color = "#0f0";
} else if (self.dragOverNode && node.id === self.dragOverNode.id) {
color = "dodgerblue";
}
}
if (color) {
const shape = node._shape || node.constructor.shape || LiteGraph.ROUND_SHAPE;
@@ -637,11 +638,16 @@ class ComfyApp {
#addKeyboardHandler() {
window.addEventListener("keydown", (e) => {
this.shiftDown = e.shiftKey;
// Queue prompt using ctrl or command + enter
if ((e.ctrlKey || e.metaKey) && (e.key === "Enter" || e.keyCode === 13 || e.keyCode === 10)) {
this.queuePrompt(e.shiftKey ? -1 : 0);
}
});
window.addEventListener("keyup", (e) => {
this.shiftDown = e.shiftKey;
});
}
/**