Skip to content

Refactor CameraManager.ts: Modularize Camera and View Management #53

Description

@snjsomnath

Current Issues with CameraManager.ts (408 lines):

  • Complex camera type switching and view management in a single file.
  • Animation system is mixed with camera controls.
  • Transition logic is tightly coupled with camera management.

Recommended Modularization Structure:

camera/
├── CameraManager.ts (main orchestrator)
├── types/
│   ├── PerspectiveCameraController.ts
│   └── OrthographicCameraController.ts
├── views/
│   ├── ViewManager.ts
│   └── ViewAnimator.ts
├── controls/
│   ├── OrbitControlsManager.ts
│   └── CameraTransitions.ts
└── utils/
    ├── cameraCalculations.ts
    └── viewHelpers.ts

Actionable Steps:

  1. Extract camera type controllers into the types/ directory.
  2. Move view management and animation into the views/ directory.
  3. Separate controls and transition logic into the controls/ directory.
  4. Move helper and calculation utilities into the utils/ directory.
  5. Use CameraManager.ts as the main orchestrator that delegates responsibilities.
  6. Gradually migrate logic from CameraManager.ts into these new modules for clarity and maintainability.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions