From dc3a97ac6c154b6e6fdd999d228474dd9ac64ad5 Mon Sep 17 00:00:00 2001 From: Braun Patrik Date: Sat, 10 Jun 2017 22:56:23 +0200 Subject: [PATCH] bug fixing --- backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts | 4 ++-- .../gallery/grid/photo/photo.grid.gallery.component.ts | 2 +- .../app/gallery/lightbox/lightbox.gallery.component.ts | 4 ++-- .../map/lightbox/lightbox.map.gallery.component.ts | 4 ++-- frontend/app/gallery/thumnailLoader.service.ts | 4 ++-- frontend/app/gallery/thumnailManager.service.ts | 8 ++++---- package.json | 1 + 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts b/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts index 129b6776..1b384fde 100644 --- a/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts +++ b/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts @@ -149,7 +149,7 @@ export class ThumbnailGeneratorMWs { __dirname: __dirname, }; if (Config.Server.enableThreading == true) { - pool.send(imagePath) + pool.send(input) .on('done', (out) => { return next(out); }).on('error', (error) => { @@ -173,4 +173,4 @@ export class ThumbnailGeneratorMWs { private static generateThumbnailName(imagePath: string, size: number): string { return crypto.createHash('md5').update(imagePath).digest('hex') + "_" + size + ".jpg"; } -} \ No newline at end of file +} diff --git a/frontend/app/gallery/grid/photo/photo.grid.gallery.component.ts b/frontend/app/gallery/grid/photo/photo.grid.gallery.component.ts index fcfc6780..99cd5fb1 100644 --- a/frontend/app/gallery/grid/photo/photo.grid.gallery.component.ts +++ b/frontend/app/gallery/grid/photo/photo.grid.gallery.component.ts @@ -64,7 +64,7 @@ export class GalleryPhotoComponent implements IRenderable, OnInit, OnDestroy { ngAfterViewInit() { //schedule change after Angular checks the model if (!this.gridPhoto.isThumbnailAvailable()) { - setImmediate(() => { + set Timeout(() => { let listener: ThumbnailLoadingListener = { onStartedLoading: () => { //onLoadStarted diff --git a/frontend/app/gallery/lightbox/lightbox.gallery.component.ts b/frontend/app/gallery/lightbox/lightbox.gallery.component.ts index c1f5f423..3bcfda8d 100644 --- a/frontend/app/gallery/lightbox/lightbox.gallery.component.ts +++ b/frontend/app/gallery/lightbox/lightbox.gallery.component.ts @@ -121,7 +121,7 @@ export class GalleryLightboxComponent { //disable scroll this.overlayService.showOverlay(); - setImmediate(() => { + setTimeout(() => { this.lightboxDimension = { top: 0, left: 0, @@ -130,7 +130,7 @@ export class GalleryLightboxComponent { }; this.blackCanvasOpacity = 1.0; this.showPhoto(this.gridPhotoQL.toArray().indexOf(selectedPhoto)); - }); + }, 0); } public hide() { diff --git a/frontend/app/gallery/map/lightbox/lightbox.map.gallery.component.ts b/frontend/app/gallery/map/lightbox/lightbox.map.gallery.component.ts index 1f6a7357..b9089f04 100644 --- a/frontend/app/gallery/map/lightbox/lightbox.map.gallery.component.ts +++ b/frontend/app/gallery/map/lightbox/lightbox.map.gallery.component.ts @@ -57,14 +57,14 @@ export class GalleryMapLightboxComponent implements OnChanges { document.getElementsByTagName('body')[0].style.overflow = 'hidden'; this.showImages(); - setImmediate(() => { + setTimeout(() => { this.lightboxDimension = { top: 0, left: 0, width: this.getScreenWidth(), height: this.getScreenHeight() }; - }); + }, 0); } public hide() { diff --git a/frontend/app/gallery/thumnailLoader.service.ts b/frontend/app/gallery/thumnailLoader.service.ts index 728bb2db..274c5786 100644 --- a/frontend/app/gallery/thumnailLoader.service.ts +++ b/frontend/app/gallery/thumnailLoader.service.ts @@ -68,7 +68,7 @@ export class ThumbnailLoaderService { path: photo.getIconPath() }); } - setImmediate(this.run); + setTimeout(this.run, 0); return thumbnailTaskEntity; } @@ -103,7 +103,7 @@ export class ThumbnailLoaderService { path: photo.getThumbnailPath() }); } - setImmediate(this.run); + setTimeout(this.run, 0); return thumbnailTaskEntity; } diff --git a/frontend/app/gallery/thumnailManager.service.ts b/frontend/app/gallery/thumnailManager.service.ts index 567e3c99..d728736c 100644 --- a/frontend/app/gallery/thumnailManager.service.ts +++ b/frontend/app/gallery/thumnailManager.service.ts @@ -77,7 +77,7 @@ export class IconThumbnail extends ThumbnailBase { } if (!this.photo.isIconAvailable()) { - setImmediate(() => { + setTimeout(() => { let listener: ThumbnailLoadingListener = { onStartedLoading: () => { //onLoadStarted @@ -101,7 +101,7 @@ export class IconThumbnail extends ThumbnailBase { this.thumbnailTask = this.thumbnailService.loadIcon(this.photo, ThumbnailLoadingPriority.high, listener); - }); + }, 0); } } @@ -134,7 +134,7 @@ export class Thumbnail extends ThumbnailBase { } if (!this.photo.isThumbnailAvailable()) { - setImmediate(() => { + setTimeout(() => { let listener: ThumbnailLoadingListener = { onStartedLoading: () => { //onLoadStarted @@ -162,7 +162,7 @@ export class Thumbnail extends ThumbnailBase { } - }); + }, 0); } } diff --git a/package.json b/package.json index 9754ff15..dd8c5045 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "main": "./backend/server.js", "scripts": { "build": "ng build", + "pretest": "tsc", "test": "ng test --single-run && mocha --recursive test/backend/unit", "start": "node ./backend/server", "ng": "ng",