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