mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-24 14:45:36 +00:00
## Summary Pull two pure helpers out of `Load3d` into a sibling module. Mechanical refactor — no behavior change. Second of four small PRs splitting up the https://github.com/Comfy-Org/ComfyUI_frontend/pull/11495. ## Changes - **What**: New `load3dViewport.ts` exports two pure functions: - `computeLetterboxedViewport({ width, height }, targetAspectRatio)` returns `{ offsetX, offsetY, width, height }` — the aspect-ratio fitting math that was duplicated inline in three places (`renderMainScene`, `setBackgroundImage`, `handleResize`). - `isLoad3dActive(flags)` consumes the activity-flag struct used by the rAF tick gate; `Load3d.isActive()` now delegates to it. ## Review Focus - The three call sites in `Load3d.ts` produce byte-identical viewport rectangles for any `(containerWidth, containerHeight, targetAspect)` triple — same branch on aspect-ratio comparison, same offset derivation. Simplest way to verify: diff the math. - `isLoad3dActive` ORs the same six flags as before in the same order. Old implementation read `this.STATUS_MOUSE_ON_NODE` etc. directly; new one reads them through a flags object built at the call site. - 13 unit tests cover the helpers: the "wider" / "taller" / "matching" aspect cases for letterboxing, and each individual flag flipping `isLoad3dActive` on by itself. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11624-refactor-load3d-extract-viewport-math-to-load3dViewport-34d6d73d365081ab9af5fc445bf5bd5a) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com>
Core Extensions
This directory contains the core extensions that provide essential functionality to the ComfyUI frontend.
📚 Full Documentation
The complete documentation for core extensions has been moved to:
Quick Reference
This directory contains built-in extensions that ship with ComfyUI, including:
- Image Processing: maskeditor, uploadImage, saveImageExtraOutput, clipspace
- Graph Management: groupNode, groupNodeManage, groupOptions, rerouteNode, noteNode
- Input Handling: widgetInputs, uploadAudio, webcamCapture, simpleTouchSupport
- UI Enhancements: contextMenuFilter, previewAny, nodeTemplates
- Text Processing: dynamicPrompts, editAttention
- Platform Support: electronAdapter
and more.
See Also
- Extension Development Guide - How to develop extensions
- Extension Documentation Index - Overview of all extension docs
- ComfyExtension Interface - TypeScript interface for extensions