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
730a5d17
Commit
730a5d17
authored
Jul 31, 2023
by
comfyanonymous
Browse files
Merge branch 'slider_toggle' of
https://github.com/Guillaume-Fgt/ComfyUI
into prs
parents
41cf43f8
6cdc9afc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
web/scripts/widgets.js
web/scripts/widgets.js
+20
-3
No files found.
web/scripts/widgets.js
View file @
730a5d17
...
@@ -250,19 +250,25 @@ function addMultilineWidget(node, name, opts, app) {
...
@@ -250,19 +250,25 @@ function addMultilineWidget(node, name, opts, app) {
return
{
minWidth
:
400
,
minHeight
:
200
,
widget
};
return
{
minWidth
:
400
,
minHeight
:
200
,
widget
};
}
}
function
isSlider
(
display_as
)
{
return
(
display_as
===
"
slider
"
)
?
"
slider
"
:
"
number
"
}
export
const
ComfyWidgets
=
{
export
const
ComfyWidgets
=
{
"
INT:seed
"
:
seedWidget
,
"
INT:seed
"
:
seedWidget
,
"
INT:noise_seed
"
:
seedWidget
,
"
INT:noise_seed
"
:
seedWidget
,
FLOAT
(
node
,
inputName
,
inputData
)
{
FLOAT
(
node
,
inputName
,
inputData
)
{
let
widgetType
=
isSlider
(
inputData
[
1
][
"
display_as
"
]);
const
{
val
,
config
}
=
getNumberDefaults
(
inputData
,
0.5
);
const
{
val
,
config
}
=
getNumberDefaults
(
inputData
,
0.5
);
return
{
widget
:
node
.
addWidget
(
"
number
"
,
inputName
,
val
,
()
=>
{},
config
)
};
return
{
widget
:
node
.
addWidget
(
widgetType
,
inputName
,
val
,
()
=>
{},
config
)
};
},
},
INT
(
node
,
inputName
,
inputData
)
{
INT
(
node
,
inputName
,
inputData
)
{
let
widgetType
=
isSlider
(
inputData
[
1
][
"
display_as
"
]);
const
{
val
,
config
}
=
getNumberDefaults
(
inputData
,
1
);
const
{
val
,
config
}
=
getNumberDefaults
(
inputData
,
1
);
Object
.
assign
(
config
,
{
precision
:
0
});
Object
.
assign
(
config
,
{
precision
:
0
});
return
{
return
{
widget
:
node
.
addWidget
(
widget
:
node
.
addWidget
(
"
number
"
,
widgetType
,
inputName
,
inputName
,
val
,
val
,
function
(
v
)
{
function
(
v
)
{
...
@@ -270,7 +276,18 @@ export const ComfyWidgets = {
...
@@ -270,7 +276,18 @@ export const ComfyWidgets = {
this
.
value
=
Math
.
round
(
v
/
s
)
*
s
;
this
.
value
=
Math
.
round
(
v
/
s
)
*
s
;
},
},
config
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
)
{
...
...
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