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

46 lines
1.3 KiB
TypeScript
Raw Normal View History

2016-05-12 17:00:46 +08:00
///<reference path="../../../../browser.d.ts"/>
import {Component, Input, ElementRef, ViewChild} from "@angular/core";
2016-05-16 00:52:07 +08:00
import {AnimationBuilder} from "@angular/platform-browser/src/animate/animation_builder";
2016-05-12 17:00:46 +08:00
import {IRenderable, Dimension} from "../../../model/IRenderable";
import {GridPhoto} from "../GridPhoto";
@Component({
selector: 'gallery-grid-photo',
templateUrl: 'app/gallery/grid/photo/photo.grid.gallery.component.html',
styleUrls: ['app/gallery/grid/photo/photo.grid.gallery.component.css'],
})
export class GalleryPhotoComponent implements IRenderable {
@Input() gridPhoto:GridPhoto;
@ViewChild("image") imageRef:ElementRef;
2016-05-16 00:52:07 +08:00
@ViewChild("info") infoDiv:ElementRef;
infoHeight:number = 0;
infobackground = "";
2016-05-12 17:00:46 +08:00
2016-05-16 00:52:07 +08:00
constructor(private animBuilder:AnimationBuilder) {
2016-05-12 17:00:46 +08:00
}
2016-05-16 00:52:07 +08:00
hover() {
this.infoHeight = this.infoDiv.nativeElement.clientHeight;
this.infobackground = "rgba(0,0,0,0.8)";
2016-05-12 17:00:46 +08:00
}
2016-05-16 00:52:07 +08:00
mouseOut() {
this.infoHeight = 0;
this.infobackground = "rgba(0,0,0,0.0)";
}
2016-05-12 17:00:46 +08:00
public getDimension():Dimension {
return new Dimension(this.imageRef.nativeElement.offsetTop,
this.imageRef.nativeElement.offsetLeft,
this.imageRef.nativeElement.width,
this.imageRef.nativeElement.height);
}
}