1+ /**
2+ * @license
3+ * Copyright Google LLC All Rights Reserved.
4+ *
5+ * Use of this source code is governed by an MIT-style license that can be
6+ * found in the LICENSE file at https://angular.dev/license
7+ */
8+
19import {
210 Component ,
3- HostBinding ,
411 Input ,
512 OnInit ,
613 ViewContainerRef ,
@@ -16,12 +23,14 @@ import {DomSanitizer, SafeStyle} from '@angular/platform-browser';
1623 selector : 'app-scene-viewer' ,
1724 templateUrl : './scene-viewer.html' ,
1825 styleUrls : [ './scene-viewer.scss' ] ,
26+ host : {
27+ '[style.filter]' : 'filter' ,
28+ } ,
1929} )
2030export class SceneViewer implements OnInit {
21- private route = inject ( ActivatedRoute ) ;
22- private sanitizer = inject ( DomSanitizer ) ;
23-
24- @HostBinding ( 'style.filter' ) filter : SafeStyle | undefined ;
31+ private _route = inject ( ActivatedRoute ) ;
32+ private _sanitizer = inject ( DomSanitizer ) ;
33+ protected filter : SafeStyle | undefined ;
2534
2635 /**
2736 * Degree to change hue of scene by. All scenes default to a reddish hue.
@@ -36,7 +45,7 @@ export class SceneViewer implements OnInit {
3645 this . _hueRotation = deg ;
3746 // Modern browsers have security built in so this is just bypassing Angular's redundant checks.
3847 // Furthermore these checks will soon be removed.
39- this . filter = this . sanitizer . bypassSecurityTrustStyle ( `hue-rotate(${ this . hueRotation } deg)` ) ;
48+ this . filter = this . _sanitizer . bypassSecurityTrustStyle ( `hue-rotate(${ this . hueRotation } deg)` ) ;
4049 }
4150 private _hueRotation = 0 ;
4251
@@ -49,9 +58,9 @@ export class SceneViewer implements OnInit {
4958 readonly scene = viewChild . required ( 'scene' , { read : ViewContainerRef } ) ;
5059
5160 constructor ( ) {
52- this . hueRotation = this . route . snapshot . data [ 'hueRotate' ] ;
53- this . component = this . route . snapshot . data [ 'scene' ] ;
54- this . scale = this . route . snapshot . data [ 'scale' ] ;
61+ this . hueRotation = this . _route . snapshot . data [ 'hueRotate' ] ;
62+ this . component = this . _route . snapshot . data [ 'scene' ] ;
63+ this . scale = this . _route . snapshot . data [ 'scale' ] ;
5564 }
5665
5766 ngOnInit ( ) {
0 commit comments