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
cef30cc6
"src/lib/vscode:/vscode.git/clone" did not exist on "736d8586f1b945f88545ed7ac094794d263df1a0"
Commit
cef30cc6
authored
Jul 11, 2023
by
comfyanonymous
Browse files
Merge branch 'hidpi-canvas' of
https://github.com/EHfive/ComfyUI
parents
880c9b92
05e6eac7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
web/scripts/app.js
web/scripts/app.js
+19
-3
No files found.
web/scripts/app.js
View file @
cef30cc6
...
@@ -4,6 +4,18 @@ import { api } from "./api.js";
...
@@ -4,6 +4,18 @@ import { api } from "./api.js";
import
{
defaultGraph
}
from
"
./defaultGraph.js
"
;
import
{
defaultGraph
}
from
"
./defaultGraph.js
"
;
import
{
getPngMetadata
,
importA1111
,
getLatentMetadata
}
from
"
./pnginfo.js
"
;
import
{
getPngMetadata
,
importA1111
,
getLatentMetadata
}
from
"
./pnginfo.js
"
;
// DPI scaling fix, see https://github.com/comfyanonymous/ComfyUI/pull/845
(
function
()
{
const
originalRenderInfo
=
LGraphCanvas
.
prototype
.
renderInfo
LGraphCanvas
.
prototype
.
renderInfo
=
function
(
ctx
,
x
,
y
)
{
// Patch renderInfo() to use canvas.offsetHeight instead of canvas.height as bottom viewpoint bound
if
(
!
y
)
{
y
=
this
.
canvas
.
offsetHeight
-
80
}
return
originalRenderInfo
.
call
(
this
,
ctx
,
x
,
y
)
}
})()
/**
/**
* @typedef {import("types/comfy").ComfyExtension} ComfyExtension
* @typedef {import("types/comfy").ComfyExtension} ComfyExtension
*/
*/
...
@@ -1038,8 +1050,12 @@ export class ComfyApp {
...
@@ -1038,8 +1050,12 @@ export class ComfyApp {
this
.
graph
.
start
();
this
.
graph
.
start
();
function
resizeCanvas
()
{
function
resizeCanvas
()
{
canvasEl
.
width
=
canvasEl
.
offsetWidth
;
// Limit minimal scale to 1, see https://github.com/comfyanonymous/ComfyUI/pull/845
canvasEl
.
height
=
canvasEl
.
offsetHeight
;
const
scale
=
Math
.
max
(
window
.
devicePixelRatio
,
1
);
const
{
width
,
height
}
=
canvasEl
.
getBoundingClientRect
();
canvasEl
.
width
=
Math
.
round
(
width
*
scale
);
canvasEl
.
height
=
Math
.
round
(
height
*
scale
);
canvasEl
.
getContext
(
"
2d
"
).
scale
(
scale
,
scale
);
canvas
.
draw
(
true
,
true
);
canvas
.
draw
(
true
,
true
);
}
}
...
...
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