@@ -5,11 +5,12 @@ import {
55 CUSTOM_ELEMENTS_SCHEMA ,
66 effect ,
77 ElementRef ,
8+ inject ,
89 input ,
910 untracked ,
1011 viewChild ,
1112} from '@angular/core' ;
12- import { extend , NgtArgs , NgtMesh , omit , pick } from 'angular-three' ;
13+ import { extend , NgtArgs , NgtMesh , NgtObjectEvents , NgtObjectEventsOutputs , omit , pick } from 'angular-three' ;
1314import { mergeInputs } from 'ngxtension/inject-inputs' ;
1415import { ExtrudeGeometry , Mesh , Shape } from 'three' ;
1516import { toCreasedNormals } from 'three-stdlib' ;
@@ -60,6 +61,7 @@ const defaultOptions: NgtsRoundedBoxOptions = {
6061 schemas : [ CUSTOM_ELEMENTS_SCHEMA ] ,
6162 changeDetection : ChangeDetectionStrategy . OnPush ,
6263 imports : [ NgtArgs ] ,
64+ hostDirectives : [ { directive : NgtObjectEvents , outputs : NgtObjectEventsOutputs } ] ,
6365} )
6466export class NgtsRoundedBox {
6567 options = input ( defaultOptions , { transform : mergeInputs ( defaultOptions ) } ) ;
@@ -113,6 +115,16 @@ export class NgtsRoundedBox {
113115 constructor ( ) {
114116 extend ( { ExtrudeGeometry, Mesh } ) ;
115117
118+ const objectEvents = inject ( NgtObjectEvents , { host : true } ) ;
119+
120+ effect (
121+ ( ) => {
122+ const mesh = this . meshRef ( ) . nativeElement ;
123+ objectEvents . ngtObjectEvents . set ( mesh ) ;
124+ } ,
125+ { allowSignalWrites : true } ,
126+ ) ;
127+
116128 effect ( ( ) => {
117129 const geometry = this . geometryRef ( ) ?. nativeElement ;
118130 if ( ! geometry ) return ;
0 commit comments