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
d3d9ad00
Commit
d3d9ad00
authored
Jul 29, 2023
by
Guillaume Faguet
Browse files
added slider and toggle widget
parent
c910b4a0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
web/scripts/widgets.js
web/scripts/widgets.js
+27
-0
No files found.
web/scripts/widgets.js
View file @
d3d9ad00
...
@@ -273,6 +273,33 @@ export const ComfyWidgets = {
...
@@ -273,6 +273,33 @@ export const ComfyWidgets = {
),
),
};
};
},
},
SLIDER
(
node
,
inputName
,
inputData
)
{
const
{
val
,
config
}
=
getNumberDefaults
(
inputData
,
1
);
Object
.
assign
(
config
,
{
precision
:
0
});
return
{
widget
:
node
.
addWidget
(
"
slider
"
,
inputName
,
val
,
function
(
v
)
{
const
s
=
this
.
options
.
step
/
10
;
this
.
value
=
Math
.
round
(
v
/
s
)
*
s
;
},
config
),
};
},
TOGGLE
(
node
,
inputName
,
inputData
)
{
let
defaultVal
=
inputData
[
1
][
"
default
"
];
return
{
widget
:
node
.
addWidget
(
"
toggle
"
,
inputName
,
defaultVal
,
()
=>
{},
)
};
},
STRING
(
node
,
inputName
,
inputData
,
app
)
{
STRING
(
node
,
inputName
,
inputData
,
app
)
{
const
defaultVal
=
inputData
[
1
].
default
||
""
;
const
defaultVal
=
inputData
[
1
].
default
||
""
;
const
multiline
=
!!
inputData
[
1
].
multiline
;
const
multiline
=
!!
inputData
[
1
].
multiline
;
...
...
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