File

projects/atft/src/lib/control/orbit-controls.component.ts

Extends

AbstractOrbitControls

Implements

OnChanges

Metadata

Index

Properties
Methods
Inputs

Constructor

constructor(rendererService: RendererService, raycasterService: RaycasterService)
Parameters :
Name Type Optional
rendererService RendererService No
raycasterService RaycasterService No

Inputs

rotateSpeed
Type : number
Default value : 1.0
zoomSpeed
Type : number
Default value : 1.2
listeningControlElement
Type : ElementRef
Inherited from AbstractOrbitControls

The element on whose native element the orbit control will listen for mouse events.

Note that keyboard events are still listened for on the global window object, this is a known issue from Three.js: https://github.com/mrdoob/three.js/pull/10315

Methods

ngOnChanges
ngOnChanges(changes: SimpleChanges)
Inherited from AbstractOrbitControls
Parameters :
Name Type Optional
changes SimpleChanges No
Returns : void
Protected setUpControls
setUpControls()
Inherited from AbstractOrbitControls
Returns : void
Private configureListeners
configureListeners()
Inherited from AbstractOrbitControls
Returns : void
ngAfterViewInit
ngAfterViewInit()
Inherited from AbstractOrbitControls
Returns : void
ngOnDestroy
ngOnDestroy()
Inherited from AbstractOrbitControls
Returns : void
Public reset
reset()
Inherited from AbstractOrbitControls
Returns : void

Properties

childCameras
Type : QueryList<AbstractCamera<THREE.Camera>>
Decorators :
@ContentChildren(AbstractCamera, {descendants: true})
Inherited from AbstractOrbitControls
Protected controls
Type : T
Inherited from AbstractOrbitControls
webGlRenderer
Type : RendererCanvasComponent
Decorators :
@ContentChild(RendererCanvasComponent, {static: false})
Inherited from AbstractOrbitControls
import {Component, Input, OnChanges, SimpleChanges} from '@angular/core';
import {OrbitControls} from 'three/examples/jsm/controls/OrbitControls';
import {RendererService} from '../renderer/renderer.service';
import {RaycasterService} from '../raycaster/raycaster.service';
import {AbstractOrbitControls} from './abstract-orbit-controls';

@Component({
  selector: 'atft-orbit-controls',
  template: `
      <ng-content></ng-content>`,
  styleUrls: ['controls.component.scss']
})
export class OrbitControlsComponent extends AbstractOrbitControls<OrbitControls> implements OnChanges {

  @Input() rotateSpeed = 1.0;
  @Input() zoomSpeed = 1.2;

  constructor(
    protected override rendererService: RendererService,
    protected override raycasterService: RaycasterService
  ) {
    super(rendererService, raycasterService);
  }

  protected setUpControls() {
    this.controls = new OrbitControls(
      this.childCameras.first.camera,
      this.listeningControlElement && this.listeningControlElement.nativeElement
    );
    this.controls.rotateSpeed = this.rotateSpeed;
    this.controls.zoomSpeed = this.zoomSpeed;
  }

  override ngOnChanges(changes: SimpleChanges) {
    if (!this.controls) {
      return;
    }
    super.ngOnChanges(changes);

    if (changes['rotateSpeed']) {
      this.controls.rotateSpeed = this.rotateSpeed;
    }
    if (changes['zoomSpeed']) {
      this.controls.zoomSpeed = this.zoomSpeed;
    }
  }

}

controls.component.scss

:host {
  display: flex;
  flex: 1;
  height: 100%;
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""