@@ -7,10 +7,11 @@ import {
77 TemplateRef ,
88 contentChild ,
99 effect ,
10+ inject ,
1011 input ,
1112 viewChild ,
1213} from '@angular/core' ;
13- import { NgtThreeElements , beforeRender , extend , injectStore , omit , pick } from 'angular-three' ;
14+ import { NgtElementEvents , NgtThreeElements , beforeRender , extend , injectStore , omit , pick } from 'angular-three' ;
1415import { fbo } from 'angular-three-soba/misc' ;
1516import { mergeInputs } from 'ngxtension/inject-inputs' ;
1617import * as THREE from 'three' ;
@@ -54,6 +55,7 @@ const defaultOptions: NgtsPerspectiveCameraOptions = {
5455 imports : [ NgTemplateOutlet ] ,
5556 changeDetection : ChangeDetectionStrategy . OnPush ,
5657 schemas : [ CUSTOM_ELEMENTS_SCHEMA ] ,
58+ hostDirectives : [ { directive : NgtElementEvents , outputs : [ 'created' , 'updated' , 'attached' ] } ] ,
5759} )
5860export class NgtsPerspectiveCamera {
5961 options = input ( defaultOptions , { transform : mergeInputs ( defaultOptions ) } ) ;
@@ -65,6 +67,7 @@ export class NgtsPerspectiveCamera {
6567 cameraRef = viewChild . required < ElementRef < THREE . PerspectiveCamera > > ( 'camera' ) ;
6668 groupRef = viewChild . required < ElementRef < THREE . Group > > ( 'group' ) ;
6769
70+ private elementEvents = inject ( NgtElementEvents , { host : true } ) ;
6871 private store = injectStore ( ) ;
6972
7073 private manual = pick ( this . options , 'manual' ) ;
@@ -74,6 +77,7 @@ export class NgtsPerspectiveCamera {
7477
7578 constructor ( ) {
7679 extend ( { PerspectiveCamera, Group } ) ;
80+ this . elementEvents . ngtElementEvents . set ( this . cameraRef ) ;
7781
7882 effect ( ( onCleanup ) => {
7983 const makeDefault = this . makeDefault ( ) ;
0 commit comments