1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-01-02 03:37:54 +02:00
pigallery2/frontend/app/gallery/photo/photo.gallery.component.ts

35 lines
1.1 KiB
TypeScript
Raw Normal View History

2016-03-20 17:54:30 +02:00
///<reference path="../../../browser.d.ts"/>
2016-05-04 17:20:21 +02:00
import {Component, Input, ElementRef, ViewChild} from '@angular/core';
2016-03-20 17:54:30 +02:00
import {Photo} from "../../../../common/entities/Photo";
2016-05-04 18:57:31 +02:00
import {Directory} from "../../../../common/entities/Directory";
import {IRenderable, Dimension} from "../../model/IRenderable";
2016-03-20 17:54:30 +02:00
@Component({
selector: 'gallery-photo',
templateUrl: 'app/gallery/photo/photo.gallery.component.html',
styleUrls: ['app/gallery/photo/photo.gallery.component.css'],
2016-03-20 17:54:30 +02:00
})
export class GalleryPhotoComponent implements IRenderable{
2016-03-20 17:54:30 +02:00
@Input() photo: Photo;
2016-03-26 17:25:48 +02:00
@Input() directory: Directory;
@ViewChild("image") imageRef:ElementRef;
2016-03-20 17:54:30 +02:00
constructor() {
2016-03-20 17:54:30 +02:00
}
getPhotoPath(){
2016-05-04 18:34:54 +02:00
return Photo.getThumbnailPath(this.directory,this.photo);
2016-03-20 17:54:30 +02:00
}
2016-04-27 22:37:07 +02:00
2016-04-30 21:36:24 +02:00
public getDimension():Dimension{
return new Dimension(this.imageRef.nativeElement.offsetTop,
this.imageRef.nativeElement.offsetLeft,
this.imageRef.nativeElement.width,
this.imageRef.nativeElement.height);
}
2016-03-20 17:54:30 +02:00
}