projects/atft/src/lib/control/orbit-controls.component.ts
OnChanges
selector | atft-orbit-controls |
styleUrls | controls.component.scss |
template |
|
Properties |
|
Methods |
|
Inputs |
constructor(rendererService: RendererService, raycasterService: RaycasterService)
|
|||||||||
Parameters :
|
rotateSpeed | |
Type : number
|
|
Default value : 1.0
|
|
zoomSpeed | |
Type : number
|
|
Default value : 1.2
|
|
listeningControlElement | |
Type : ElementRef
|
|
Inherited from
AbstractOrbitControls
|
|
Defined in
AbstractOrbitControls:22
|
|
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 |
ngOnChanges | ||||||
ngOnChanges(changes: SimpleChanges)
|
||||||
Inherited from
AbstractOrbitControls
|
||||||
Defined in
AbstractOrbitControls:34
|
||||||
Parameters :
Returns :
void
|
Protected setUpControls |
setUpControls()
|
Inherited from
AbstractOrbitControls
|
Defined in
AbstractOrbitControls:25
|
Returns :
void
|
Private configureListeners |
configureListeners()
|
Inherited from
AbstractOrbitControls
|
Defined in
AbstractOrbitControls:58
|
Returns :
void
|
ngAfterViewInit |
ngAfterViewInit()
|
Inherited from
AbstractOrbitControls
|
Defined in
AbstractOrbitControls:74
|
Returns :
void
|
ngOnDestroy |
ngOnDestroy()
|
Inherited from
AbstractOrbitControls
|
Defined in
AbstractOrbitControls:49
|
Returns :
void
|
Public reset |
reset()
|
Inherited from
AbstractOrbitControls
|
Defined in
AbstractOrbitControls:88
|
Returns :
void
|
childCameras |
Type : QueryList<AbstractCamera<THREE.Camera>>
|
Decorators :
@ContentChildren(AbstractCamera, {descendants: true})
|
Inherited from
AbstractOrbitControls
|
Defined in
AbstractOrbitControls:13
|
Protected controls |
Type : T
|
Inherited from
AbstractOrbitControls
|
Defined in
AbstractOrbitControls:24
|
webGlRenderer |
Type : RendererCanvasComponent
|
Decorators :
@ContentChild(RendererCanvasComponent, {static: false})
|
Inherited from
AbstractOrbitControls
|
Defined in
AbstractOrbitControls:14
|
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%;
}