Skip to content

Commit

Permalink
fix(image): Fix zoom for rotated image when annotations is enabled (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jstoffan authored Jul 1, 2020
1 parent f227a63 commit a9edcd4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/viewers/image/ImageViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ class ImageViewer extends ImageBaseViewer {
let topPadding = 0;
let largerWidth = 0;
let largerHeight = 0;
const imageDimensions = this.imageEl.getBoundingClientRect();
const wrapperDimensions = this.wrapperEl.getBoundingClientRect();
const viewport = {
width: this.wrapperEl.clientWidth - IMAGE_PADDING,
Expand Down Expand Up @@ -348,8 +349,8 @@ class ImageViewer extends ImageBaseViewer {
this.imageEl.style.top = `${topPadding}px`;

// Fix the scroll position of the image to be centered
this.wrapperEl.scrollLeft = (this.imageEl.clientWidth - viewport.width) / 2;
this.wrapperEl.scrollTop = (this.imageEl.clientHeight - viewport.height) / 2;
this.wrapperEl.scrollLeft = (imageDimensions.width - viewport.width) / 2;
this.wrapperEl.scrollTop = (imageDimensions.height - viewport.height) / 2;
}

//--------------------------------------------------------------------------
Expand Down

0 comments on commit a9edcd4

Please sign in to comment.