diff --git a/frontend/app/ui/faces/faces.component.html b/frontend/app/ui/faces/faces.component.html index 3e21391..5e0ddb0 100644 --- a/frontend/app/ui/faces/faces.component.html +++ b/frontend/app/ui/faces/faces.component.html @@ -1,6 +1,6 @@ -
+
diff --git a/frontend/app/ui/faces/faces.component.ts b/frontend/app/ui/faces/faces.component.ts index 3e7de06..646ea6b 100644 --- a/frontend/app/ui/faces/faces.component.ts +++ b/frontend/app/ui/faces/faces.component.ts @@ -1,4 +1,4 @@ -import {Component, ElementRef} from '@angular/core'; +import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; import {FacesService} from './faces.service'; import {QueryService} from '../../model/query.service'; @@ -8,27 +8,25 @@ import {QueryService} from '../../model/query.service'; templateUrl: './faces.component.html', styleUrls: ['./faces.component.css'] }) -export class FacesComponent { - - - size: number; +export class FacesComponent implements OnInit { + @ViewChild('container') container: ElementRef; + public size: number; constructor(public facesService: FacesService, - public queryService: QueryService, - private container: ElementRef) { + public queryService: QueryService) { this.facesService.getPersons().catch(console.error); } - ngOnChanges() { + ngOnInit() { this.updateSize(); } private updateSize() { const size = 220 + 5; - const containerWidth = this.container.nativeElement.parentElement.clientWidth; + // body - container margin + const containerWidth = this.container.nativeElement.clientWidth - 30; this.size = (containerWidth / Math.round((containerWidth / size))) - 5; - console.log(containerWidth, this.size); } diff --git a/frontend/app/ui/frame/frame.component.html b/frontend/app/ui/frame/frame.component.html index 9b9492c..a9b6b4b 100644 --- a/frontend/app/ui/frame/frame.component.html +++ b/frontend/app/ui/frame/frame.component.html @@ -11,6 +11,16 @@