2018-03-31 03:30:30 +08:00
|
|
|
import {PhotoDTO} from '../../../common/entities/PhotoDTO';
|
|
|
|
import {Utils} from '../../../common/Utils';
|
|
|
|
|
2017-03-21 04:37:23 +08:00
|
|
|
export class IconPhoto {
|
|
|
|
|
|
|
|
|
2017-06-11 04:32:56 +08:00
|
|
|
protected replacementSizeCache: number | boolean = false;
|
2017-03-21 04:37:23 +08:00
|
|
|
|
2017-06-11 04:32:56 +08:00
|
|
|
constructor(public photo: PhotoDTO) {
|
2017-03-21 04:37:23 +08:00
|
|
|
|
2017-06-11 04:32:56 +08:00
|
|
|
}
|
2017-03-21 04:37:23 +08:00
|
|
|
|
2017-06-11 04:32:56 +08:00
|
|
|
iconLoaded() {
|
|
|
|
this.photo.readyIcon = true;
|
|
|
|
}
|
2017-03-21 04:37:23 +08:00
|
|
|
|
2017-06-11 04:32:56 +08:00
|
|
|
isIconAvailable() {
|
|
|
|
return this.photo.readyIcon;
|
|
|
|
}
|
2017-03-21 04:37:23 +08:00
|
|
|
|
2017-06-11 04:32:56 +08:00
|
|
|
getIconPath() {
|
2018-03-31 03:30:30 +08:00
|
|
|
return Utils.concatUrls('/api/gallery/content/', this.photo.directory.path, this.photo.directory.name, this.photo.name, 'icon');
|
2017-06-11 04:32:56 +08:00
|
|
|
}
|
2017-03-21 04:37:23 +08:00
|
|
|
|
2017-06-11 04:32:56 +08:00
|
|
|
getPhotoPath() {
|
2018-03-31 03:30:30 +08:00
|
|
|
return Utils.concatUrls('/api/gallery/content/', this.photo.directory.path, this.photo.directory.name, this.photo.name);
|
2017-06-11 04:32:56 +08:00
|
|
|
}
|
2017-03-21 04:37:23 +08:00
|
|
|
|
|
|
|
|
2017-06-11 04:32:56 +08:00
|
|
|
equals(other: PhotoDTO | IconPhoto): boolean {
|
|
|
|
//is gridphoto
|
|
|
|
if (other instanceof IconPhoto) {
|
2018-03-31 03:30:30 +08:00
|
|
|
return this.photo.directory.path === other.photo.directory.path && this.photo.directory.name === other.photo.directory.name && this.photo.name === other.photo.name;
|
2017-06-11 04:32:56 +08:00
|
|
|
}
|
2017-03-21 04:37:23 +08:00
|
|
|
|
2017-06-11 04:32:56 +08:00
|
|
|
//is photo
|
|
|
|
if (other.directory) {
|
2018-03-31 03:30:30 +08:00
|
|
|
return this.photo.directory.path === other.directory.path && this.photo.directory.name === other.directory.name && this.photo.name === other.name;
|
2017-03-21 04:37:23 +08:00
|
|
|
}
|
2017-06-11 04:32:56 +08:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|