Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/scripts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useCanvasPositionConversion } from '@/composables/element/useCanvasPosi
import { layoutStore } from '@/renderer/core/layout/store/layoutStore'
import { syncLayoutStoreNodeBoundsFromGraph } from '@/renderer/core/layout/sync/syncLayoutStoreFromGraph'
import { flushScheduledSlotLayoutSync } from '@/renderer/extensions/vueNodes/composables/useSlotElementTracking'
import { createRafBatch } from '@/utils/rafBatch'

import { st, t } from '@/i18n'
import { ChangeTracker } from '@/scripts/changeTracker'
Expand Down Expand Up @@ -949,10 +950,16 @@ export class ComfyApp {

this.rootGraph.start()

// Ensure the canvas fills the window
// Coalesce ResizeObserver bursts during splitter / window drags into one
// resize per frame to stop redundant draw(true, true) calls and the link
// overlay redraw lag they cause.
const scheduleCanvasResize = createRafBatch(() => {
const canvasEl = this.canvasElRef.value
if (canvasEl) this.resizeCanvas(canvasEl)
})
useResizeObserver(this.canvasElRef, ([canvasEl]) => {
if (canvasEl.target instanceof HTMLCanvasElement) {
this.resizeCanvas(canvasEl.target)
scheduleCanvasResize.schedule()
}
})

Expand Down
Loading