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
4a3715be
Commit
4a3715be
authored
Apr 04, 2023
by
comfyanonymous
Browse files
Merge branch 'master' of
https://github.com/mligaintart/ComfyUI
parents
23524ad8
dc24d7e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
+30
-2
web/extensions/core/rerouteNode.js
web/extensions/core/rerouteNode.js
+30
-2
No files found.
web/extensions/core/rerouteNode.js
View file @
4a3715be
...
...
@@ -11,11 +11,14 @@ app.registerExtension({
this
.
properties
=
{};
}
this
.
properties
.
showOutputText
=
RerouteNode
.
defaultVisibility
;
this
.
properties
.
horizontal
=
false
;
this
.
addInput
(
""
,
"
*
"
);
this
.
addOutput
(
this
.
properties
.
showOutputText
?
"
*
"
:
""
,
"
*
"
);
this
.
onConnectionsChange
=
function
(
type
,
index
,
connected
,
link_info
)
{
this
.
applyOrientation
();
// Prevent multiple connections to different types when we have no input
if
(
connected
&&
type
===
LiteGraph
.
OUTPUT
)
{
// Ignore wildcard nodes as these will be updated to real types
...
...
@@ -49,8 +52,8 @@ app.registerExtension({
currentNode
=
null
;
}
else
{
// Move the previous node
currentNode
=
node
;
// Move the previous node
currentNode
=
node
;
}
}
else
{
// We've found the end
...
...
@@ -112,6 +115,7 @@ app.registerExtension({
node
.
__outputType
=
displayType
;
node
.
outputs
[
0
].
name
=
node
.
properties
.
showOutputText
?
displayType
:
""
;
node
.
size
=
node
.
computeSize
();
node
.
applyOrientation
();
for
(
const
l
of
node
.
outputs
[
0
].
links
||
[])
{
const
link
=
app
.
graph
.
links
[
l
];
...
...
@@ -153,6 +157,7 @@ app.registerExtension({
this
.
outputs
[
0
].
name
=
""
;
}
this
.
size
=
this
.
computeSize
();
this
.
applyOrientation
();
app
.
graph
.
setDirtyCanvas
(
true
,
true
);
},
},
...
...
@@ -161,9 +166,32 @@ app.registerExtension({
callback
:
()
=>
{
RerouteNode
.
setDefaultTextVisibility
(
!
RerouteNode
.
defaultVisibility
);
},
},
{
// naming is inverted with respect to LiteGraphNode.horizontal
// LiteGraphNode.horizontal == true means that
// each slot in the inputs and outputs are layed out horizontally,
// which is the opposite of the visual orientation of the inputs and outputs as a node
content
:
"
Set
"
+
(
this
.
properties
.
horizontal
?
"
Horizontal
"
:
"
Vertical
"
),
callback
:
()
=>
{
this
.
properties
.
horizontal
=
!
this
.
properties
.
horizontal
;
this
.
applyOrientation
();
},
}
);
}
applyOrientation
()
{
this
.
horizontal
=
this
.
properties
.
horizontal
;
if
(
this
.
horizontal
)
{
// we correct the input position, because LiteGraphNode.horizontal
// doesn't account for title presence
// which reroute nodes don't have
this
.
inputs
[
0
].
pos
=
[
this
.
size
[
0
]
/
2
,
0
];
}
else
{
delete
this
.
inputs
[
0
].
pos
;
}
app
.
graph
.
setDirtyCanvas
(
true
,
true
);
}
computeSize
()
{
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