@@ -16,7 +16,7 @@ import {
16
16
ViewChild ,
17
17
ViewContainerRef ,
18
18
} from '@angular/core' ;
19
- import { injectNgxResize , NgxResizeResult , provideNgxResizeOptions } from 'ngx-resize' ;
19
+ import { NgxResize , NgxResizeResult , provideNgxResizeOptions } from 'ngx-resize' ;
20
20
import { filter } from 'rxjs' ;
21
21
import { injectNgtLoader } from './loader' ;
22
22
import { provideNgtRenderer } from './renderer/provider' ;
@@ -26,36 +26,16 @@ import type { NgtCanvasInputs, NgtDomEvent, NgtDpr, NgtState } from './types';
26
26
import { is } from './utils/is' ;
27
27
import { createPointerEvents } from './web/events' ;
28
28
29
- @Component ( {
30
- selector : 'ngt-canvas-container' ,
31
- standalone : true ,
32
- template : '<ng-content />' ,
33
- styles : [
34
- `
35
- :host {
36
- display: block;
37
- width: 100%;
38
- height: 100%;
39
- }
40
- ` ,
41
- ] ,
42
- providers : [ provideNgxResizeOptions ( { emitInZone : false } ) ] ,
43
- } )
44
- export class NgtCanvasContainer {
45
- @Output ( ) canvasResize = injectNgxResize ( ) ;
46
- }
47
-
48
29
@Component ( {
49
30
selector : 'ngt-canvas' ,
50
31
standalone : true ,
51
32
template : `
52
- <ngt-canvas-container (canvasResize )="onResize($event)">
33
+ <div (ngxResize )="onResize($event)" style="height: 100%; width: 100%; ">
53
34
<canvas #glCanvas style="display: block;"></canvas>
54
- <ng-container #glAnchor />
55
- </ngt-canvas-container>
35
+ </div>
56
36
` ,
57
- imports : [ NgtCanvasContainer ] ,
58
- providers : [ NgtStore ] ,
37
+ imports : [ NgxResize ] ,
38
+ providers : [ NgtStore , provideNgxResizeOptions ( { emitInZone : false } ) ] ,
59
39
styles : [
60
40
`
61
41
:host {
@@ -158,7 +138,7 @@ export class NgtCanvas extends NgtRxStore<NgtCanvasInputs> implements OnInit, On
158
138
@Output ( ) pointerMissed = new EventEmitter < MouseEvent > ( ) ;
159
139
160
140
@ViewChild ( 'glCanvas' , { static : true } ) glCanvas ! : ElementRef < HTMLCanvasElement > ;
161
- @ViewChild ( 'glAnchor ' , { static : true , read : ViewContainerRef } ) glAnchor ! : ViewContainerRef ;
141
+ @ViewChild ( 'glCanvas ' , { static : true , read : ViewContainerRef } ) glAnchor ! : ViewContainerRef ;
162
142
163
143
private glRef ?: ComponentRef < unknown > ;
164
144
private glEnvInjector ?: EnvironmentInjector ;
@@ -242,7 +222,9 @@ export class NgtCanvas extends NgtRxStore<NgtCanvasInputs> implements OnInit, On
242
222
] ,
243
223
this . envInjector
244
224
) ;
245
- this . glRef = this . glAnchor . createComponent ( this . sceneGraph , { environmentInjector : this . glEnvInjector } ) ;
225
+ this . glRef = this . glAnchor . createComponent ( this . sceneGraph , {
226
+ environmentInjector : this . glEnvInjector ,
227
+ } ) ;
246
228
this . glRef . changeDetectorRef . detach ( ) ;
247
229
248
230
// here, we override the detectChanges to also call detectChanges on the ComponentRef
0 commit comments