1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-21 01:22:08 +02:00
pigallery2/frontend/app/gallery/photo/photo.gallery.component.ts
2016-05-04 18:57:31 +02:00

35 lines
1.1 KiB
TypeScript

///<reference path="../../../browser.d.ts"/>
import {Component, Input, ElementRef, ViewChild} from '@angular/core';
import {Photo} from "../../../../common/entities/Photo";
import {Directory} from "../../../../common/entities/Directory";
import {IRenderable, Dimension} from "../../model/IRenderable";
@Component({
selector: 'gallery-photo',
templateUrl: 'app/gallery/photo/photo.gallery.component.html',
styleUrls: ['app/gallery/photo/photo.gallery.component.css'],
})
export class GalleryPhotoComponent implements IRenderable{
@Input() photo: Photo;
@Input() directory: Directory;
@ViewChild("image") imageRef:ElementRef;
constructor() {
}
getPhotoPath(){
return Photo.getThumbnailPath(this.directory,this.photo);
}
public getDimension():Dimension{
return new Dimension(this.imageRef.nativeElement.offsetTop,
this.imageRef.nativeElement.offsetLeft,
this.imageRef.nativeElement.width,
this.imageRef.nativeElement.height);
}
}