@@ -7,10 +7,11 @@ import {
7
7
TemplateRef ,
8
8
contentChild ,
9
9
effect ,
10
+ inject ,
10
11
input ,
11
12
viewChild ,
12
13
} 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' ;
14
15
import { fbo } from 'angular-three-soba/misc' ;
15
16
import { mergeInputs } from 'ngxtension/inject-inputs' ;
16
17
import * as THREE from 'three' ;
@@ -54,6 +55,7 @@ const defaultOptions: NgtsPerspectiveCameraOptions = {
54
55
imports : [ NgTemplateOutlet ] ,
55
56
changeDetection : ChangeDetectionStrategy . OnPush ,
56
57
schemas : [ CUSTOM_ELEMENTS_SCHEMA ] ,
58
+ hostDirectives : [ { directive : NgtElementEvents , outputs : [ 'created' , 'updated' , 'attached' ] } ] ,
57
59
} )
58
60
export class NgtsPerspectiveCamera {
59
61
options = input ( defaultOptions , { transform : mergeInputs ( defaultOptions ) } ) ;
@@ -65,6 +67,7 @@ export class NgtsPerspectiveCamera {
65
67
cameraRef = viewChild . required < ElementRef < THREE . PerspectiveCamera > > ( 'camera' ) ;
66
68
groupRef = viewChild . required < ElementRef < THREE . Group > > ( 'group' ) ;
67
69
70
+ private elementEvents = inject ( NgtElementEvents , { host : true } ) ;
68
71
private store = injectStore ( ) ;
69
72
70
73
private manual = pick ( this . options , 'manual' ) ;
@@ -74,6 +77,7 @@ export class NgtsPerspectiveCamera {
74
77
75
78
constructor ( ) {
76
79
extend ( { PerspectiveCamera, Group } ) ;
80
+ this . elementEvents . ngtElementEvents . set ( this . cameraRef ) ;
77
81
78
82
effect ( ( onCleanup ) => {
79
83
const makeDefault = this . makeDefault ( ) ;
0 commit comments