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
90aa5970
Commit
90aa5970
authored
Jul 12, 2023
by
comfyanonymous
Browse files
Add back roundRect to fix issue on firefox ESR.
parent
f4b93906
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
web/lib/litegraph.core.js
web/lib/litegraph.core.js
+76
-0
No files found.
web/lib/litegraph.core.js
View file @
90aa5970
...
...
@@ -13387,6 +13387,82 @@ LGraphNode.prototype.executeAction = function(action)
};
//API *************************************************
//like rect but rounded corners
if
(
typeof
(
window
)
!=
"
undefined
"
&&
window
.
CanvasRenderingContext2D
&&
!
window
.
CanvasRenderingContext2D
.
prototype
.
roundRect
)
{
window
.
CanvasRenderingContext2D
.
prototype
.
roundRect
=
function
(
x
,
y
,
w
,
h
,
radius
,
radius_low
)
{
var
top_left_radius
=
0
;
var
top_right_radius
=
0
;
var
bottom_left_radius
=
0
;
var
bottom_right_radius
=
0
;
if
(
radius
===
0
)
{
this
.
rect
(
x
,
y
,
w
,
h
);
return
;
}
if
(
radius_low
===
undefined
)
radius_low
=
radius
;
//make it compatible with official one
if
(
radius
!=
null
&&
radius
.
constructor
===
Array
)
{
if
(
radius
.
length
==
1
)
top_left_radius
=
top_right_radius
=
bottom_left_radius
=
bottom_right_radius
=
radius
[
0
];
else
if
(
radius
.
length
==
2
)
{
top_left_radius
=
bottom_right_radius
=
radius
[
0
];
top_right_radius
=
bottom_left_radius
=
radius
[
1
];
}
else
if
(
radius
.
length
==
4
)
{
top_left_radius
=
radius
[
0
];
top_right_radius
=
radius
[
1
];
bottom_left_radius
=
radius
[
2
];
bottom_right_radius
=
radius
[
3
];
}
else
return
;
}
else
//old using numbers
{
top_left_radius
=
radius
||
0
;
top_right_radius
=
radius
||
0
;
bottom_left_radius
=
radius_low
||
0
;
bottom_right_radius
=
radius_low
||
0
;
}
//top right
this
.
moveTo
(
x
+
top_left_radius
,
y
);
this
.
lineTo
(
x
+
w
-
top_right_radius
,
y
);
this
.
quadraticCurveTo
(
x
+
w
,
y
,
x
+
w
,
y
+
top_right_radius
);
//bottom right
this
.
lineTo
(
x
+
w
,
y
+
h
-
bottom_right_radius
);
this
.
quadraticCurveTo
(
x
+
w
,
y
+
h
,
x
+
w
-
bottom_right_radius
,
y
+
h
);
//bottom left
this
.
lineTo
(
x
+
bottom_right_radius
,
y
+
h
);
this
.
quadraticCurveTo
(
x
,
y
+
h
,
x
,
y
+
h
-
bottom_left_radius
);
//top left
this
.
lineTo
(
x
,
y
+
bottom_left_radius
);
this
.
quadraticCurveTo
(
x
,
y
,
x
+
top_left_radius
,
y
);
};
}
//if
function
compareObjects
(
a
,
b
)
{
for
(
var
i
in
a
)
{
if
(
a
[
i
]
!=
b
[
i
])
{
...
...
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