TrackballControls constructor

TrackballControls(
  1. dynamic object,
  2. GlobalKey<DomLikeListenableState> listenableKey
)

Implementation

TrackballControls(object, GlobalKey<DomLikeListenableState> listenableKey)
    : super() {
  scope = this;

  this.object = object;
  this.listenableKey = listenableKey;
  // this.domElement.style.touchAction = 'none'; // disable touch scroll

  // API

  // for reset

  this.target0 = this.target.clone();
  this.position0 = this.object.position.clone();
  this.up0 = this.object.up.clone();
  this.zoom0 = this.object.zoom;

  this.domElement.addEventListener('contextmenu', contextmenu);

  this.domElement.addEventListener('pointerdown', onPointerDown);
  this.domElement.addEventListener('pointercancel', onPointerCancel);
  this.domElement.addEventListener('wheel', onMouseWheel);

  // TODO
  // window.addEventListener( 'keydown', keydown );
  // window.addEventListener( 'keyup', keyup );

  this.handleResize();

  // force an update at start
  this.update();
}