Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
e4a3e9e5
Commit
e4a3e9e5
authored
Aug 01, 2023
by
comfyanonymous
Browse files
Add an option in the UI to disable sliders.
parent
834ab278
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
web/scripts/ui.js
web/scripts/ui.js
+7
-0
web/scripts/widgets.js
web/scripts/widgets.js
+12
-7
No files found.
web/scripts/ui.js
View file @
e4a3e9e5
...
...
@@ -542,6 +542,13 @@ export class ComfyUI {
defaultValue
:
""
,
});
this
.
settings
.
addSetting
({
id
:
"
Comfy.DisableSliders
"
,
name
:
"
Disable sliders.
"
,
type
:
"
boolean
"
,
defaultValue
:
false
,
});
const
fileInput
=
$el
(
"
input
"
,
{
id
:
"
comfy-file-input
"
,
type
:
"
file
"
,
...
...
web/scripts/widgets.js
View file @
e4a3e9e5
...
...
@@ -79,8 +79,8 @@ export function addValueControlWidget(node, targetWidget, defaultValue = "random
return
valueControl
;
};
function
seedWidget
(
node
,
inputName
,
inputData
)
{
const
seed
=
ComfyWidgets
.
INT
(
node
,
inputName
,
inputData
);
function
seedWidget
(
node
,
inputName
,
inputData
,
app
)
{
const
seed
=
ComfyWidgets
.
INT
(
node
,
inputName
,
inputData
,
app
);
const
seedControl
=
addValueControlWidget
(
node
,
seed
.
widget
,
"
randomize
"
);
seed
.
widget
.
linkedWidgets
=
[
seedControl
];
...
...
@@ -250,20 +250,25 @@ function addMultilineWidget(node, name, opts, app) {
return
{
minWidth
:
400
,
minHeight
:
200
,
widget
};
}
function
isSlider
(
display
)
{
function
isSlider
(
display
,
app
)
{
if
(
app
.
ui
.
settings
.
getSettingValue
(
"
Comfy.DisableSliders
"
))
{
return
"
number
"
}
return
(
display
===
"
slider
"
)
?
"
slider
"
:
"
number
"
}
export
const
ComfyWidgets
=
{
"
INT:seed
"
:
seedWidget
,
"
INT:noise_seed
"
:
seedWidget
,
FLOAT
(
node
,
inputName
,
inputData
)
{
let
widgetType
=
isSlider
(
inputData
[
1
][
"
display
"
]);
FLOAT
(
node
,
inputName
,
inputData
,
app
)
{
let
widgetType
=
isSlider
(
inputData
[
1
][
"
display
"
]
,
app
);
const
{
val
,
config
}
=
getNumberDefaults
(
inputData
,
0.5
);
return
{
widget
:
node
.
addWidget
(
widgetType
,
inputName
,
val
,
()
=>
{},
config
)
};
},
INT
(
node
,
inputName
,
inputData
)
{
let
widgetType
=
isSlider
(
inputData
[
1
][
"
display
"
]);
INT
(
node
,
inputName
,
inputData
,
app
)
{
console
.
log
(
app
);
let
widgetType
=
isSlider
(
inputData
[
1
][
"
display
"
],
app
);
const
{
val
,
config
}
=
getNumberDefaults
(
inputData
,
1
);
Object
.
assign
(
config
,
{
precision
:
0
});
return
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment