1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

improving map lightbox

This commit is contained in:
Patrik J. Braun 2018-05-26 21:47:39 -04:00
parent 6d613aa6f3
commit cc8f4383eb

View File

@ -47,7 +47,7 @@ export class GalleryMapLightboxComponent implements OnChanges {
this.opacity = 1.0;
this.startPosition = position;
this.lightboxDimension = position;
this.lightboxDimension.top -= this.getBodyScrollTop();
this.lightboxDimension.top -= PageHelper.ScrollY;
this.mapDimension = <Dimension>{
top: 0,
left: 0,
@ -74,12 +74,12 @@ export class GalleryMapLightboxComponent implements OnChanges {
const to = this.startPosition;
// iff target image out of screen -> scroll to there
if (this.getBodyScrollTop() > to.top || this.getBodyScrollTop() + this.getScreenHeight() < to.top) {
this.setBodyScrollTop(to.top);
if (PageHelper.ScrollY > to.top || PageHelper.ScrollY + this.getScreenHeight() < to.top) {
PageHelper.ScrollY = to.top;
}
this.lightboxDimension = this.startPosition;
this.lightboxDimension.top -= this.getBodyScrollTop();
this.lightboxDimension.top -= PageHelper.ScrollY;
PageHelper.showScrollY();
this.opacity = 0.0;
setTimeout(() => {
@ -145,14 +145,6 @@ export class GalleryMapLightboxComponent implements OnChanges {
}
private getBodyScrollTop(): number {
return window.scrollY;
}
private setBodyScrollTop(value: number) {
window.scrollTo(window.scrollX, value);
}
private getScreenWidth() {
return window.innerWidth;
}