Skip to content

Commit

Permalink
fix(lg-zoom): fix actual size on double tap orientation issue
Browse files Browse the repository at this point in the history
this was happening due to wrong scrollTop value
  • Loading branch information
sachinchoolur committed Jul 15, 2021
1 parent bb6f9ff commit 2af13b7
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/plugins/zoom/lg-zoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,15 @@ export default class Zoom {
this.core.LGel.on(`${lGEvents.beforeOpen}.zoom`, () => {
this.core.outer.find('.lg-item').removeClass('lg-zoomable');
});
this.core.LGel.on(`${lGEvents.afterOpen}.zoom`, () => {
this.scrollTop = this.$LG(window).scrollTop();

// Set the initial value center
this.pageX = this.core.outer.width() / 2;
this.pageY = this.core.outer.height() / 2 + this.scrollTop;

this.scale = 1;
});

// Reset zoom on slide change
this.core.LGel.on(
Expand All @@ -626,14 +635,6 @@ export default class Zoom {
// Store the zoomable timeout value just to clear it while closing
this.zoomableTimeout = false;
this.positionChanged = false;

this.scrollTop = this.$LG(window).scrollTop();

// Set the initial value center
this.pageX = this.core.outer.width() / 2;
this.pageY = this.core.outer.height() / 2 + this.scrollTop;

this.scale = 1;
}

zoomIn(scale?: number): void {
Expand Down

0 comments on commit 2af13b7

Please sign in to comment.