Line data Source code
1 : import type { ReadOnlyRect } from '@comfyorg/shared-frontend-utils/geometry'
2 : import type { LGraphCanvas } from '@/lib/litegraph/src/litegraph'
3 : import { useAgentPanelStore } from '@/workbench/extensions/agent/stores/agent/agentPanelStore'
4 :
5 203 : export function visibleCanvasViewport(
6 : canvas: Pick<LGraphCanvas, 'ds'>
7 : ): ReadOnlyRect {
8 203 : const panel = useAgentPanelStore()
9 203 : const [width, height] = canvas.ds.getViewportSize()
10 : const coveredWidth = panel.isVisible ? panel.width : 0
11 : const uncoveredWidth = width - coveredWidth
12 203 : return [0, 0, uncoveredWidth > 0 ? uncoveredWidth : width, height]
13 : }
|