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 slider setting type

missionfloyde87aa1873f6a
diff --git a/web/scripts/ui.js b/web/scripts/ui.js
index 09861c440..1c7fdc8a1 100644
--- a/web/scripts/ui.js
+++ b/web/scripts/ui.js
@@ -270,6 +270,30 @@ class ComfySettingsDialog extends ComfyDialog {
]),
]);
break;
+ case "slider":
+ element = $el("div", [
+ $el("label", { textContent: name }, [
+ $el("input", {
+ type: "range",
+ value,
+ oninput: (e) => {
+ setter(e.target.value);
+ e.target.nextElementSibling.value = e.target.value;
+ },
+ ...attrs
+ }),
+ $el("input", {
+ type: "number",
+ value,
+ oninput: (e) => {
+ setter(e.target.value);
+ e.target.previousElementSibling.value = e.target.value;
+ },
+ ...attrs
+ }),
+ ]),
+ ]);
+ break;
default:
console.warn("Unsupported setting type, defaulting to text");
element = $el("div", [
diff --git a/web/style.css b/web/style.css
index 34e31726c..e3b445762 100644
--- a/web/style.css
+++ b/web/style.css
@@ -217,6 +217,14 @@ button.comfy-queue-btn {
z-index: 99;
}
+.comfy-modal.comfy-settings input[type="range"] {
+ vertical-align: middle;
+}
+
+.comfy-modal.comfy-settings input[type="range"] + input[type="number"] {
+ width: 3.5em;
+}
+
.comfy-modal input,
.comfy-modal select {
color: var(--input-text);