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
8918f108
Commit
8918f108
authored
Aug 04, 2023
by
pythongosssss
Browse files
Add setting to change link render mode
Add support for combo settings
parent
cb25b883
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
1 deletion
+52
-1
web/extensions/core/linkRenderMode.js
web/extensions/core/linkRenderMode.js
+25
-0
web/scripts/ui.js
web/scripts/ui.js
+27
-1
No files found.
web/extensions/core/linkRenderMode.js
0 → 100644
View file @
8918f108
import
{
app
}
from
"
/scripts/app.js
"
;
const
id
=
"
Comfy.LinkRenderMode
"
;
const
ext
=
{
name
:
id
,
async
setup
(
app
)
{
app
.
ui
.
settings
.
addSetting
({
id
,
name
:
"
Link Render Mode
"
,
defaultValue
:
2
,
type
:
"
combo
"
,
options
:
LiteGraph
.
LINK_RENDER_MODES
.
map
((
m
,
i
)
=>
({
value
:
i
,
text
:
m
,
selected
:
i
==
app
.
canvas
.
links_render_mode
,
})),
onChange
(
value
)
{
app
.
canvas
.
links_render_mode
=
+
value
;
app
.
graph
.
setDirtyCanvas
(
true
);
},
});
},
};
app
.
registerExtension
(
ext
);
web/scripts/ui.js
View file @
8918f108
...
...
@@ -234,7 +234,7 @@ class ComfySettingsDialog extends ComfyDialog {
localStorage
[
settingId
]
=
JSON
.
stringify
(
value
);
}
addSetting
({
id
,
name
,
type
,
defaultValue
,
onChange
,
attrs
=
{},
tooltip
=
""
,})
{
addSetting
({
id
,
name
,
type
,
defaultValue
,
onChange
,
attrs
=
{},
tooltip
=
""
,
options
=
undefined
})
{
if
(
!
id
)
{
throw
new
Error
(
"
Settings must have an ID
"
);
}
...
...
@@ -347,6 +347,32 @@ class ComfySettingsDialog extends ComfyDialog {
]),
]);
break
;
case
"
combo
"
:
element
=
$el
(
"
tr
"
,
[
labelCell
,
$el
(
"
td
"
,
[
$el
(
"
select
"
,
{
oninput
:
(
e
)
=>
{
setter
(
e
.
target
.
value
);
},
},
(
typeof
options
===
"
function
"
?
options
(
value
)
:
options
||
[]).
map
((
opt
)
=>
{
if
(
typeof
opt
===
"
string
"
)
{
opt
=
{
text
:
opt
};
}
const
v
=
opt
.
value
??
opt
.
text
;
return
$el
(
"
option
"
,
{
value
:
v
,
textContent
:
opt
.
text
,
selected
:
value
+
""
===
v
+
""
,
});
})
),
]),
]);
break
;
case
"
text
"
:
default
:
if
(
type
!==
"
text
"
)
{
...
...
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