1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/frontend/app/gallery/photo/photo.gallery.component.ts

35 lines
1.0 KiB
TypeScript
Raw Normal View History

2016-03-20 23:54:30 +08:00
///<reference path="../../../browser.d.ts"/>
2016-05-09 23:04:56 +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-05-09 23:04:56 +08:00
import {Directory} from "../../../../common/entities/Directory";
import {IRenderable, Dimension} from "../../model/IRenderable";
2016-03-20 23:54:30 +08:00
@Component({
selector: 'gallery-photo',
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-09 23:04:56 +08:00
export class GalleryPhotoComponent implements IRenderable {
@Input() photo:Photo;
@Input() directory:Directory;
@ViewChild("image") imageRef:ElementRef;
2016-05-09 23:04:56 +08:00
constructor() {
2016-03-20 23:54:30 +08:00
}
2016-05-09 23:04:56 +08:00
getPhotoPath() {
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-09 23:04:56 +08:00
public getDimension():Dimension {
return new Dimension(this.imageRef.nativeElement.offsetTop,
2016-05-09 23:04:56 +08:00
this.imageRef.nativeElement.offsetLeft,
this.imageRef.nativeElement.width,
this.imageRef.nativeElement.height);
}
2016-05-09 23:04:56 +08:00
2016-03-20 23:54:30 +08:00
}