1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/frontend/app/ui/faces/faces.component.ts
Patrik J. Braun 0d3b8823e4 ui directory refactoring
adding thumbnail loader for faces
2019-03-03 10:30:12 +01:00

37 lines
844 B
TypeScript

import {Component, ElementRef} from '@angular/core';
import {FacesService} from './faces.service';
import {QueryService} from '../../model/query.service';
@Component({
selector: 'app-faces',
templateUrl: './faces.component.html',
styleUrls: ['./faces.component.css']
})
export class FacesComponent {
size: number;
constructor(public facesService: FacesService,
public queryService: QueryService,
private container: ElementRef) {
this.facesService.getPersons().catch(console.error);
}
ngOnChanges() {
this.updateSize();
}
private updateSize() {
const size = 220 + 5;
const containerWidth = this.container.nativeElement.parentElement.clientWidth;
this.size = (containerWidth / Math.round((containerWidth / size))) - 5;
console.log(containerWidth, this.size);
}
}