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
6cdc9afc
Commit
6cdc9afc
authored
Jul 31, 2023
by
Guillaume Faguet
Browse files
pass slider type as option
parent
d3d9ad00
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
19 deletions
+9
-19
web/scripts/widgets.js
web/scripts/widgets.js
+9
-19
No files found.
web/scripts/widgets.js
View file @
6cdc9afc
...
@@ -250,35 +250,25 @@ function addMultilineWidget(node, name, opts, app) {
...
@@ -250,35 +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
,
val
,
function
(
v
)
{
const
s
=
this
.
options
.
step
/
10
;
this
.
value
=
Math
.
round
(
v
/
s
)
*
s
;
},
config
),
};
},
SLIDER
(
node
,
inputName
,
inputData
)
{
const
{
val
,
config
}
=
getNumberDefaults
(
inputData
,
1
);
Object
.
assign
(
config
,
{
precision
:
0
});
return
{
widget
:
node
.
addWidget
(
"
slider
"
,
inputName
,
inputName
,
val
,
val
,
function
(
v
)
{
function
(
v
)
{
...
@@ -286,7 +276,7 @@ export const ComfyWidgets = {
...
@@ -286,7 +276,7 @@ export const ComfyWidgets = {
this
.
value
=
Math
.
round
(
v
/
s
)
*
s
;
this
.
value
=
Math
.
round
(
v
/
s
)
*
s
;
},
},
config
config
),
),
};
};
},
},
TOGGLE
(
node
,
inputName
,
inputData
)
{
TOGGLE
(
node
,
inputName
,
inputData
)
{
...
...
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