2017-03-21 04:37:23 +08:00
|
|
|
import {PhotoDTO} from "../../../common/entities/PhotoDTO";
|
|
|
|
import {Utils} from "../../../common/Utils";
|
|
|
|
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() {
|
|
|
|
return Utils.concatUrls("/api/gallery/content/", this.photo.directory.path, this.photo.directory.name, this.photo.name, "icon");
|
|
|
|
}
|
2017-03-21 04:37:23 +08:00
|
|
|
|
2017-06-11 04:32:56 +08:00
|
|
|
getPhotoPath() {
|
|
|
|
return Utils.concatUrls("/api/gallery/content/", this.photo.directory.path, this.photo.directory.name, this.photo.name);
|
|
|
|
}
|
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) {
|
|
|
|
return this.photo.directory.path === other.photo.directory.path && this.photo.directory.name === other.photo.directory.name && this.photo.name === other.photo.name
|
|
|
|
}
|
2017-03-21 04:37:23 +08:00
|
|
|
|
2017-06-11 04:32:56 +08:00
|
|
|
//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
|
2017-03-21 04:37:23 +08:00
|
|
|
}
|
2017-06-11 04:32:56 +08:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|