1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-01-06 03:54:12 +02:00

improving map lightbox: centering map

This commit is contained in:
Patrik Braun 2017-07-25 16:13:21 +02:00
parent 296fb8b422
commit 1ffae0d9c5
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,5 @@
<div [hidden]="!visible" #root> <div [hidden]="!visible" #root>
<div class="lightbox" <div class="lightbox"
[style.width.px]="lightboxDimension.width" [style.width.px]="lightboxDimension.width"
[style.height.px]="lightboxDimension.height" [style.height.px]="lightboxDimension.height"

View File

@ -30,8 +30,6 @@ export class GalleryMapLightboxComponent implements OnChanges {
constructor(public fullScreenService: FullScreenService, constructor(public fullScreenService: FullScreenService,
private thumbnailService: ThumbnailManagerService) { private thumbnailService: ThumbnailManagerService) {
} }
//TODO: fix zooming //TODO: fix zooming
@ -43,6 +41,7 @@ export class GalleryMapLightboxComponent implements OnChanges {
} }
public show(position: Dimension) { public show(position: Dimension) {
this.hideImages();
this.visible = true; this.visible = true;
this.opacity = 1.0; this.opacity = 1.0;
this.startPosition = position; this.startPosition = position;
@ -57,7 +56,6 @@ export class GalleryMapLightboxComponent implements OnChanges {
this.map.triggerResize(); this.map.triggerResize();
document.getElementsByTagName('body')[0].style.overflowY = 'hidden'; document.getElementsByTagName('body')[0].style.overflowY = 'hidden';
this.showImages();
setTimeout(() => { setTimeout(() => {
this.lightboxDimension = <Dimension>{ this.lightboxDimension = <Dimension>{
@ -66,6 +64,7 @@ export class GalleryMapLightboxComponent implements OnChanges {
width: this.getScreenWidth(), width: this.getScreenWidth(),
height: this.getScreenHeight() height: this.getScreenHeight()
}; };
this.showImages();
}, 0); }, 0);
} }
@ -129,11 +128,13 @@ export class GalleryMapLightboxComponent implements OnChanges {
} }
} }
public loadPreview(mp: MapPhoto) { public loadPreview(mp: MapPhoto) {
mp.preview.thumbnail.load(); mp.preview.thumbnail.load();
} }
hideImages() { hideImages() {
this.mapCenter = {longitude: 0, latitude: 0};
this.mapPhotos.forEach((mp) => { this.mapPhotos.forEach((mp) => {
mp.iconThumbnail.destroy(); mp.iconThumbnail.destroy();
mp.preview.thumbnail.destroy(); mp.preview.thumbnail.destroy();