mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import {PhotoDTO} from '../../../common/entities/PhotoDTO';
|
|
import {Utils} from '../../../common/Utils';
|
|
import {Config} from '../../../common/config/public/Config';
|
|
|
|
export class IconPhoto {
|
|
|
|
|
|
protected replacementSizeCache: number | boolean = false;
|
|
|
|
constructor(public photo: PhotoDTO) {
|
|
|
|
}
|
|
|
|
iconLoaded() {
|
|
this.photo.readyIcon = true;
|
|
}
|
|
|
|
isIconAvailable() {
|
|
return this.photo.readyIcon;
|
|
}
|
|
|
|
getIconPath() {
|
|
return Utils.concatUrls(Config.Client.urlBase,
|
|
'/api/gallery/content/',
|
|
this.photo.directory.path, this.photo.directory.name, this.photo.name, 'icon');
|
|
}
|
|
|
|
getPhotoPath() {
|
|
return Utils.concatUrls(Config.Client.urlBase,
|
|
'/api/gallery/content/',
|
|
this.photo.directory.path, this.photo.directory.name, this.photo.name);
|
|
}
|
|
|
|
|
|
equals(other: PhotoDTO | IconPhoto): boolean {
|
|
// is gridphoto
|
|
if (other instanceof IconPhoto) {
|
|
return this.photo.directory.path === other.photo.directory.path &&
|
|
this.photo.directory.name === other.photo.directory.name && this.photo.name === other.photo.name;
|
|
}
|
|
|
|
// is photo
|
|
if (other.directory) {
|
|
return this.photo.directory.path === other.directory.path &&
|
|
this.photo.directory.name === other.directory.name && this.photo.name === other.name;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|