Download comfyui-custom-scripts/web/js/swapResolution.js from MarkLilly/mis-custom-nodes: direct link, hf CLI and curl.
- Browser
- Download file 872 Bytes
-
https://huggingface.co/MarkLilly/mis-custom-nodes/resolve/main/comfyui-custom-scripts/web/js/swapResolution.js
- Command line
-
hf download hf://MarkLilly/mis-custom-nodes/comfyui-custom-scripts/web/js/swapResolution.js
-
curl -L -o swapResolution.js https://huggingface.co/MarkLilly/mis-custom-nodes/resolve/main/comfyui-custom-scripts/web/js/swapResolution.js
872 Bytes
| import { app } from "../../../scripts/app.js"; | |
| app.registerExtension({ | |
| name: "pysssss.SwapResolution", | |
| async beforeRegisterNodeDef(nodeType, nodeData) { | |
| const inputs = { ...nodeData.input?.required, ...nodeData.input?.optional }; | |
| if (inputs.width && inputs.height) { | |
| const origGetExtraMenuOptions = nodeType.prototype.getExtraMenuOptions; | |
| nodeType.prototype.getExtraMenuOptions = function (_, options) { | |
| const r = origGetExtraMenuOptions?.apply?.(this, arguments); | |
| options.push( | |
| { | |
| content: "Swap width/height", | |
| callback: () => { | |
| const w = this.widgets.find((w) => w.name === "width"); | |
| const h = this.widgets.find((w) => w.name === "height"); | |
| const a = w.value; | |
| w.value = h.value; | |
| h.value = a; | |
| app.graph.setDirtyCanvas(true); | |
| }, | |
| }, | |
| null | |
| ); | |
| return r; | |
| }; | |
| } | |
| }, | |
| }); | |