Comfy-Org / Comfy-Org/ComfyUI_frontend

No non-litegraph camera API: six call sites reach into canvas.ds / animateToBounds directly

Open
#14,388 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

There is no way to move the camera that does not go through litegraph.

`animateToBounds` and `fitToBounds` live in `lib/litegraph/src/DragAndScale.ts` and `LGraphCanvas.ts`. The reactive `camera` in `useTransformState` is a read-only *mirror* of `canvas.ds` — it has no setter. So any feature that needs to frame something reaches into `canvas.ds` or `canvas.animateToBounds` directly.

Six call sites did exactly that:

- `services/litegraphService.ts` ×2
- `components/rightSidePanel/parameters/SectionWidgets.vue`
- `composables/canvas/useFocusNode.ts`
- `renderer/extensions/firstRunTour/tour/cameraFraming.ts` ×2

Given the direction away from litegraph for new work, that is six places to find and change later, in six different owners' code.

**A seam now exists.** `focusBounds(bounds, { zoom?, duration? })` and `cameraViewport()` in `useFocusNode`, with all six sites routed through them. That is deliberately *not* a camera abstraction — it does not own state, does not model a viewport, and does not try to be renderer-agnostic. It gives one somewhere to land.

**What is still missing** is the abstraction itself: a camera that owns its own position and animation and that litegraph reads from, rather than one derived from litegraph's. That is the piece a second canvas-anchored feature will need — without it, `cameraFraming`-shaped code gets written again per feature, which is how `heuristicRoles` happened.

No urgency while there is one canvas tour. Filing so it is a known gap rather than a surprise, and so the seam has something to point at.

Found while reviewing the first-run onboarding tour (#14140–#14145).

Contributor guide

Open the contributing guide

Research direction

Start with composables/canvas/useFocusNode.ts and its focusBounds/cameraViewport seam, then inspect the six listed call sites and the camera behavior in lib/litegraph/src/DragAndScale.ts and LGraphCanvas.ts. Done means a camera owns its position and animation, litegraph reads from it, and new canvas features no longer reach directly into canvas.ds or canvas.animateToBounds.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.