1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

improving media merging and map icon rendering

This commit is contained in:
Patrik J. Braun 2018-12-09 13:59:51 +01:00
parent 3ef2746bc2
commit aa6f4b83ae
6 changed files with 17 additions and 3 deletions

View File

@ -90,7 +90,7 @@ export class PublicConfigClass {
Thumbnail: { Thumbnail: {
concurrentThumbnailGenerations: 1, concurrentThumbnailGenerations: 1,
thumbnailSizes: [200, 400, 600], thumbnailSizes: [200, 400, 600],
iconSize: 30 iconSize: 45
}, },
Search: { Search: {
enabled: true, enabled: true,

View File

@ -143,6 +143,9 @@ export class GalleryComponent implements OnInit, OnDestroy {
}; };
private sortDirectories() { private sortDirectories() {
if (!this.directories) {
return;
}
switch (this._galleryService.sorting.value) { switch (this._galleryService.sorting.value) {
case SortingMethods.ascName: case SortingMethods.ascName:
case SortingMethods.ascDate: case SortingMethods.ascDate:

View File

@ -47,6 +47,7 @@ export class GalleryService {
this.sorting.next(sorting); this.sorting.next(sorting);
} }
public async loadDirectory(directoryName: string): Promise<void> { public async loadDirectory(directoryName: string): Promise<void> {
const content = new ContentWrapper(); const content = new ContentWrapper();

View File

@ -253,7 +253,8 @@ export class GalleryGridComponent implements OnChanges, OnInit, AfterViewInit, O
// merge new data with old one // merge new data with old one
let lastSameIndex = 0; let lastSameIndex = 0;
let lastRowId = null; let lastRowId = null;
for (let i = 0; i < this.media.length && i < this.photosToRender.length; ++i) { let i = 0;
for (; i < this.media.length && i < this.photosToRender.length; ++i) {
// If a media changed the whole row has to be removed // If a media changed the whole row has to be removed
if (this.photosToRender[i].rowId !== lastRowId) { if (this.photosToRender[i].rowId !== lastRowId) {
@ -264,12 +265,20 @@ export class GalleryGridComponent implements OnChanges, OnInit, AfterViewInit, O
break; break;
} }
} }
// if all the same
if (this.photosToRender.length > 0 &&
i === this.photosToRender.length &&
i === this.media.length &&
this.photosToRender[i - 1].equals(this.media[i - 1])) {
lastSameIndex = i;
}
if (lastSameIndex > 0) { if (lastSameIndex > 0) {
this.photosToRender.splice(lastSameIndex, this.photosToRender.length - lastSameIndex); this.photosToRender.splice(lastSameIndex, this.photosToRender.length - lastSameIndex);
this.renderedPhotoIndex = lastSameIndex; this.renderedPhotoIndex = lastSameIndex;
} else { } else {
this.clearRenderedPhotos(); this.clearRenderedPhotos();
} }
} }

View File

@ -25,7 +25,7 @@
<yaga-icon <yaga-icon
*ngIf="photo.iconUrl" *ngIf="photo.iconUrl"
[iconUrl]="photo.iconUrl" [iconUrl]="photo.iconUrl"
[iconSize]="iconSize" [iconSize]="yagaMap.zoom < 15 ? smallIconSize : iconSize"
></yaga-icon> ></yaga-icon>
<yaga-popup <yaga-popup
(open)="loadPreview(photo)" (open)="loadPreview(photo)"

View File

@ -37,6 +37,7 @@ export class GalleryMapLightboxComponent implements OnChanges, AfterViewInit {
@ViewChild('root') elementRef: ElementRef; @ViewChild('root') elementRef: ElementRef;
@ViewChild('yagaMap') yagaMap: MapComponent; @ViewChild('yagaMap') yagaMap: MapComponent;
public smallIconSize = new Point(Config.Client.Thumbnail.iconSize * 0.75, Config.Client.Thumbnail.iconSize * 0.75);
public iconSize = new Point(Config.Client.Thumbnail.iconSize, Config.Client.Thumbnail.iconSize); public iconSize = new Point(Config.Client.Thumbnail.iconSize, Config.Client.Thumbnail.iconSize);
constructor(public fullScreenService: FullScreenService, constructor(public fullScreenService: FullScreenService,