LCOV - code coverage report
Current view: top level - packages/viewport3d/src/load3d - ControlsManager.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 86.7 % 15 13
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type * as THREE from 'three'
       2              : import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
       3              : 
       4              : import type { ControlsManagerInterface } from './interfaces'
       5              : 
       6           24 : export class ControlsManager implements ControlsManagerInterface {
       7              :   controls: OrbitControls
       8              : 
       9              :   constructor(interactionElement: HTMLElement, camera: THREE.Camera) {
      10           27 :     this.controls = new OrbitControls(camera, interactionElement)
      11           27 :     this.controls.enableDamping = true
      12              :   }
      13              : 
      14              :   init(): void {}
      15              : 
      16              :   dispose(): void {
      17            1 :     this.controls.dispose()
      18              :   }
      19              : 
      20              :   handleResize(): void {}
      21              : 
      22              :   update(): void {
      23          999 :     this.controls.update()
      24              :   }
      25              : 
      26              :   updateCamera(camera: THREE.Camera): void {
      27           52 :     const position = this.controls.object.position.clone()
      28           52 :     const target = this.controls.target.clone()
      29              : 
      30           52 :     this.controls.object = camera
      31           52 :     this.controls.target = target
      32           52 :     camera.position.copy(position)
      33           52 :     this.controls.update()
      34              :   }
      35              : 
      36              :   detach(): void {
      37            0 :     this.controls.enabled = false
      38              :   }
      39              : 
      40              :   attach(): void {
      41            0 :     this.controls.enabled = true
      42              :   }
      43              : 
      44              :   reset(): void {
      45           18 :     this.controls.target.set(0, 0, 0)
      46           18 :     this.controls.update()
      47              :   }
      48              : }
        

Generated by: LCOV version 2.0-1