Canvas DPI scaling
This commit is contained in:
@@ -76,10 +76,16 @@
|
|||||||
#comfy-graph {
|
#comfy-graph {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#graph-canvas {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
:global(html, body) {
|
:global(html, body) {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
|
font-family: Arial;
|
||||||
}
|
}
|
||||||
|
|
||||||
:global(.splitpanes__pane) {
|
:global(.splitpanes__pane) {
|
||||||
|
|||||||
@@ -77,8 +77,19 @@ export default class ComfyApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resizeCanvas() {
|
resizeCanvas() {
|
||||||
this.canvasEl.width = this.canvasEl.parentElement.clientWidth;
|
// get current size of the canvas
|
||||||
this.canvasEl.height = this.canvasEl.parentElement.clientHeight;
|
let rect = this.canvasEl.parentElement.getBoundingClientRect();
|
||||||
|
|
||||||
|
// increase the actual size of our canvas
|
||||||
|
this.canvasEl.width = rect.width * window.devicePixelRatio;
|
||||||
|
this.canvasEl.height = rect.height * window.devicePixelRatio;
|
||||||
|
|
||||||
|
// ensure all drawing operations are scaled
|
||||||
|
this.canvasCtx.scale(window.devicePixelRatio, window.devicePixelRatio);
|
||||||
|
|
||||||
|
// scale everything down using CSS
|
||||||
|
this.canvasEl.style.width = rect.width + 'px';
|
||||||
|
this.canvasEl.style.height = rect.height + 'px';
|
||||||
this.lCanvas.draw(true, true);
|
this.lCanvas.draw(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user