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
d9220a0b
Commit
d9220a0b
authored
Apr 08, 2023
by
EllangoK
Browse files
link colors change after palette swap
didn't work previously as same function was defined repeatedly
parent
327e49da
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
18 deletions
+23
-18
web/extensions/core/colorPalette.js
web/extensions/core/colorPalette.js
+23
-18
No files found.
web/extensions/core/colorPalette.js
View file @
d9220a0b
...
...
@@ -238,6 +238,7 @@ app.registerExtension({
if
(
colorPalette
.
colors
)
{
if
(
colorPalette
.
colors
.
node_slot
)
{
Object
.
assign
(
app
.
canvas
.
default_connection_color_byType
,
colorPalette
.
colors
.
node_slot
);
customizeRenderLink
(
colorPalette
);
}
if
(
colorPalette
.
colors
.
litegraph_base
)
{
// Everything updates correctly in the loop, except the Node Title and Link Color for some reason
...
...
@@ -250,7 +251,6 @@ app.registerExtension({
}
}
}
customizeRenderLink
(
colorPalette
);
app
.
canvas
.
draw
(
true
,
true
);
}
};
...
...
@@ -411,7 +411,8 @@ app.registerExtension({
function
customizeRenderLink
(
colorPalette
)
{
var
LGraphCanvas
=
LiteGraph
.
LGraphCanvas
;
function
getLinkColor
(
link
,
inputNode
,
outputNode
,
colorPalette
)
{
if
(
!
LGraphCanvas
.
prototype
.
getLinkColor
)
{
LGraphCanvas
.
prototype
.
getLinkColor
=
function
(
link
,
inputNode
,
outputNode
,
colorPalette
)
{
let
color
=
null
;
if
(
link
&&
link
.
color
)
{
color
=
link
.
color
;
...
...
@@ -426,9 +427,12 @@ function customizeRenderLink(colorPalette) {
}
}
return
color
;
};
}
var
originalRenderLink
=
LGraphCanvas
.
prototype
.
renderLink
;
if
(
!
LGraphCanvas
.
prototype
.
originalRenderLink
)
{
LGraphCanvas
.
prototype
.
originalRenderLink
=
LGraphCanvas
.
prototype
.
renderLink
;
}
LGraphCanvas
.
prototype
.
renderLink
=
function
(
ctx
,
...
...
@@ -445,10 +449,11 @@ function customizeRenderLink(colorPalette) {
if
(
link
)
{
const
inputNode
=
this
.
graph
.
getNodeById
(
link
.
origin_id
);
const
outputNode
=
this
.
graph
.
getNodeById
(
link
.
target_id
);
color
=
getLinkColor
(
link
,
inputNode
,
outputNode
,
colorPalette
);
color
=
this
.
getLinkColor
(
link
,
inputNode
,
outputNode
,
colorPalette
);
}
originalRenderLink
.
call
(
// call the original renderLink function
this
.
originalRenderLink
.
call
(
this
,
ctx
,
a
,
...
...
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