This commit is contained in:
comfyanonymous 2023-04-17 22:45:46 -04:00
commit c8afa7e9fb
3 changed files with 33 additions and 1 deletions

View File

@ -9,7 +9,7 @@ app.registerExtension({
app.ui.settings.addSetting({ app.ui.settings.addSetting({
id: "Comfy.SnapToGrid.GridSize", id: "Comfy.SnapToGrid.GridSize",
name: "Grid Size", name: "Grid Size",
type: "number", type: "slider",
attrs: { attrs: {
min: 1, min: 1,
max: 500, max: 500,

View File

@ -270,6 +270,30 @@ class ComfySettingsDialog extends ComfyDialog {
]), ]),
]); ]);
break; 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: default:
console.warn("Unsupported setting type, defaulting to text"); console.warn("Unsupported setting type, defaulting to text");
element = $el("div", [ element = $el("div", [

View File

@ -217,6 +217,14 @@ button.comfy-queue-btn {
z-index: 99; 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 input,
.comfy-modal select { .comfy-modal select {
color: var(--input-text); color: var(--input-text);