-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
6326: fix bug reported at #6518 #6535
Changes from 1 commit
73afc16
c94fbf0
2167b00
11fce35
c98a78d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2297,29 +2297,45 @@ function getZoomCursorStyle(isZoomed, isDragging) { | |
* @param {Number} imgHeight | ||
* @param {Number} zoomScale | ||
* @param {Number} containerHeight | ||
* @param {Number} containerWidth | ||
* @return {Object} | ||
*/ | ||
function getZoomSizingStyle(isZoomed, imgWidth, imgHeight, zoomScale, containerHeight) { | ||
function getZoomSizingStyle(isZoomed, imgWidth, imgHeight, zoomScale, containerHeight, containerWidth) { | ||
if (imgWidth === 0 || imgHeight === 0) { | ||
return { | ||
height: isZoomed ? '250%' : '100%', | ||
width: isZoomed ? '250%' : '100%', | ||
}; | ||
} | ||
const top = `${Math.max((containerHeight - imgHeight) / 2, 0)}px`; | ||
const left = `${Math.max((containerWidth - imgWidth) / 2, 0)}px`; | ||
|
||
// Return different size and offset style based on zoomScale and isZoom | ||
if (isZoomed) { | ||
if (zoomScale > 1) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you please note what's going on in the UI in each of these cases? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added the comments for each styling logic. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's perfect. Thanks! |
||
return { | ||
height: `${imgHeight * zoomScale}px`, | ||
width: `${imgWidth * zoomScale}px`, | ||
}; | ||
} | ||
return { | ||
height: `${(imgHeight * zoomScale)}px`, | ||
width: `${(imgWidth * zoomScale)}px`, | ||
height: `${imgHeight}px`, | ||
width: `${imgWidth}px`, | ||
top, | ||
left, | ||
}; | ||
} | ||
if (zoomScale > 1) { | ||
return { | ||
height: `${imgHeight}px`, | ||
width: `${imgWidth}px`, | ||
top, | ||
left, | ||
}; | ||
} | ||
|
||
const top = `${(containerHeight - imgHeight) / 2}px`; | ||
const left = `calc(50% - ${imgWidth / 2}px)`; | ||
return { | ||
height: `${imgHeight}px`, | ||
width: `${imgWidth}px`, | ||
top, | ||
left, | ||
height: `${imgHeight * zoomScale}px`, | ||
width: `${imgWidth * zoomScale}px`, | ||
}; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment isn't exactly clear. Is it still relevant/needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, my internet speed is not good sometimes. And I noticed that it has some issue because we would not load image correctly.
If you don't need this, I will remove.