mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
37 lines
844 B
TypeScript
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);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|