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
4f63ee99
Commit
4f63ee99
authored
May 10, 2024
by
comfyanonymous
Browse files
Add a button to reset the view.
parent
f374ea71
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
web/scripts/app.js
web/scripts/app.js
+6
-0
web/scripts/ui.js
web/scripts/ui.js
+7
-0
No files found.
web/scripts/app.js
View file @
4f63ee99
...
@@ -2313,6 +2313,12 @@ export class ComfyApp {
...
@@ -2313,6 +2313,12 @@ export class ComfyApp {
await
this
.
#
invokeExtensionsAsync
(
"
refreshComboInNodes
"
,
defs
);
await
this
.
#
invokeExtensionsAsync
(
"
refreshComboInNodes
"
,
defs
);
}
}
resetView
()
{
app
.
canvas
.
ds
.
scale
=
1
;
app
.
canvas
.
ds
.
offset
=
[
0
,
0
]
app
.
graph
.
setDirtyCanvas
(
true
,
true
);
}
/**
/**
* Clean current state
* Clean current state
*/
*/
...
...
web/scripts/ui.js
View file @
4f63ee99
...
@@ -597,16 +597,23 @@ export class ComfyUI {
...
@@ -597,16 +597,23 @@ export class ComfyUI {
if
(
!
confirmClear
.
value
||
confirm
(
"
Clear workflow?
"
))
{
if
(
!
confirmClear
.
value
||
confirm
(
"
Clear workflow?
"
))
{
app
.
clean
();
app
.
clean
();
app
.
graph
.
clear
();
app
.
graph
.
clear
();
app
.
resetView
();
}
}
}
}
}),
}),
$el
(
"
button
"
,
{
$el
(
"
button
"
,
{
id
:
"
comfy-load-default-button
"
,
textContent
:
"
Load Default
"
,
onclick
:
async
()
=>
{
id
:
"
comfy-load-default-button
"
,
textContent
:
"
Load Default
"
,
onclick
:
async
()
=>
{
if
(
!
confirmClear
.
value
||
confirm
(
"
Load default workflow?
"
))
{
if
(
!
confirmClear
.
value
||
confirm
(
"
Load default workflow?
"
))
{
app
.
resetView
();
await
app
.
loadGraphData
()
await
app
.
loadGraphData
()
}
}
}
}
}),
}),
$el
(
"
button
"
,
{
id
:
"
comfy-reset-view-button
"
,
textContent
:
"
Reset View
"
,
onclick
:
async
()
=>
{
app
.
resetView
();
}
}),
]);
]);
const
devMode
=
this
.
settings
.
addSetting
({
const
devMode
=
this
.
settings
.
addSetting
({
...
...
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