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

35 lines
874 B
TypeScript
Raw Normal View History

2018-11-05 02:28:32 +08:00
import {Media} from '../Media';
import {MediaDTO} from '../../../../../common/entities/MediaDTO';
2018-11-05 02:28:32 +08:00
import {OrientationTypes} from 'ts-exif-parser';
import {PhotoDTO} from '../../../../../common/entities/PhotoDTO';
import {VideoDTO} from '../../../../../common/entities/VideoDTO';
2018-11-05 02:28:32 +08:00
export class GridMedia extends Media {
constructor(media: MediaDTO, renderWidth: number, renderHeight: number, public rowId: number) {
super(media, renderWidth, renderHeight);
}
public get Orientation(): OrientationTypes {
return (<PhotoDTO>this.media).metadata.orientation || OrientationTypes.TOP_LEFT;
}
isPhoto(): boolean {
return MediaDTO.isPhoto(this.media);
2018-11-05 02:28:32 +08:00
}
isVideo(): boolean {
return MediaDTO.isVideo(this.media);
2018-11-05 02:28:32 +08:00
}
2018-11-23 02:12:10 +08:00
get Video(): VideoDTO {
return <VideoDTO>this.media;
}
2019-03-11 03:57:27 +08:00
get Photo(): PhotoDTO {
return <PhotoDTO>this.media;
}
2018-11-23 02:12:10 +08:00
2018-11-05 02:28:32 +08:00
}