2019-03-03 19:11:36 +08:00
|
|
|
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
|
2019-03-03 17:30:12 +08:00
|
|
|
import {FacesService} from './faces.service';
|
|
|
|
import {QueryService} from '../../model/query.service';
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-faces',
|
|
|
|
templateUrl: './faces.component.html',
|
|
|
|
styleUrls: ['./faces.component.css']
|
|
|
|
})
|
2019-03-03 19:11:36 +08:00
|
|
|
export class FacesComponent implements OnInit {
|
|
|
|
@ViewChild('container') container: ElementRef;
|
|
|
|
public size: number;
|
2019-03-03 17:30:12 +08:00
|
|
|
|
|
|
|
constructor(public facesService: FacesService,
|
2019-03-03 19:11:36 +08:00
|
|
|
public queryService: QueryService) {
|
2019-03-03 17:30:12 +08:00
|
|
|
this.facesService.getPersons().catch(console.error);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-03-03 19:11:36 +08:00
|
|
|
ngOnInit() {
|
2019-03-03 17:30:12 +08:00
|
|
|
this.updateSize();
|
|
|
|
}
|
|
|
|
|
|
|
|
private updateSize() {
|
|
|
|
const size = 220 + 5;
|
2019-03-03 19:11:36 +08:00
|
|
|
// body - container margin
|
|
|
|
const containerWidth = this.container.nativeElement.clientWidth - 30;
|
2019-03-03 17:30:12 +08:00
|
|
|
this.size = (containerWidth / Math.round((containerWidth / size))) - 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|