Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Add setting to change link render mode Add support for combo settings

pythongosssss8918f1085ca1
diff --git a/web/extensions/core/linkRenderMode.js b/web/extensions/core/linkRenderMode.js
new file mode 100644
index 000000000..8b8d4e01f
--- /dev/null
+++ b/web/extensions/core/linkRenderMode.js
@@ -0,0 +1,25 @@
+import { app } from "/scripts/app.js";
+
+const id = "Comfy.LinkRenderMode";
+const ext = {
+ name: id,
+ async setup(app) {
+ app.ui.settings.addSetting({
+ id,
+ name: "Link Render Mode",
+ defaultValue: 2,
+ type: "combo",
+ options: LiteGraph.LINK_RENDER_MODES.map((m, i) => ({
+ value: i,
+ text: m,
+ selected: i == app.canvas.links_render_mode,
+ })),
+ onChange(value) {
+ app.canvas.links_render_mode = +value;
+ app.graph.setDirtyCanvas(true);
+ },
+ });
+ },
+};
+
+app.registerExtension(ext);
diff --git a/web/scripts/ui.js b/web/scripts/ui.js
index 03a4035b1..86e2a1c41 100644
--- a/web/scripts/ui.js
+++ b/web/scripts/ui.js
@@ -234,7 +234,7 @@ class ComfySettingsDialog extends ComfyDialog {
localStorage[settingId] = JSON.stringify(value);
}
- addSetting({id, name, type, defaultValue, onChange, attrs = {}, tooltip = "",}) {
+ addSetting({id, name, type, defaultValue, onChange, attrs = {}, tooltip = "", options = undefined}) {
if (!id) {
throw new Error("Settings must have an ID");
}
@@ -347,6 +347,32 @@ class ComfySettingsDialog extends ComfyDialog {
]),
]);
break;
+ case "combo":
+ element = $el("tr", [
+ labelCell,
+ $el("td", [
+ $el(
+ "select",
+ {
+ oninput: (e) => {
+ setter(e.target.value);
+ },
+ },
+ (typeof options === "function" ? options(value) : options || []).map((opt) => {
+ if (typeof opt === "string") {
+ opt = { text: opt };
+ }
+ const v = opt.value ?? opt.text;
+ return $el("option", {
+ value: v,
+ textContent: opt.text,
+ selected: value + "" === v + "",
+ });
+ })
+ ),
+ ]),
+ ]);
+ break;
case "text":
default:
if (type !== "text") {