Fixes to center margin option

This commit is contained in:
Jobobby04
2023-04-16 13:10:43 -04:00
parent 7155b2be10
commit d8c2baa135
2 changed files with 5 additions and 3 deletions
@@ -245,7 +245,9 @@ class PagerPageHolder(
private fun mergePages(imageStream: InputStream, imageStream2: InputStream?): InputStream {
// Handle adding a center margin to wide images if requested
if (imageStream2 == null) {
return if (imageStream is BufferedInputStream && ImageUtil.isWideImage(imageStream) &&
return if (imageStream is BufferedInputStream &&
!ImageUtil.isAnimatedAndSupported(imageStream) &&
ImageUtil.isWideImage(imageStream) &&
viewer.config.centerMarginType and PagerConfig.CenterMarginType.WIDE_PAGE_CENTER_MARGIN > 0 &&
!viewer.config.imageCropBorders
) {
@@ -327,7 +329,7 @@ class PagerPageHolder(
imageStream2.close()
val centerMargin = if (viewer.config.centerMarginType and PagerConfig.CenterMarginType.DOUBLE_PAGE_CENTER_MARGIN > 0 && !viewer.config.imageCropBorders) {
96 / (getHeight().coerceAtLeast(1) / max(height, height2).coerceAtLeast(1)).coerceAtLeast(1)
96 / (this.height.coerceAtLeast(1) / max(height, height2).coerceAtLeast(1)).coerceAtLeast(1)
} else {
0
}