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